DHCPv6 server configuration example
Network requirements
As shown in Figure 56, the switch serves as a DHCPv6 server, and assigns the IPv6 prefix, DNS server address, domain name, SIP server address, and the domain name of the SIP server to the DHCPv6 clients. The IPv6 address of the switch is 1::1/64.
The switch assigns prefix 2001:0410:0201::/48 to the clients whose DUID is 00030001CA0006A40000, and assigns prefixes ranging from 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 domain aaa.com. The SIP server address is 2:2::4, and the domain name of the SIP server is bbb.com.
Configuration considerations
Follow these steps to configure the DHCPv6 server.
Enable IPv6 and DHCPv6 server.
Create a prefix pool containing prefix 2001:0410::/32 with the length of the assigned prefix being 48, so that the server assigns clients the prefixes ranging 2001:0410::/48 to 2001:0410:FFFF::/48.
Create an address pool. Configure a static prefix in the address pool and have the prefix pool referenced by the address pool. Configure other configuration parameters.
Apply the address pool to the interface through which the server is connected to the clients.
Figure 56: DHCPv6 server configuration
Configuration procedure
# Enable IPv6 and DHCPv6 server.
<Switch> system-view [Switch] ipv6 [Switch] ipv6 dhcp server enable
# Configure the IPv6 address of VLAN-interface 2.
[Switch] interface vlan-interface 2 [Switch-Vlan-interface2] ipv6 address 1::1/64 [Switch-Vlan-interface2] quit
# Create and configure prefix pool 1.
[Switch] ipv6 dhcp prefix-pool 1 prefix 2001:0410::/32 assign-len 48
# Create address pool 1.
[Switch] ipv6 dhcp pool 1
# Apply prefix pool 1 to address pool 1, and set the preferred lifetime to one day, the valid lifetime to three days.
[Switch-ipv6-dhcp-pool-1] prefix-pool 1 preferred-lifetime 86400 valid-lifetime 259200
# Configure static prefix 2001:0410:0201::/48 in address pool 1, and set the client DUID as 00030001CA0006A40000, the preferred lifetime to one day, and the valid lifetime to three days.
[Switch-ipv6-dhcp-pool-1] static-bind prefix 2001:0410:0201::/48 duid 00030001CA0006A40000 preferred-lifetime 86400 valid-lifetime 259200
# Configure the DNS server address as 2:2::3.
[Switch-ipv6-dhcp-pool-1] dns-server 2:2::3
# Configure the domain name as aaa.com.
[Switch-ipv6-dhcp-pool-1] domain-name aaa.com
# Configure the SIP server address as 2:2::4, and the domain name of the SIP server as bbb.com.
[Switch-ipv6-dhcp-pool-1] sip-server address 2:2::4 [Switch-ipv6-dhcp-pool-1] sip-server domain-name bbb.com [Switch-ipv6-dhcp-pool-1] quit
# Apply address pool 1 to VLAN-interface 2, configure the address pool to support the desired prefix assignment and rapid prefix assignment, and set the precedence to the highest.
[Switch] interface vlan-interface 2 [Switch-Vlan-interface2] ipv6 dhcp server apply pool 1 allow-hint preference 255 rapid-commit
Verification
# After the preceding configuration is complete, display the DHCPv6 server configuration information on VLAN-interface 2.
[Switch-Vlan-interface2] display ipv6 dhcp server interface vlan-interface 2 Using pool: 1 Preference value: 255 Allow-hint: Enabled Rapid-commit: Enabled
# Display the information of address pool 1.
[Switch-Vlan-interface2] display ipv6 dhcp pool 1 DHCPv6 pool: 1 Static bindings: DUID: 00030001CA0006A40000 IAID: A1A1A1A1 Prefix: 2001:410:201::/48 preferred lifetime 86400, valid lifetime 2592000 Prefix pool: 1 preferred lifetime 86400, valid lifetime 2592000 DNS server address: 2:2::3 Domain name: aaa.com SIP server address: 2:2::4 SIP server domain name: bbb.com
# Display the information of 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 whose DUID is 00030001CA0006A40000 obtains an IPv6 prefix, display the PD information on the DHCPv6 server.
[Switch-Vlan-interface2] display ipv6 dhcp server pd-in-use all Total number = 1 Prefix Type Pool Lease-expiration 2001:410:201::/48 Static(C) 1 Jul 10 2009 19:45:01
# After the other client obtains an IPv6 prefix, display the PD information on the DHCPv6 server.
[Switch-Vlan-interface2] display ipv6 dhcp server pd-in-use all Total number = 2 Prefix Type Pool Lease-expiration 2001:410:201::/48 Static(C) 1 Jul 10 2009 19:45:01 2001:410::/48 Auto(C) 1 Jul 10 2009 20:44:05