We can configure the stateful DHCPv6 server is similar to configuring a stateless server. The difference between stateless and stateful is that a stateful server also includes IPv6 addressing information similar to a DHCPv4 server and obtains the state of the DHCP.
Similar to stateless DHCPv6 we need to enable unicast routing. The command ipv6 unicast-routing enable IPv6 routing on the router. Similar to stateless DHCPv6 unicast-routing is needed for ICMPv6 RA messages.
Configure a DHCPv6 Pool
First of all, we need the IPv6 addressing pool similar to stateless DHCPv6 server. To configure the IPv6 DHCP pool we used ipv6 dhcp pool <pool-name> command in global configuration mode. Executing this command we also enter into the DHCPv6 configuration mode, which is identified by the Router(config-dhcpv6)#
Configure Pool Parameters
The RA message contains necessary information regarding the prefix, prefix length and default gateway and the client creates its global unicast address including default gateway from the information in RA message. But with stateful DHCPv6 all addresses including other configuration parameters must be assigned by the DHCPv6 server.
We can configure the address prefix and lease time using address prefix <prefix/prefix-length> lifetime <valid-time-in-second | inifinte> command.
Other information also included in stateful DHCPv6 configuration usually, the DNS server address and the domain name.
After configuring the DHCPv6 pool we need to bind the pool with the corresponding interface. The ipv6 dhcp server <pool-name> interface command binds the pool to the interface. The M flag needs and O flag must be 1. This informs the client not to use SLAAC and obtain all IPv6 addressing including all configuration parameters from a stateful DHCPv6 server.
DHCPv6 Stateful Server Example configuration
The figure below illustrates an example of a stateful DHCPv6 server configuration. We have using the same topology used in stateless DHCPv6 configuration. Now I am going to configure the same topology for stateful DHCPv6. The default gateway is not specified as the router will automatically send its link-local address as the default gateway.
Configuring a Router as a Stateful DHCPv6 Client
Similar to stateless DHCPv6 client configuration used the ipv6 enable interface configuration mode command. This command allows the router to receive a link-local address to send RS messages and participate in the DHCPv6 process.
Next use the interface mode command ipv6 address dhcp. This command enables the router to behave as a DHCPv6 client on this particular interface. The figure below illustrates the stateful DHCPv6 client configuration.
Verifying Stateful DHCPv6 Server
We can verify the stateful DHCPv6 server using different commands. The first command we can use for DHCPv6 server verification is the show ipv6 dhcp pool. The figure below illustrates the output of this command.
The command verifies the name of the DHCPv6 pool including its parameters. You can see that there is only 1 client active, which reflects the client DHCP Client receiving its IPv6 global unicast address from this server.
Another command is show ipv6 dhcp binding. The figure below illustrates the output of this command, showing the automatic binding between the interface of the router and the address assigned by the server.
The output illustrates that the DHCPv6 pool name is my pool and the prefix length is 64. You can also see the DNS server address and the domain name “networkustad.com. You can see that there is an active 1 active client. It is a stateful protocol, therefore, it has a record of the active client.
We can also use the “show running-config” command to verify the stateful DHCPv6 configuration.
Verifying the Stateful DHCPv6 Client
We can use the show ipv6 interface command to verify the DHCPv6 client configuration. We can also use show running-config and show ipv6 interface brief command.