Stateless DHCPv6 configuration example
Network requirements
As shown in Figure 60, through stateless DHCPv6, Switch A obtains the DNS server address, domain name, and other information from the server.
Switch B acts as the gateway to send RA messages periodically.
Figure 60: Stateless DHCPv6 configuration
Configuration procedure
Configure Switch B
# Enable the IPv6 packet forwarding function.
<SwitchB> system-view [SwitchB] ipv6
# Configure the IPv6 address of VLAN-interface 2.
[SwitchB] interface vlan-interface 2 [SwitchB-Vlan-interface2] ipv6 address 1::1 64
# Set the O flag in the RA messages to 1.
[SwitchB-Vlan-interface2] ipv6 nd autoconfig other-flag
# Enable Switch B to send RA messages.
[SwitchB-Vlan-interface2] undo ipv6 nd ra halt
Configure Switch A
# Enable the IPv6 packet forwarding function.
<SwitchA> system-view [SwitchA] ipv6
# Enable stateless IPv6 address autoconfiguration on VLAN-interface 2.
[SwitchA] interface vlan-interface 2 [SwitchA-Vlan-interface2] ipv6 address auto
With this command executed, if VLAN-interface 2 has no IPv6 address configured, Switch A will automatically generate a link-local address, and send an RS message, requesting the gateway (Switch B) to reply with an RA message immediately.
Verification
After receiving an RA message with the M flag set to 0 and the O flag set to 1, Switch A automatically enables the stateless DHCPv6 function.
# Use the display ipv6 dhcp client command to view the current client configuration information. If the client successfully obtains configuration information from the server, the following information will be displayed.
[SwitchA-Vlan-interface2] display ipv6 dhcp client interface vlan-interface 2 Vlan-interface2 is in stateless DHCPv6 client mode State is OPEN Preferred Server: Reachable via address : FE80::213:7FFF:FEF6:C818 DUID : 0003000100137ff6c818 DNS servers : 1:2:3::5 1:2:4::7 Domain names : abc.com Sysname.com
# Use the display ipv6 dhcp client statistics command to view the current client statistics.
[SwitchA-Vlan-interface2] display ipv6 dhcp client statistics Interface : Vlan-interface2 Packets Received : 1 Reply : 1 Advertise : 0 Reconfigure : 0 Invalid : 0 Packets Sent : 5 Solicit : 0 Request : 0 Confirm : 0 Renew : 0 Rebind : 0 Information-request : 5 Release : 0 Decline : 0