Dynamic IPv6 address assignment configuration example
Network requirements
As shown in Figure 97, Router A acts as a DHCPv6 server to assign IPv6 addresses to the clients on subnets 1::1:0:0:0/96 and 1::2:0:0:0/96.
On Router A, configure the IPv6 address 1::1:0:0:1/96 for GigabitEthernet 1/0/1 and 1::2:0:0:1/96 for GigabitEthernet 1/0/2. The lease duration of the addresses on subnet 1::1:0:0:0/96 is 172800 seconds (two days), the valid time is 345600 seconds (four days), the domain name is aabbcc.com, and the DNS server address is 1::1:0:0:2/96. The lease duration of the addresses on subnet 1::2:0:0:0/96 is 432000 seconds (five days), the valid time is 864000 seconds (ten days), the domain name is aabbcc.com, and the DNS server address is 1::2:0:0:2/96.
Figure 97: Network diagram
Configuration procedure
Configure the interfaces on the DHCPv6 server:
# Specify an IPv6 address for GigabitEthernet 1/0/1.
<RouterA> system-view [RouterA] interface gigabitethernet 1/0/1 [RouterA-GigabitEthernet1/0/1] ipv6 address 1::1:0:0:1/96
# Disable RA message suppression on GigabitEthernet 1/0/1.
[RouterA-GigabitEthernet1/0/1] undo ipv6 nd ra halt
# Set the M flag to 1 in RA advertisements to be sent on GigabitEthernet 1/0/1. Hosts that receive the advertisements will obtain IPv6 addresses through DHCPv6.
[RouterA-GigabitEthernet1/0/1] ipv6 nd autoconfig managed-address-flag
# Set the O flag to 1 in RA advertisements to be sent on GigabitEthernet 1/0/1. Hosts that receive the advertisements will obtain information other than IPv6 address through DHCPv6.
[RouterA-GigabitEthernet1/0/1] ipv6 nd autoconfig other-flag [RouterA-GigabitEthernet1/0/1] quit
# Specify an IPv6 address for GigabitEthernet 1/0/2.
[RouterA] interface gigabitethernet 1/0/2 [RouterA-GigabitEthernet1/0/2] ipv6 address 1::2:0:0:1/96
# Disable RA message suppression on GigabitEthernet 1/0/2.
[RouterA-GigabitEthernet1/0/2] undo ipv6 nd ra halt
# Set the M flag to 1 in RA advertisements to be sent on GigabitEthernet 1/0/2. Hosts that receive the advertisements will obtain IPv6 addresses through DHCPv6.
[RouterA-GigabitEthernet1/0/2] ipv6 nd autoconfig managed-address-flag
# Set the O flag to 1 in RA advertisements to be sent on GigabitEthernet 1/0/2. Hosts that receive the advertisements will obtain information other than IPv6 address through DHCPv6.
[RouterA-GigabitEthernet1/0/2] ipv6 nd autoconfig other-flag [RouterA-GigabitEthernet1/0/2] quit
Enable DHCPv6:
# Enable the DHCPv6 server on the interfaces GigabitEthernet 1/0/1 and GigabitEthernet 1/0/2.
[RouterA] interface gigabitethernet 1/0/1 [RouterA-GigabitEthernet1/0/1] ipv6 dhcp select server [RouterA-GigabitEthernet1/0/1] quit [RouterA] interface gigabitethernet 1/0/2 [RouterA-GigabitEthernet1/0/2] ipv6 dhcp select server [RouterA-GigabitEthernet1/0/2] quit
# Exclude the DNS server address from dynamic assignment.
[RouterA] ipv6 dhcp server forbidden-address 1::1:0:0:2 [RouterA] ipv6 dhcp server forbidden-address 1::2:0:0:2
# Create DHCPv6 address pool 1 to assign IPv6 addresses and other configuration parameters to clients on subnet 1::1:0:0:0/96.
[RouterA] ipv6 dhcp pool 1 [RouterA-dhcp6-pool-1] network 1::1:0:0:0/96 preferred-lifetime 172800 valid-lifetime 345600 [RouterA-dhcp6-pool-1] domain-name aabbcc.com [RouterA-dhcp6-pool-1] dns-server 1::1:0:0:2 [RouterA-dhcp6-pool-1] quit
# Create DHCPv6 address pool 2 to assign IPv6 addresses and other configuration parameters to clients on subnet 1::2:0:0:0/96.
[RouterA] ipv6 dhcp pool 2 [RouterA-dhcp6-pool-2] network 1::2:0:0:0/96 preferred-lifetime 432000 valid-lifetime 864000 [RouterA-dhcp6-pool-2] domain-name aabbcc.com [RouterA-dhcp6-pool-2] dns-server 1::2:0:0:2 [RouterA-dhcp6-pool-2] quit
Verifying the configuration
# Verify that clients on subnets 1::1:0:0:0/96 and 1::2:0:0:0/96 can obtain IPv6 addresses and all other configuration parameters from the DHCPv6 server (Router A). (Details not shown.)
# On the DHCPv6 server, display IPv6 addresses assigned to the clients.
[RouterA] display ipv6 dhcp server ip-in-use