There are three methods to configure a host with a global unicast address, default gateway, DNS server, and a domain name:
Stateful DHCPv6 is similar in functionalities to DHCP protocol in IPv4, but there are some major differences in the way the whole process works. In this lesson, we are going to examine it step by step.
A stateless DHCPv6 server does not provide IPv6 addresses at all. It only provides "other information" such as a DNS server list and a domain name. It works in conjunction with another feature called SLAAC that tells hosts how to generate global unicast addresses. In this context stateless means that no server keeps track of what addresses have been assigned by which hosts and what addresses are still available for an assignment.
A stateful DHCPv6 server provides IPv6 addresses and "other information" to hosts. It also keeps track of the state of each assignment. It tracks the address pool availability and resolves duplicated address conflicts. It also logs every assignment and keeps track of the expiration times. However, there is a big difference between DHCPv6 and DHCPv4. In IPv4 DHCP server typically provides default gateway addresses to hosts. In IPv6, only routers sending Router Advertisement messages can provide a default gateway address dynamically.
Unlike IPv4, in IPv6 routers actively participate in the process of dynamic hosts addressing. In both Stateless and Stateful implementations, a router on the link advertises its presence with Router Advertisements messages. These RA messages play a very important role for a few reasons:
Figure 1. Stateful DHCPv6 Messages
Figure 1 illustrates the steps PC1 takes to configure a global unicast address, a default gateway, and a DNS using a Stateful DHCPv6:
Note that the DHCPv6 service works in conjunction with the Neighbor Discovery protocol. Although the global address including all other information is provided by the server, the default gateway is provided by Router 1.
For this example, we are going to use a basic topology shown in figure 2. As a Stateful DHCPv6 server, we will use a regular Cisco router named Router2.
Figure 2. Stateless DCHPv6 configuration topology
There are three mains configuration steps to enable Stateful DHCPv6 service:
Let's configure Router 1 from scratch. Note that IPv6 unicast routing must be enabled otherwise the router won't begin sending RA messages.
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#ipv6 unicast-routing
Router1(config)#interface GigabitEthernet 0/0
Router1(config-if)#ipv6 enable
Router1(config-if)#ipv6 address FE80::1 link-local
Router1(config-if)#ipv6 address 2001:1234:A:B::1/64
At this point, all flags in the Router Advertisement messages are set to their default values. By default on Cisco routers, the M-flag is set to 0, the O-flag is set to 0 and the A-flag is set to 1. To enable Stateful DHCPv6, we must set the M-flag to 1 using the following command under the interface configuration mode.
Router(config-if)# ipv6 nd managed-config-flag
And disable SLAAC by setting the A-flag to 0 using the following command:
Router(config-if)# ipv6 nd prefix 2001:1234:A:B::/64 no-autoconfig
If we now look at a Wireshark capture of the RA messages being sent by Router1, we can verify that the M-flag is set to 1 and the A-flag is set to 0.
Ethernet II, Src: 50:00:00:01:00:00, Dst: 33:33:00:00:00:01
Internet Protocol Version 6, Src: fe80::1, Dst: ff02::1
Internet Control Message Protocol v6
Type: Router Advertisement (134)
Code: 0
Checksum: 0x9b10 (correct)
(Checksum Status: Good)
Cur hop limit: 64
Flags: 0x88, Managed address configuration, Prf (Default Router Preference): High
1... .... = Managed address configuration: Set
.0.. .... = Other configuration: Not set
..0. .... = Home Agent: Not set
...0 1... = Prf (Default Router Preference): High (1)
.... .0.. = Proxy: Not set
.... ..0. = Reserved: 0
Router lifetime (s): 1800
Reachable time (ms): 0
Retrans timer (ms): 0
ICMPv6 Option (Source link-layer address : 50:00:00:01:00:00)
ICMPv6 Option (MTU : 1500)
ICMPv6 Option (Prefix information : 2001:1234:a:b::/64)
Type: Prefix information (3)
Length: 4 (32 bytes)
Prefix Length: 64
Flag: 0x80, On-link flag(L)
1... .... = On-link flag(L): Set
.0.. .... = Autonomous address-configuration flag(A): Not set
..0. .... = Router address flag(R): Not set
...0 0000 = Reserved: 0
Valid Lifetime: 2592000
Preferred Lifetime: 604800
Reserved
Prefix: 2001:1234:a:b::
Now it is time to configure Router2 as a DHCPv6 server. The configuration is pretty basic and straightforward. We must create a new DHCP pool using the command ipv6 dhcp pool [pool-name]. This will lead us into the pool configuration mode, where we specify all parameters such as prefix, DNS servers, and a domain name.
Router2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#ipv6 dhcp pool STATEFUL-DHCPV6
Router2(config-dhcpv6)#address prefix 2001:1234:A:B::/64
Router2(config-dhcpv6)#dns-server 2001:CAFE::1
Router2(config-dhcpv6)#domain-name example.com
Router2(config-dhcpv6)#exit
Router2(config)#
After the pool has been created, we must enable it on the interface attached to the link.
Router2(config)#interface gigabitEthernet 0/0
Router2(config-if)#ipv6 dhcp server STATEFUL-DHCPV6
Router2(config-if)#ipv6 nd ra suppress all
Router2(config-if)#end
Router2#
Note that we stop Router2 from sending out any Route Advertisement messages with the command ipv6 nd ra suppress all because it just plays the role of a server and should not be acting as a router in our example.
Let's look at some verification steps that we can take to make sure everything worked as expected.
As you have seen in the Step-by-step explanation, the process starts with the Router Solicitation and Router Advertisement messages exchanged by Router1 and PC1. The most useful command we can use is the show ipv6 interface that displays all IPv6 and ICMPv6 settings of a particular interface.
Router1#show ipv6 interface gigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up
IPv6 is enabled, link-local address is FE80::1
No Virtual link-local address(es):
Global unicast address(es):
2001:1234:A:B::1, subnet is 2001:1234:A:B::/64
Joined group address(es):
FF02::1
FF02::2
FF02::1:FF00:1
MTU is 1500 bytes
ICMP error messages limited to one every 100 milliseconds
ICMP redirects are enabled
ICMP unreachables are sent
ND DAD is enabled, number of DAD attempts: 1
ND reachable time is 30000 milliseconds (using 30000)
ND advertised reachable time is 0 (unspecified)
ND advertised retransmit interval is 0 (unspecified)
ND router advertisements are sent every 200 seconds
ND router advertisements live for 1800 seconds
ND advertised default router preference is High
Hosts use DHCP to obtain routable addresses.
Note that the last line says "Hosts use DHCP to obtain addresses". This means that the M-flag is set to 1 and Router1 informs hosts on the segment to use Stateful DHCPv6. You should not see a line that says "Hosts use stateless autoconfig for addresses" meaning that SLAAC is disabled (A-flag is set to 0)
There are several commands that display information about the status of the DHCPv6 service provided by the router. The show ipv6 dhcp pool command outputs the allocation prefix, along with the other information and the number of active clients. In our example, there is only one active client as expected.
Router2# show ipv6 dhcp pool
DHCPv6 pool: STATEFUL-DHCPV6
Address allocation prefix: 2001:1234:A:B::/64 valid 172800 preferred 86400 (1 in use, 0 conflicts)
DNS server: 2001:CAFE::1
DNS server: 2001:CAFE::2
Domain name: example.com
Active clients: 1
Another useful one is the show ipv6 dhcp bindings command that displays the following important values:
Router2# show ipv6 dhcp binding
Client: FE80::7207:12FF:FE34:5678
DUID: 00010001268AB471000C2926497B
Username : unassigned
VRF : default
IA NA: IA ID 0x08500000, T1 43200, T2 69120
Address: 2001:1234:A:B:59A9:3004:A0EE:2CF8
preferred lifetime 86400, valid lifetime 172800
expires at Nov 02 2020 02:52 PM (171838 seconds)
Using the ipconfig /all command on PC1, we can verify that PC1 successfully obtained a global IPv6 address and other information from the DHCP server. You can check based on the DHCP Unique Identifier (DUID) that this is the exact address Router 2 has provided.
C:\Users\Administrator>ipconfig /all
Ethernet adapter Eth0:
Connection-specific DNS Suffix . : example.com
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
Physical Address. . . . . . . . . : 70-07-12-34-56-78
Autoconfiguration Enabled . . . . : Yes
IPv6 Address. . . . . . . . . . . : 2001:1234:a:b:59a9:3004:a0ee:2cf8(Preferred)
Lease Obtained. . . . . . . . . . : Saturday, October 31, 2020 2:52:57 PM
Lease Expires . . . . . . . . . . : Monday, November 2, 2020 2:52:57 PM
Link-local IPv6 Address . . . . . : fe80::7207:12ff:fe34:5678%8(Preferred)
Default Gateway . . . . . . . . . : fe80::1%8
DHCPv6 IAID . . . . . . . . . . . : 139460608
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-26-8A-B4-71-00-0C-29-26-49-7B.
DNS Servers . . . . . . . . . . . : 2001:cafe::1
2001:cafe::2
As the last verification step, we can look at the messages PC1 and Router2 exchanged.
Figure 3. Stateful DHCPv6 Wireshark Capture