Stateless DHCPv6 configuration example

Network requirements

As shown in Figure 84, configure Switch A to use stateless DHCPv6 to obtain configuration parameters except IPv6 address and IPv6 prefix. Switch B acts as the gateway and advertises RA messages periodically.

Figure 84: Network diagram

Configuration procedure

You must configure the DHCPv6 server first before configuring the DHCPv6 client. For information about configuring DHCPv6 server, see "Configuring the DHCPv6 server."

  1. Configure the gateway Switch B.

    # Configure an IPv6 address for VLAN-interface 2.

    <SwitchB> system-view
    [SwitchB] interface vlan-interface 2
    [SwitchB-Vlan-interface2] ipv6 address 1::1 64
    

    # 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.

    [SwitchB-Vlan-interface2] ipv6 nd autoconfig other-flag
    

    # Disable RA message suppression on VLAN-interface 2.

    [SwitchB-Vlan-interface2] undo ipv6 nd ra halt
    
  2. Configure the DHCPv6 client Switch A.

    # Enable stateless IPv6 address autoconfiguration on VLAN-interface 2.

    <SwitchA> system-view
    [SwitchA] interface vlan-interface 2
    [SwitchA-Vlan-interface2] ipv6 address auto
    

    With stateless IPv6 address autoconfiguration enabled, but no IPv6 address configured for VLAN-interface 2, Switch A automatically generates a link local address. It sends an RS message to Switch B to request configuration information for IPv6 address generation. Upon receiving the RS message, Switch B sends back an RA message. After receiving an RA message with the M flag set to 0 and the O flag set to 1, Switch A performs stateless DHCPv6 to get other configuration parameters.

Verifying the configuration

# Display the DHCPv6 client information.

[SwitchA-Vlan-interface2] display ipv6 dhcp client interface vlan-interface 2
Vlan-interface2:
 Type: Stateless client
    State: OPEN
    Client DUID: 00030001000fe2ff0000
    Preferred server:
      Reachable via address: FE80::213:7FFF:FEF6:C818
      Server DUID: 0003000100137ff6c818
    DNS server addresses:
      1:2:4::5
      1:2:4::7
    Domain name:
      abc.com

# Display the DHCPv6 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
        Renew                 :  0
        Rebind                :  0
        Information-request   :  5
        Release               :  0
        Decline               :  0