Dynamic Host Configuration Protocol (DHCP) was designed to handle the assignment of IP addresses and other network information to computers so that computers can communicate automatically over the network. DHCPv6 (Dynamic Host Configuration Protocol for IPv6) is a protocol designed for IPv6 addressing schemes that assigns IPv6 prefixes, IPv6 addresses, and other network configuration parameters to hosts.
Compared with other IPv6 address allocation methods (manual configuration, stateless autoconfiguration through network prefix in router advertisement messages, etc.), DHCPv6 has the following advantages:
- Not only can IPv6 addresses be assigned, but also IPv6 prefixes can be assigned to facilitate automatic configuration and management of the entire network.
- Better control over the allocation of addresses. Through DHCPv6, not only can the address/prefix assigned to the host be recorded, but also a specific address/prefix can be assigned to a specific host for network management.
- In addition to the IPv6 prefix and IPv6 address, you can also assign network configuration parameters such as DNS server and domain name to the host.
The DHCPv6 basic protocol architecture mainly includes the following three roles:
- DHCPv6 Client：
The DHCPv6 client interacts with the DHCPv6 server to obtain the IPv6 address/prefix and network configuration information and complete its own address configuration.
- DHCPv6 Relay：
The DHCPv6 relay agent is responsible for forwarding DHCPv6 messages from the client or the server to assist the DHCPv6 client and DHCPv6 server in completing address configuration. In general, a DHCPv6 client communicates with a DHCPv6 server through a link-local multicast address to obtain an IPv6 address/prefix and other network configuration parameters. If the server and the client are not in the same link range, the DHCPv6 relay agent needs to forward packets. This prevents the DHCPv6 server from being deployed on each link. This saves costs and facilitates centralized management.
In the DHCPv6 basic protocol architecture, the DHCPv6 relay agent is not a required role. If the DHCPv6 client and the DHCPv6 server are in the same link range, or the DHCPv6 client and the DHCPv6 server directly perform address allocation or information configuration through unicast interaction, the DHCPv6 relay agent is not required to participate. The DHCPv6 relay agent is required to participate only when the DHCPv6 client and the DHCPv6 server are not in the same link range, or the DHCPv6 client and the DHCPv6 server cannot communicate unicast.
- DHCPv6 Server：
The DHCPv6 server is responsible for processing address allocation, address renewal, and address release requests from clients or relay agents, and assigns IPv6 addresses/prefixes and other network configuration information to clients.
DHCPv6 address/prefix allocation process
The process of assigning addresses/prefixes to clients by the DHCPv6 server is divided into two categories:
- The process of quickly assigning two messages to each other
- The process of assigning four messages to each other
The process of quickly assigning two messages:
(1) The DHCPv6 client carries the Rapid Commit option in the sent Solicit message, and identifies that the client wants the server to quickly assign an address/prefix and network configuration parameters to it;
(2) If the DHCPv6 server supports the fast allocation process, it directly returns a Reply message to assign the IPv6 address/prefix and other network configuration parameters to the client. If the DHCPv6 server does not support the fast allocation process, the IPv4 address/prefix and other network configuration parameters are assigned to the client by the process of assigning four messages.
The process of assigning four messages to each other:
- Solicit: The DHCPv6 client sends the message and requests the DHCPv6 server to assign an IPv6 address/prefix and network configuration parameters to it.
- Advertis: If the Solicit message does not carry the Rapid Commit option, or the Solicit message carries the Rapid Commit option, but the server does not support the fast allocation process, the DHCPv6 server replies to the message,notifies the client of the address/prefix and network configuration parameters that can be assigned to it.
- Request: If the DHCPv6 client receives the Advertise message replied by multiple servers, select one of the servers according to the order of receiving the message, the server priority, etc., and send a Request message to the server, requesting the server to confirm It assigns an address/prefix and network configuration parameters.
- Reply: The DHCPv6 server replies to the message and confirms that the address/prefix and network configuration parameters are assigned to the client for use.
Prioritization of IPv6 address assignments:
The DHCPv6 server selects an IPv6 address/prefix for the DHCPv6 client in the following order.
- Select an IPv6 address pool.
The interface of the DHCPv6 server can be bound to an IPv6 address pool. The DHCPv6 server selects the IPv6 address pool to assign an address/prefix to the DHCPv6 client on the interface. For a scenario where a relay is available, the interface of the DHCPv6 server can be bound to the IPv6 address pool. Instead, the first link in the packet is the link-address field that is not 0 (identifying the link range of the DHCPv6 client). An address pool that belongs to the same link range as the configured network prefix or IPv6 address prefix in the address pool.
- Select an IPv6 address/prefix
After determining the address pool, the DHCPv6 server will assign the IPV6 address/prefix to the DHCPv6 client as follows:
If an address/prefix is specified for the client in the address pool, the address/prefix matching the client DUID is preferentially assigned from the address pool to the client.
If the IA option in the client packet carries a valid address/prefix, the address/prefix is preferentially assigned to the client from the address pool. If the address/prefix is not available in the address pool, an additional free address/prefix is assigned to the client. If the IPV6 prefix length is greater than the specified allocation length, it is allocated according to the specified allocation length.
The free address/prefix is selected from the address pool and assigned to the client. The reserved address (such as the anycast address defined in RFC 2526), the conflicting address, and the assigned address can no longer be allocated to the client.
Assignment fails if no suitable IPv6 address/prefix can be assigned
Address/prefix lease renewal process:
The IPv6 address/prefix assigned to the client by the DHCPv6 server has a certain lease term. The lease is made up of a lifetime (including the preferred lifetime and effective lifetime of the address) and the renewal time point (T1, T2 of IA). After the lease time of the address/prefix reaches the valid lifetime, the DHCPv6 client can no longer use the address/prefix. If the DHCPv6 client wishes to continue using the address/prefix before the valid lifetime expires, the address/prefix lease needs to be updated.
In order to extend the effective lifetime and preferred lifetime of the address associated with the IA, the DHCPv6 client sends a Renew packet containing the IA option to the server at time T1, where the IA option carries the IA address option that needs to be renewed.The DHCPv6 client has not received a response packet for the T1 time renewal message. Then, at time T2, the DHCPv6 client continues to renew the address to the DHCPv6 server through the Rebind message.
When the address/prefix lease time arrival time T1 (recommended value is half of the preferred lifetime Preferred Lifetime), the DHCPv6 client unicasts the Renew message to the DHCPv6 server to which it is assigned the address/prefix to update the address/prefix lease.If the client can continue to use the address/prefix, the DHCPv6 server responds with a successful Reply packet, notifying the DHCPv6 client that the address/prefix lease has been successfully updated; if the address/prefix cannot be reassigned to the client, The DHCPv6 server responds to the Reply packet that failed to renew the notification, notifying the client that it cannot obtain a new lease.
If the Renew is sent at T1, the lease is updated, but the response packet of the DHCPv6 server is not received. Then, when the DHCPv6 client will be in T2 (recommended value is 0.8 times of the preferred lifetime), it will send a Rebind message to all DHCPv6 servers to request to update the lease. If the client can continue to use the address/prefix, the DHCPv6 server responds with a successful Reply packet to notify the DHCPv6 client that the address/prefix lease has been successfully updated.;If the address/prefix cannot be reassigned to the client, the DHCPv6 server responds to the Reply packet with the renewal failure, notifying the client that the new lease cannot be obtained; If the DHCPv6 client does not receive the response packet from the server, the client stops using the address/prefix after the valid lifetime is reached.
For more articles you can follow us on: