Many operators deploy the Dynamic Host Configuration Protocol
โข Support IPv4 hosts, which do not have any way to automatically calculate interface addresses
โข Support naming services (DNS)
โข Log and control the mapping of interface IP addresses, including controlling who can be assigned an IP address on the network
โข Control the assignment of the default gateway
โข Ensure the same IP address is not used in multiple places IPv4 DHCP
Figure 3-3 illustrates the IPv4 DHCP process.
Figure 3-3 IPv4 DHCP Operation
In this figure, host A is connected to the network and needs to obtain an IPv4 address. A, the DHCP client, sends a discover message to find out whether a DHCP server is connected to the network. If no DHCP server answers, A will not be able to obtain an IPv4 address.
A sends this discover message to a broadcast address, so router C and host D also receive the message. Since neither one of these is a DHCP server, they will not respond to the message. Most routers can be configured as DHCP servers; the two functions have been separated in this figure for clarity.
The DHCP server B will examine its local DHCP table for Aโs physical address. If the server has assigned A an address in the recent past, it will have a record associating Aโs physical address with an already assigned IPv4 address. If so, B will use the existing assignment. Otherwise, B will look for an unassigned address in its address pool and create an entry for A.
Server B offers this IPv4 address to A; the offer message is sent to the broadcast address. Both D and C receive this message, but the physical address of the requesting host ( A in this case) is carried in the offer packet, so C and D ignore this message.
When it receives the offer message, A will probe the network using the Address Resolution Protocol ( ARP), discussed in more detail in the next section, to verify the address is not in use by another host. After verifying the proposed address is unused, A will send a request message to the DHCP server, B.
The request message is also a broadcast, so C and D receive the packet. Since neither one of these devices is a DHCP server, however, they will ignore the request message. The DHCP server will then respond with an acknowledgment sent directly (not as a broadcast) to the client, A.
This final acknowledgment message contains other information, such as the default gateway the host should use, the prefix length for this segment, a list of name (DNS) servers available on the network, and a lease time.
The lease time allows IP addresses to be reused if a host has not been active for some period of timeโusually measured in hours or days. Just before a lease expires, the client can request an extension of the lease. Timing out IP address assignments allows addresses to be reused once a host moves permanently to another location in the network.
IPv6 DHCP and Router Advertisements
The original design of IPv6 did not include DHCP; all hosts would use SLAAC to calculate their IPv6 address. As noted previously, operators discovered there are still reasons to have a lightweight protocol that supports interface address configuration.
There are some minor differences between DHCP for IPv4 and DHCP for IPv6 (often called DHCPv6):
โข Instead of broadcasting responses, the server can send packets to the clientโs link local address, thus eliminating all server broadcasts.
โข Instead of broadcasting packets intended for the DHCP server, the client sends these packets to a multicast group.
โข A server can assign an address to a host based on a DHCP unique identifier (DUID), which is calculated by the client. If the hostโs physical address changes, it can keep or recover its previous IPv6 address.
โข Many unnecessary and unused options from DHCP for IPv4 have been removed in DHCPv6.
โข The discover message in IPv4 DHCP is the solicit message in DHCPv6.
โข The offer message in IPv4 DHCP is the advertise message in DHCPv6.
โข The acknowledge message in DHCP for IPv4 is the reply message in DHCPv6.
One major difference between DHCP for IPv4 and DHCPv6 is the prefix length and default gateway are not included in the DHCPv6 reply message. Instead, these are carried in a separate IPv6 protocol called Router Advertisements (RAs).
IPv6-capable routers send RAs to each segment to
โข Inform hosts connected to the segment the router can be used as a default gateway.
โข Indicate whether hosts connected to this segment should automatically compute their IPv6 addresses via SLAAC or should ask for an address through a DHCPv6 server.
โข Inform hosts connected to the segment about the maximum packet size (or maximum transmission unit [MTU]).
NoteThe chapters in Part II explore MTU in more detail.