Example: Configuring dynamic IPv6 prefix assignment
Network configuration
As shown in Figure 78, the switch acts as a DHCPv6 server to assign an IPv6 prefix, a DNS server address, a domain name, a SIP server address, and a SIP server name to each DHCPv6 client.
The switch assigns prefix 2001:0410:0201::/48 to the client whose DUID is 00030001CA0006A40000, and assigns prefixes in the range of 2001:0410::/48 to 2001:0410:FFFF::/48 (excluding 2001:0410:0201::/48) to other clients. The DNS server address is 2::2:3. The DHCPv6 clients reside in the domain aaa.com. The SIP server address is 2:2::4, and the SIP server name is bbb.com.
Figure 78: Network diagram
Procedure
IMPORTANT: By default, interfaces on the device are disabled (in ADM or Administratively Down state). To have an interface operate, you must use the undo shutdown command to enable that interface. | ||
# Specify an IPv6 address for VLAN-interface 2.
<Switch> system-view [Switch] interface vlan-interface 2 [Switch-Vlan-interface2] ipv6 address 1::1/64
# Disable RA message suppression on VLAN-interface 2.
[Switch-Vlan-interface2] undo ipv6 nd ra halt
# Set the M flag to 1 in RA advertisements to be sent on VLAN-interface 2. Hosts that receive the RA advertisements will obtain IPv6 addresses through DHCPv6.
[Switch-Vlan-interface2] ipv6 nd autoconfig managed-address-flag
# Set the O flag to 1 in RA advertisements to be sent on VLAN-interface 2. Hosts that receive the RA advertisements will obtain information other than IPv6 address through DHCPv6.
[Switch-Vlan-interface2] ipv6 nd autoconfig other-flag [Switch-Vlan-interface2] quit
# Create prefix pool 1, and specify the prefix 2001:0410::/32 with the assigned prefix length 48.
[Switch] ipv6 dhcp prefix-pool 1 prefix 2001:0410::/32 assign-len 48
# Create address pool 1.
[Switch] ipv6 dhcp pool 1
# In address pool 1, configure subnet 1::/64 where VLAN interface-2 resides.
[Switch-dhcp6-pool-1] network 1::/64
# Apply prefix pool 1 to address pool 1, and set the preferred lifetime to one day, and the valid lifetime to three days.
[Switch-dhcp6-pool-1] prefix-pool 1 preferred-lifetime 86400 valid-lifetime 259200
# In address pool 1, bind prefix 2001:0410:0201::/48 to the client DUID 00030001CA0006A40000, and set the preferred lifetime to one day, and the valid lifetime to three days.
[Switch-dhcp6-pool-1] static-bind prefix 2001:0410:0201::/48 duid 00030001CA0006A40000 preferred-lifetime 86400 valid-lifetime 259200
# Configure the DNS server address 2:2::3.
[Switch-dhcp6-pool-1] dns-server 2:2::3
# Configure the domain name as aaa.com.
[Switch-dhcp6-pool-1] domain-name aaa.com
# Configure the SIP server address as 2:2::4, and the SIP server name as bbb.com.
[Switch-dhcp6-pool-1] sip-server address 2:2::4 [Switch-dhcp6-pool-1] sip-server domain-name bbb.com [Switch-dhcp6-pool-1] quit
# Enable the DHCPv6 server on VLAN-interface 2, enable desired prefix assignment and rapid prefix assignment, and set the preference to the highest.
[Switch] interface vlan-interface 2 [Switch-Vlan-interface2] ipv6 dhcp select server [Switch-Vlan-interface2] ipv6 dhcp server allow-hint preference 255 rapid-commit
Verifying the configuration
# Display DHCPv6 server configuration on VLAN-interface 2.
[Switch-Vlan-interface2] display ipv6 dhcp server interface vlan-interface 2 Using pool: global Preference value: 255 Allow-hint: Enabled Rapid-commit: Enabled
# Display information about address pool 1.
[Switch-Vlan-interface2] display ipv6 dhcp pool 1 DHCPv6 pool: 1 Network: 1::/64 Preferred lifetime 604800, valid lifetime 2592000 Prefix pool: 1 Preferred lifetime 86400, valid lifetime 259200 Static bindings: DUID: 00030001ca0006a40000 IAID: Not configured Prefix: 2001:410:201::/48 Preferred lifetime 86400, valid lifetime 259200 DNS server addresses: 2:2::3 Domain name: aaa.com SIP server addresses: 2:2::4 SIP server domain names: bbb.com
# Display information about prefix pool 1.
[Switch-Vlan-interface2] display ipv6 dhcp prefix-pool 1 Prefix: 2001:410::/32 Assigned length: 48 Total prefix number: 65536 Available: 65535 In-use: 0 Static: 1
# After the client with the DUID 00030001CA0006A40000 obtains an IPv6 prefix, display the binding information on the DHCPv6 server.
[Switch-Vlan-interface2] display ipv6 dhcp server pd-in-use Pool: 1 IPv6 prefix Type Lease expiration 2001:410:201::/48 Static(C) Jul 10 19:45:01 2009
# After the other client obtains an IPv6 prefix, display binding information on the DHCPv6 server.
[Switch-Vlan-interface2] display ipv6 dhcp server pd-in-use Pool: 1 IPv6 prefix Type Lease expiration 2001:410:201::/48 Static(C) Jul 10 19:45:01 2009 2001:410::/48 Auto(C) Jul 10 20:44:05 2009