As shown in Figure 1, SwitchA and SwitchB are located on the same link. SwitchA is deployed as the DHCPv6 server and SwitchB is deployed as the DHCPv6 client to enable SwitchB to obtain an IPv6 address through route advertisement and obtain the DNS server address through the DHCPv6 server.
Configure the DHCPv6 server function on SwitchA, so that IPv6 addresses can be assigned to clients through route advertisement and DNS server addresses can be assigned to clients through the DHCPv6 server.
Configure the DHCPv6 client function on SwitchB, so that the DHCPv6 client can obtain an IPv6 address through route advertisement and obtain the DNS server address through the DHCPv6 server.
Ensure that the DHCPv6 and DNS servers are routable to each other before the configuration.
When a client obtains an IP address through stateless DHCPv6 address autoconfiguration, only information such as DNS information will be assigned from the IP address pool on the device; user information cannot be queried and logs will not be generated on the device.
# Configure an IPv6 address for the interface.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] ipv6 [SwitchA] vlan 100 [SwitchA-vlan100] quit [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type access [SwitchA-GigabitEthernet0/0/1] port default vlan 100 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ipv6 enable [SwitchA-Vlanif100] ipv6 address fc00:3::1/64 [SwitchA-Vlanif100] quit
[SwitchA] dhcp enable [SwitchA] dhcpv6 pool pool1 [SwitchA-dhcpv6-pool-pool1] dns-server fc00:4::1 [SwitchA-dhcpv6-pool-pool1] quit
# Configure the client to obtain an IPv6 address through route advertisement and obtain other network parameters through the DHCPv6 server.
[SwitchA] interface vlanif 100 [SwitchA-Vlanif100] undo ipv6 nd ra halt [SwitchA-Vlanif100] ipv6 nd autoconfig other-flag [SwitchA-Vlanif100] dhcpv6 server pool1 [SwitchA-Vlanif100] quit [SwitchA] quit
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] ipv6 [SwitchB] vlan 100 [SwitchB-vlan100] quit [SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] port link-type access [SwitchB-GigabitEthernet0/0/1] port default vlan 100 [SwitchB-GigabitEthernet0/0/1] quit [SwitchB] interface vlanif 100 [SwitchB-Vlanif100] ipv6 enable [SwitchB-Vlanif100] ipv6 address auto global default [SwitchB-Vlanif100] dhcpv6 client information-request
# On SwitchA, run the display dhcpv6 pool command to check the configuration of the IPv6 address pool pool1.
<SwitchA> display dhcpv6 pool pool1
DHCPv6 pool: pool1
Information refresh time: 86400
DNS server address: FC00:4::1
conflict-address expire-time: 172800
renew-time-percent : 50
rebind-time-percent : 80
Logging : Disable
# On SwitchA, run the display ipv6 interface vlanif 100 command to check the IPv6 link-local address of VLANIF 100, so that you can further check whether the default route destined for the IPv6 gateway is generated on the DHCPv6 client.
<SwitchA> display ipv6 interface vlanif 100 Vlanif100 current state : UP IPv6 protocol current state : UP IPv6 is enabled, link-local address is FE80::2EAB:FF:FE98:15BB Global unicast address(es): FC00:3::1, subnet is FC00:3::/64 Joined group address(es): FF02::1:2 FF02::1:FF00:1 FF02::1:FF98:15BB FF02::2 FF02::1 ……
# On SwitchB, run the display dhcpv6 client command to check the DHCPv6 client configuration.
<SwitchB> display dhcpv6 client interface vlanif 100 Vlanif100 is in stateless DHCPv6 client mode. Stateless DHCPv6 client is in OPEN state. Preferred server DUID : 000300012CAB009815B0 Reachable via address : FE80::2EAB:FF:FE98:15BB Infomation refresh time is 86400 seconds DNS server : FC00:4::1
# On SwitchB, run the display ipv6 interface Vlanif 100 command to check the IPv6 configuration information about VLANIF 100.
<SwitchB> display ipv6 interface vlanif 100 Vlanif100 current state : UP IPv6 protocol current state : UP IPv6 is enabled, link-local address is FE80::865B:12FF:FE36:595B Global unicast address(es): FC00:3::865B:12FF:FE36:595B, subnet is FC00:3::/64 [SLAAC 2018-11-16 10:16:06 2592000S] Joined group address(es): FF02::1:FF36:595B FF02::2 FF02::1 ……
# On SwitchB, run the display ipv6 routing-table command to check the generated default route destined for the IPv6 gateway on the DHCPv6 client.
<SwitchB> display ipv6 routing-table Routing Table : Public Destinations : 5 Routes : 5 Destination : :: PrefixLength : 0 NextHop : FE80::2EAB:FF:FE98:15BB Preference : 64 Cost : 0 Protocol : Unr RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif100 Flags : D Destination : ::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : InLoopBack0 Flags : D Destination : FC00:3:: PrefixLength : 64 NextHop : FC00:3::865B:12FF:FE36:595B Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif100 Flags : D Destination : FC00:3::865B:12FF:FE36:595B PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif100 Flags : D Destination : FE80:: PrefixLength : 10 NextHop : :: Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : NULL0 Flags : D
# sysname SwitchA # ipv6 # vlan batch 100 # dhcp enable # dhcpv6 pool pool1 dns-server FC00:4::1 # interface Vlanif100 ipv6 enable ipv6 address FC00:3::1/64 undo ipv6 nd ra halt ipv6 nd autoconfig other-flag dhcpv6 server pool1 # interface GigabitEthernet0/0/1 port link-type access port default vlan 100 # return
#
sysname SwitchB
#
ipv6
#
vlan batch 100
#
interface Vlanif100
ipv6 enable
ipv6 address auto global default
dhcpv6 client information-request
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 100
#
return