This documentation is archived and is not being maintained.
The Cable Guy The DHCPv6 Protocol
Joseph Davies is a technical writer with Microsoft and has been teaching and writing about Windows networking topics since 1992. He has written eight books for Microsoft Press and is the author of the monthly online TechNet Cable Guy column.
© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited.
The Dynamic Host Configuration Protocol (DHCP) was designed to take care of assigning IP addresses and other networking information to computers so they can communicate on the network automatically. With an IPv6 network, you don't actually need DHCP to configure addresses, but there can be good reasons to use it. DHCP for IPv6 (DHCPv6) can
provide stateful address configuration or stateless configuration settings to IPv6 hosts. IPv6 hosts can use several methods to configure addresses:
Stateless Address Autoconfiguration is used to configure both link-local addresses and additional non-link-local addresses by exchanging Router Solicitation and Router Advertisement messages with neighboring routers.
Stateful Address Autoconfiguration is used to configure non-link-local addresses through the use of a configuration protocol such as DHCP.
An IPv6 host performs stateless address autoconfiguration automatically and uses a configuration protocol such as DHCPv6 based on the following flags in the Router Advertisement message sent by a neighboring router:
Managed Address Configuration Flag, which is also known as the M flag. When set to 1, this flag instructs the host to use a configuration protocol to obtain stateful addresses.
Other Stateful Configuration Flag , which is also known as the O flag. When set to 1, this flag instructs the host to use a configuration protocol to obtain other configuration settings.
Combining the values of the M and O flags can yield the following:
Both M and O Flags are Set to 0. This combination corresponds to a network without a DHCPv6 infrastructure. Hosts use router advertisements for non-link-local addresses and other methods (such as manual configuration) to configure other settings.
Both M and O Flags are Set to 1. DHCPv6 is used for both addresses and other configuration settings. This combination is known as DHCPv6 stateful, in which DHCPv6 is assigning stateful addresses to IPv6 hosts.
The M Flag is Set to 0 and the O Flag is Set to 1. DHCPv6 is not used to assign addresses, only to assign other configuration settings. Neighboring routers are configured to advertise non-link-local address prefixes from which IPv6 hosts derive stateless addresses. This combination is known as DHCPv6 stateless: DHCPv6 is not assigning stateful addresses to IPv6 hosts, but stateless configuration settings.
The M Flag is Set to 1 and the O Flag is Set to 0. In this combination, DHCPv6 is used for address configuration but not for other settings. Because IPv6 hosts typically need to be configured with other settings, such as the IPv6 addresses of Domain Name System (DNS) servers, this is an unlikely combination.
Like DHCP for IPv4, the components of a DHCPv6 infrastructure consist of DHCPv6 clients that request configuration, DHCPv6 servers that provide configuration, and DHCPv6 relay agents that convey messages between clients and servers when clients are on subnets that do not have a DHCPv6 server.
As with DHCP for IPv4, DHCPv6 uses User Datagram Protocol (UDP) messages. DHCPv6 clients listen for DHCP messages on UDP port 546. DHCPv6 servers and relay agents listen for DHCPv6 messages on UDP port 547. The structure for DHCPv6 messages is much simpler than for DHCP for IPv4, which had its origins in the BOOTP protocol to support diskless workstations. Figure 1 shows the structure of DHCPv6 messages sent between client and server.
Figure 1 DHCPv6 messages between client and server (Click the image for a larger view)
The 1-byte Msg-Type field indicates the type of DHCPv6 message. The 3-byte Transaction-ID field is determined by a client and used to group the messages of a DHCPv6 message exchange together. Following the Transaction-ID field, DHCPv6 options are used to indicate client and server identification, addresses, and other configuration settings. For the list of defined DHCPv6 options, see RFC 3315, as referenced in the "DHCPv6 RFC Resources" sidebar.
DHCPv6 options are formatted with the type-length-value (TLV) format. Figure 2 shows the structure of DHCPv6 options.
The 2-byte Option-Code field indicates a specific option. The 2-byte Option-Len field indicates the length of the Option-Data field in bytes. The Option-Data field contains the data for the option.
There is a separate message structure for the messages exchanged between relay agents and servers to record additional information. Figure 3 shows the structure of these kinds of messages.
Figure 2 Structure of DHCPv6 options (Click the image for a larger view)
The 1-byte Hop-Count field indicates the number of relay agents that have received the message. A receiving relay agent can discard the message if it exceeds a configured maximum hop count. The 16-byte Link-Address field contains a non-link-local address that is assigned to an interface connected to the subnet on which the client is located. From the Link-Address field, the server can determine the correct address scope from which to assign an address. The 16-byte Peer-Address field contains the IPv6 address of the client that originally sent the message or the previous relay agent that relayed the message. Beyond the Peer-Address field are DHCPv6 options that include the Relay Message option, which contains the message being relayed and other options. The Relay Message option provides an encapsulation of the messages being exchanged between the client and the server.
There are no broadcast addresses defined for IPv6. Therefore, the use of the limited broadcast address for some DHCPv4 messages has been replaced with the use of the All_DHCP_Relay_Agents_and_Servers address of FF02::1:2 for DHCPv6. For example, a DHCPv6 client attempting to discover the location of the DHCPv6 server on the network sends a Solicit message from its link-local address to FF02::1:2. If there is a DHCPv6 server on the host's subnet, it receives the Solicit message and sends an appropriate reply. More typically, a DHCPv6 relay agent on the host's subnet receives the Solicit message and forwards it to a DHCPv6 server.
Figure 3 Structure of messages between relay and server (Click the image for a larger view)
Stateful Message Exchange
A DHCPv6 stateful message exchange to obtain IPv6 addresses and configuration settings-when both M and O flags in a received router advertisement are set to 1-typically consists of the following messages:
- A Solicit message sent by the client to locate the servers.
- An Advertise message sent by a server to indicate that it can provide addresses and configuration settings.
- A Request message sent by the client to request addresses and configuration settings from a specific server.
- A Reply message sent by the requested server that contains addresses and configuration settings.
If there is a relay agent between the client and the server, the relay agent sends the server Relay-Forward messages containing the encapsulated Solicit and Request messages from the client. The server sends the relay agent Relay-Reply messages containing the encapsulated Advertise and Reply messages for the client. For a complete list of DHCPv6 messages, see Figure 4.
|DHCPv6 Message||Description||Equivalent DHCP for IPv4 Message|
|Solicit||Sent by a client to locate servers.||DHCPDiscover|
|Advertise||Sent by a server in response to a Solicit message to indicate availability.||DHCPOffer|
|Request||Sent by a client to request addresses or configuration settings from a specific server.||DHCPRequest|
|Confirm||Sent by a client to all servers to determine if a client's configuration is valid for the connected link.||DHCPRequest|
|Renew||Sent by a client to a specific server to extend the lifetime of assigned addresses and obtain updated configuration settings.||DHCPRequest|
|Rebind||Sent by a client to any server when a response to the Renew message is not received.||DHCPRequest|
|Reply||Sent by a server to a specific client in response to a Solicit, Request, Renew, Rebind, Information-Request, Confirm, Release, or Decline message.||DHCPAck|
|Release||Sent by a client to indicate that the client is no longer using an assigned address.||DHCPRelease|
|Decline||Sent by a client to a specific server to indicate that the assigned address is already in use.||DHCPDecline|
|Reconfigure||Sent by a server to a client to indicate that the server has new or updated configuration settings. The client then sends either a Renew or Information-Request message.||N/A|
|Information-Request||Sent by a client to request configuration settings (but not addresses).||DHCPInform|
|Relay-Forward||Sent by a relay agent to forward a message to a server. Relay-Forward contains a client message encapsulated as the DHCPv6 Relay-Message option.||N/A|
|Relay-Reply||Sent by a server to send a message to a client through a relay agent. Relay-Reply contains a server message encapsulated as the DHCPv6 Relay-Message option.||N/A|
Stateless Message Exchange
A DHCPv6 stateless message exchange to obtain only configuration settings-when the M flag is set to 0 and the O flag is set to 1 in a received router advertisement-typically consists of the following messages: an Information-Request message sent by the DHCPv6 client to request configuration settings from a server and a Reply message sent by a server containing the requested config settings.
For an IPv6 network that has routers configured to assign stateless address prefixes to IPv6 hosts, the two-message DHCPv6 exchange can be used to assign DNS servers, DNS domain names, and other configuration settings that are not included in the router advertisement message.
DHCPv6 Support in Windows
Windows Vista™ and Windows Server® 2008 include a DHCPv6 client. The DHCPv6 client attempts DHCPv6-based configuration depending on the values of the M and O flags in received router advertisement messages. Therefore, to use DHCPv6, you must configure DHCPv6 servers and relay agents to service each IPv6 subnet and then configure your IPv6 routers to set these two flags to their appropriate values. If there are multiple advertising routers for a given subnet, they should be configured to advertise the same stateless address prefixes and values of the M and O flags. IPv6 hosts running Windows® XP or Windows Server 2003 do not include a DHCPv6 client and therefore ignore the values of the M and O flags in received router advertisements.
You can configure an IPv6 router that is running Windows Vista or Windows Server 2008 to set the M flag to 1 in router advertisements with the "netsh interface ipv6 set interface InterfaceName managedaddress=enabled" command. Similarly, you can set the O flag to 1 in router advertisements with the "netsh interface ipv6 set interface InterfaceName otherstateful=enabled" command.
Windows Server 2008 supports a DHCPv6 relay agent and DHCPv6 stateless and stateful configuration with the DHCP Server service. For stateless configuration ,you can configure the DHCP Server service for DHCPv6 options to be distributed to all DHCPv6 clients in the two-message DHCPv6 message exchange previously described. For stateful configuration, you can configure the DHCP Server service for DHCPv6 scopes and options.
DHCPv6 RFC Resource
Selected RFCs relating to DHCPv6: