How to Configure Stateful DHCPv6 Server
We can configure the stateful DHCPv6 server, similar to 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 enables IPv6 routing on the router. Unicast routing is also needed for ICMPv6 RA messages.
Configure a DHCPv6 Pool
First, we need the IPv6 addressing pool similar to a 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 the prefix, prefix length, and default gateway information. The client creates its global unicast address, including the default gateway, using the information in the RA message. However, with stateful DHCPv6, the DHCPv6 server must assign all addresses, including other configuration parameters.
We can configure the address prefix and lease time using address prefix <prefix/prefix-length> lifetime <valid-time-in-second | inifinte> command.
Other information is also included in stateful DHCPv6 configuration, usually the DNS server address and the domain name.
Interface Commands
After configuring the DHCPv6 pool, we must bind it to 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 to 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 are 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, the ipv6 enable interface configuration mode command is used. 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 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. Only 1 client is 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 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
To verify the DHCPv6 client configuration, we can use the show ipv6 interface command. We can also use the show running-config and show ipv6 interface brief commands.