Dynamic Host Configuration Protocol version 6

The Dynamic Host Configuration Protocol (DHCP) provides a method to maintain network configurations in a centralized location. This topic is DHCPv6-specific; all references to "IP address" refer to IPv6 addresses, and all references to "DHCP" refer to DHCPv6 (unless otherwise stated).

A DHCPv4 server can coexist on the same link with a DHCPv6 server. For an in-depth explanation of the protocol, see RFC 3315.

DHCP is an application-layer protocol that allows a client machine on the network to get IP addresses and other configuration parameters from the server. These parameters are defined in options. Options are obtained by exchanging packets between a daemon on the client and another on the server. These message exchanges are in the form of UDP packets. A client uses a link-local address, whether through the autoconf6 command or other methods, to identify its source address to the server. The server listens on a reserved link-scope multicast address. A relay agent will allow the client and server to communicate if they are not located on the same link.

This topic explains the four-message exchange handshake for a single interface with one IA_NA and one address for this IA_NA. To obtain an IP address, the DHCP client daemon (dhcpcd6) sends a SOLICIT message to the All_DHCP_Relay_Agents_and_Servers address, which is received by the server and processed. (Multiple servers can be configured on the network for redundancy.) If a free address is available for that client, an ADVERTISE message is created and sent back to the client. This message contains an IP address and other options that are appropriate for that client. The client receives the server DHCP ADVERTISE message and stores it while waiting for other advertisements. When the client has chosen the best advertisement, it sends a DHCP REQUEST to the All_DHCP_Relay_Agents_and_Servers address specifying which server advertisement it wants.

All configured DHCP servers receive the REQUEST message. Each checks to see if it is the requested server. The server does not process any packet with a server DUID that does not match its own. The requested server marks the address as assigned and returns a DHCP REPLY, at which time, the transaction is complete. The client has an address for the period of time (valid-lifetime) designated by the server.

When the preferred-lifetime expires for the address, the client sends the server a RENEW packet to extend the lease time. If the server is willing to renew the address, it sends a DHCP REPLY. If the client does not get a response from the server that owns its current address, it multicasts a DHCP REBIND packet if, for example, the server has been moved from one network to another. If the client has not renewed its address after the valid-lifetime, the address is removed from the interface and the process starts over. This cycle prevents multiple clients on a network from being assigned the same address.

A client can have multiple IA_NA options, and each IA_NA can have multiple addresses. A client can also have multiple IA_TA options and each can also have multiple addresses:
  • Identity association for non-temporary addresses (IA_NA): An IA that carries assigned addresses that are not temporary addresses
  • Identity association for temporary addresses (IA_TA): An IA that carries temporary addresses (see RFC 3041).
  • DUID: A DHCP-Unique identifier for a DHCP participant; each DHCP client and server has a unique DUID which remains the same across reboots.
The DHCP server assigns addresses based on keys. Four common keys are class, vendor, client ID, and inoption. The server uses these keys to allocate an address, and the set of configuration options to return to the client.
The class key is completely client-configurable. It can specify an address and options. This key can be used to denote machine function in the network or to describe how machines are grouped for administrative purposes. For example, the network administrator might want to create a NetBIOS class that contains options for NetBIOS clients or an accounting class that represents accounting department machines that need access to a specific printer.
The vendor key helps identify the client by its hardware and software platform.
client ID
The client ID keyidentifies the client through the DUID. The client ID is specified in the duid file of the dhcpcd daemon. Also, the client ID can be used by the server to pass options to a specific client or prohibit a particular client from receiving any parameters.
The inoption key identifies the client by the option requested by the client.

These keys can be used either singularly or in combinations. If multiple keys are provided by the client and multiple addresses can be assigned, only one is chosen, and the option set is derived from the chosen key first.

A relay agent is needed so initial multicast from the client can leave the local network. The relay agents act as forwarding agents for DHCP packets.