Stateless DHCPv6 configuration example

Network requirements

As shown in Figure 104, configure GigabitEthernet 1/0/1 on Router A to use stateless DHCPv6 to obtain configuration parameters except IPv6 address and IPv6 prefix. Router B acts as the gateway and advertises RA messages periodically.

Figure 104: Network diagram

Configuration procedure

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

  1. Configure the gateway Router B:

    # Configure an IPv6 address for GigabitEthernet 1/0/1.

    <RouterB> system-view
    [RouterB] interface gigabitethernet 1/0/1
    [RouterB-GigabitEthernet1/0/1] ipv6 address 1::1 64
    

    # Set the O flag to 1 in RA advertisements to be sent on GigabitEthernet 1/0/1. Hosts that receive the RA advertisements will obtain information other than IPv6 address through DHCPv6.

    [RouterB-GigabitEthernet1/0/1] ipv6 nd autoconfig other-flag
    

    # Disable RA message suppression on GigabitEthernet 1/0/1.

    [RouterB-GigabitEthernet1/0/1] undo ipv6 nd ra halt
    
  2. Configure the DHCPv6 client on Router A:

    # Enable stateless IPv6 address autoconfiguration on GigabitEthernet 1/0/1.

    <RouterA> system-view
    [RouterA] interface gigabitethernet 1/0/1
    [RouterA-GigabitEthernet1/0/1] ipv6 address auto
    

    With stateless IPv6 address autoconfiguration enabled, but no IPv6 address configured for GigabitEthernet 1/0/1, Router A generates a link local address. It sends an RS message to Router B to request configuration information for IPv6 address generation. Upon receiving the RS message, Router 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, Router A performs stateless DHCPv6 to get other configuration parameters.

Verifying the configuration

# Display DHCPv6 client information for GigabitEthernet 1/0/1.

[RouterA-GigabitEthernet1/0/1] display ipv6 dhcp client interface gigabitethernet 1/0/1
GigabitEthernet1/0/1:
  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 DHCPv6 client statistics.

[RouterA-GigabitEthernet1/0/1] display ipv6 dhcp client statistics
Interface                     :  GigabitEthernet1/0/1
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