欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

华为交换机配置DHCPv6中继示例实现为多个网段的用户分配IPv6地址

程序员文章站 2022-07-02 21:10:43
...

华为交换机配置DHCPv6中继示例实现为多个网段的用户分配IPv6地址
配置SwitchA作为DHCPv6中继

使能DHCP服务。

system-view
[HUAWEI] sysname SwitchA
[SwitchA] dhcp enable

配置接口GE1/0/1接口加入VLAN10,接口GE1/0/2接口加入VLAN20,接口GE1/0/3接口加入VLAN30。

[SwitchA] vlan batch 10 20 30
[SwitchA] interface gigabitethernet 1/0/1
[SwitchA-GigabitEthernet1/0/1] port link-type hybrid
[SwitchA-GigabitEthernet1/0/1] port hybrid pvid vlan 10
[SwitchA-GigabitEthernet1/0/1] port hybrid untagged vlan 10
[SwitchA-GigabitEthernet1/0/1] quit
[SwitchA] interface gigabitethernet 1/0/2
[SwitchA-GigabitEthernet1/0/2] port link-type hybrid
[SwitchA-GigabitEthernet1/0/2] port hybrid pvid vlan 20
[SwitchA-GigabitEthernet1/0/2] port hybrid untagged vlan 20
[SwitchA-GigabitEthernet1/0/2] quit
[SwitchA] interface gigabitethernet 1/0/3
[SwitchA-GigabitEthernet1/0/3] port link-type hybrid
[SwitchA-GigabitEthernet1/0/3] port hybrid pvid vlan 30
[SwitchA-GigabitEthernet1/0/3] port hybrid untagged vlan 30
[SwitchA-GigabitEthernet1/0/3] quit

配置VLANIF接口的IPv6地址。

[SwitchA] ipv6
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] ipv6 enable
[SwitchA-Vlanif10] ipv6 address fc00:1::1 64
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 20
[SwitchA-Vlanif20] ipv6 enable
[SwitchA-Vlanif20] ipv6 address fc00:3::1 64
[SwitchA-Vlanif20] quit
[SwitchA] interface vlanif 30
[SwitchA-Vlanif30] ipv6 enable
[SwitchA-Vlanif30] ipv6 address fc00:2::1 64
[SwitchA-Vlanif30] quit

使能DHCPv6中继功能。

[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] dhcpv6 relay destination fc00:3::3
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 30
[SwitchA-Vlanif30] dhcpv6 relay destination fc00:3::3
[SwitchA-Vlanif30] quit

配置SwitchA作为网关向主机发送RA消息的M和O标志位,实现主机通过DHCPv6方式获取IPv6地址。

[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] undo ipv6 nd ra halt
[SwitchA-Vlanif10] ipv6 nd autoconfig managed-address-flag
[SwitchA-Vlanif10] ipv6 nd autoconfig other-flag
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 30
[SwitchA-Vlanif30] undo ipv6 nd ra halt
[SwitchA-Vlanif30] ipv6 nd autoconfig managed-address-flag
[SwitchA-Vlanif30] ipv6 nd autoconfig other-flag
[SwitchA-Vlanif30] quit

配置SwitchB作为DHCPv6服务器

system-view
[HUAWEI] sysname SwitchB
[SwitchB] dhcp enable
[SwitchB] ipv6
[SwitchB] vlan 20
[SwitchB-vlan20] quit
[SwitchB] interface gigabitethernet 1/0/2
[SwitchB-GigabitEthernet1/0/2] port link-type hybrid
[SwitchB-GigabitEthernet1/0/2] port hybrid pvid vlan 20
[SwitchB-GigabitEthernet1/0/2] port hybrid untagged vlan 20
[SwitchB-GigabitEthernet1/0/2] quit
[SwitchB] interface vlanif 20
[SwitchB-Vlanif20] ipv6 enable
[SwitchB-Vlanif20] ipv6 address fc00:3::3 64
[SwitchB-Vlanif20] quit
[SwitchB] dhcpv6 pool pool1
[SwitchB-dhcpv6-pool-pool1] address prefix fc00:1::/64
[SwitchB-dhcpv6-pool-pool1] excluded-address fc00:1::1
[SwitchB-dhcpv6-pool-pool1] quit
[SwitchB] dhcpv6 pool pool2
[SwitchB-dhcpv6-pool-pool2] address prefix fc00:2::/64
[SwitchB-dhcpv6-pool-pool2] excluded-address fc00:2::1
[SwitchB-dhcpv6-pool-pool2] quit
[SwitchB] dhcpv6 server preference 255
[SwitchB] ipv6 route-static :: 0 fc00:3::1


#
sysname SwitchA
#
ipv6
#
vlan batch 10 20 30
#
dhcp enable
#
interface Vlanif10
 ipv6 enable
 ipv6 address FC00:1::1/64
 undo ipv6 nd ra halt
 ipv6 nd autoconfig managed-address-flag
 ipv6 nd autoconfig other-flag
 dhcpv6 relay destination FC00:3::3
#
interface Vlanif20
 ipv6 enable
 ipv6 address FC00:3::1/64
#
interface Vlanif30
 ipv6 enable
 ipv6 address FC00:2::1/64
 undo ipv6 nd ra halt
 ipv6 nd autoconfig managed-address-flag
 ipv6 nd autoconfig other-flag
 dhcpv6 relay destination FC00:3::3
#
interface GigabitEthernet1/0/1
 port link-type hybrid
 port hybrid pvid vlan 10
 port hybrid untagged vlan 10
#
interface GigabitEthernet1/0/2
 port link-type hybrid
 port hybrid pvid vlan 20
 port hybrid untagged vlan 20
#
interface GigabitEthernet1/0/3
 port link-type hybrid
 port hybrid pvid vlan 30
 port hybrid untagged vlan 30
#
return
**SwitchB的配置文件**

#
sysname SwitchB
#
ipv6
#
vlan batch 20
#
dhcp enable
#
dhcpv6 server preference 255
#
dhcpv6 pool pool1
 address prefix FC00:1::/64
 excluded-address FC00:1::1
#
dhcpv6 pool pool2
 address prefix FC00:2::/64
 excluded-address FC00:2::1
#
interface Vlanif20
 ipv6 enable
 ipv6 address FC00:3::3/64
#
interface GigabitEthernet1/0/2
 port link-type hybrid
 port hybrid pvid vlan 20
 port hybrid untagged vlan 20
#
ipv6 route-static :: 0 FC00:3::1
#


华为手册内容

相关标签: 数通