As shown in Figure 1, SwitchA and SwitchB are located on the same link; SwitchB functions as the gateway of hosts PC1 to PCn and is connected to these hosts through interfaces GE0/0/2 to GE0/0/n. SwitchA is deployed as the DHCPv6 PD server and SwitchB is deployed as the DHCPv6 PD client. Hosts PC1 to PCn automatically generate IPv6 addresses by advertising routes based on the IPv6 address prefix obtained by the DHCPv6 PD client. This implements hierarchical deployment of host IPv6 addresses.
Configure the DHCPv6 PD server function on SwitchA to dynamically assign IPv6 address prefixes to the DHCPv6 PD client. Configure IPv6 addresses for interfaces, configure an IPv6 address pool, and enable the DHCPv6 PD server function on the interfaces.
Configure the DHCPv6 PD client function on SwitchB to dynamically obtain IPv6 address prefixes from the DHCPv6 PD server. Configure the IPv6 function and enable the DHCPv6 client function on the interfaces.
Bind the obtained IPv6 address prefix to the downlink interface of SwitchB so that hosts PC1 to PCn can automatically generate IPv6 addresses by advertising routes.
Configure hosts PC1 to PCn to automatically obtain IPv6 addresses.
Hosts connected to a DHCPv6 PD client can reside on multiple network segments. For example, the length of the prefix obtained by the DHCPv6 PD client in this example is 63. The hosts then can be divided into two network segments ::0:0:0:0:1/64 and ::1:0:0:0:1/64. You can run the ipv6 address myprefix ::0:0:0:0:1/64 command on the Layer 3 interface connected to the hosts that reside on ::0:0:0:0:1/64 and run the ipv6 address myprefix ::1:0:0:0:1/64 command on the Layer 3 interface connected to the hosts that reside on ::1:0:0:0:1/64.
# 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 trunk [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass 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
# Configure an IPv6 PD address pool.
[SwitchA] dhcpv6 pool pool1 [SwitchA-dhcpv6-pool-pool1] prefix-delegation fc00:2::/60 63 [SwitchA-dhcpv6-pool-pool1] quit
# Enable the DHCPv6 PD server function on the interface.
[SwitchA] dhcp enable [SwitchA] interface vlanif 100 [SwitchA-Vlanif100] dhcpv6 server pool1 [SwitchA-Vlanif100] undo ipv6 nd ra halt [SwitchA-Vlanif100] quit
# Configure an IPv6 static route destined for the network segment FC00:2:: where the hosts reside and set the next-hop IPv6 address to the global IPv6 unicast address FC00:3::865B:12FF:FE36:595B of the interconnected interface.
[SwitchA] ipv6 route-static FC00:2:: 64 vlanif100 FC00:3::865B:12FF:FE36:595B
# Configure the IPv6 function on the interface.
<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 trunk [SwitchB-GigabitEthernet0/0/1] port trunk allow-pass vlan 100 [SwitchB-GigabitEthernet0/0/1] quit [SwitchB] interface vlanif 100 [SwitchB-Vlanif100] ipv6 enable [SwitchB-Vlanif100] ipv6 address auto link-local [SwitchB-Vlanif100] ipv6 address auto global
# Enable the DHCPv6 PD client function on the interface.
[SwitchB-Vlanif100] dhcpv6 client pd myprefix [SwitchB-Vlanif100] quit
[SwitchB] vlan 200 [SwitchB-vlan200] quit [SwitchB] interface gigabitethernet 0/0/2 [SwitchB-GigabitEthernet0/0/2] port link-type access [SwitchB-GigabitEthernet0/0/2] port default vlan 200 [SwitchB-GigabitEthernet0/0/2] quit [SwitchB] interface vlanif 200 [SwitchB-Vlanif200] ipv6 enable [SwitchB-Vlanif200] ipv6 address auto link-local [SwitchB-Vlanif200] ipv6 address myprefix ::1/64 [SwitchB-Vlanif200] undo ipv6 nd ra halt [SwitchB-Vlanif200] quit
# On SwitchA, run the display dhcpv6 pool command to check the configuration and IPv6 address prefix assignment of the IPv6 PD address pool pool1.
[SwitchA] display dhcpv6 pool pool1
DHCPv6 pool: pool1
Prefix delegation: FC00:2::/60 63
Lifetime valid 172800 seconds, preferred 86400 seconds
1 in use
Information refresh time: 86400
conflict-address expire-time: 172800
renew-time-percent : 50
rebind-time-percent : 80
Active pd clients: 1
Logging : Disable
[SwitchA] display dhcpv6 pool pool1 allocated prefix Prefix/length Valid Expires Left ------------------------------------------------------------------------------- FC00:2::/63 172800 2014-03-24 11:45:24 172462 ------------------------------------------------------------------------------- Total : 1
# On SwitchA, run the display ipv6 routing-table command to check IPv6 route information and verify that a static route destined for the host network segment is available.
[SwitchA] display ipv6 routing-table Routing Table : Public Destinations : 5 Routes : 5 Destination : ::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : InLoopBack0 Flags : D Destination : FC00:2:: PrefixLength : 64 NextHop : FC00:3::865B:12FF:FE36:595B Preference : 60 Cost : 0 Protocol : Static RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif100 Flags : D Destination : FC00:3:: PrefixLength : 64 NextHop : FC00:3::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif100 Flags : D Destination : FC00:3::1 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
# On SwitchB, run the display dhcpv6 client command to check the DHCPv6 PD client configuration and run the display ipv6 interface command to check the IPv6 address information about the host-side interface VLANIF 200.
[SwitchB] display dhcpv6 client
Vlanif100 is in DHCPv6-PD client mode.
DHCPv6-PD client is in BOUND state.
Preferred server DUID : 00030001000B0923198D
Reachable via address : FE80::20B:9FF:FEED:14D4
IA PD IA ID 0x00000751 T1 43200 T2 69120
Prefix name : myprefix
Obtained : 2014-04-24 09:36:38
Renews : 2014-04-24 21:36:38
Rebinds : 2014-04-25 04:48:38
Prefix : FC00:2::/63
Lifetime valid 172800 seconds, preferred 86400 seconds
Expires at 2067-09-26 09:36:37(172286 seconds left)
[SwitchB] display ipv6 interface vlanif 200
Vlanif200 current state : UP
IPv6 protocol current state : UP
IPv6 is enabled, link-local address is FE80::200:FF:FE00:212
Global unicast address(es):
FC00:2::1, subnet is FC00:2::/64
Joined group address(es):
FF02::1:FF00:1
FF02::1:FF00:212
FF02::2
FF02::1
MTU is 1500 bytes
ND DAD is enabled, number of DAD attempts: 1
ND reachable time is 30000 milliseconds
ND retransmit interval is 1000 milliseconds
ND stale time is 1200 seconds
ND advertised reachable time is 0 milliseconds
ND advertised retransmit interval is 0 milliseconds
ND router advertisement max interval 600 seconds, min interval 200 seconds
ND router advertisements live for 1800 seconds
ND router advertisements hop-limit 64
ND default router preference medium
Hosts use stateless autoconfig for addresses
# On SwitchB, run the display ipv6 interface command to check the IPv6 address information about the server-side interface 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-15 10:33:50 2592000S] Joined group address(es): FF02::1:FF36:595B FF02::2 FF02::1 MTU is 1500 bytes ND DAD is enabled, number of DAD attempts: 1 ND reachable time is 30000 milliseconds ND retransmit interval is 1000 milliseconds ND stale time is 1200 seconds
# On SwitchB, run the display ipv6 routing-table command to check IPv6 route information and verify that a direct route between the server network segment and the host network segment is available.
[SwitchB] display ipv6 routing-table Routing Table : Public Destinations : 6 Routes : 6 Destination : ::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : InLoopBack0 Flags : D Destination : FC00:2:: PrefixLength : 64 NextHop : FC00:2::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif200 Flags : D Destination : FC00:2::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : Vlanif200 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
# Check the IPv6 address configuration on PCs. In this example, the IPv6 address fc00:2::d5b2:274:370b:4c6e obtained by PC1 is displayed in the Network Connection Details window of PC1.
SwitchA configuration file
#
sysname SwitchA
#
ipv6
#
vlan batch 100
#
dhcp enable
#
dhcpv6 pool pool1
prefix-delegation FC00:2::/60 63
#
interface Vlanif100
ipv6 enable
ipv6 address FC00:3::1/64
undo ipv6 nd ra halt
dhcpv6 server pool1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 100
#
ipv6 route-static FC00:2:: 64 Vlanif100 FC00:3::865B:12FF:FE36:595B
#
return
SwitchB configuration file
# sysname SwitchB # ipv6 # vlan batch 100 200 # interface Vlanif100 ipv6 enable ipv6 address auto link-local ipv6 address auto global dhcpv6 client pd myprefix # interface Vlanif200 ipv6 enable ipv6 address myprefix ::1/64 ipv6 address auto link-local undo ipv6 nd ra halt # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 100 # interface GigabitEthernet0/0/2 port link-type access port default vlan 200 # return