Which kind of DHCP message does a client that is seeking an IPv4 address send?

This document provides a technical understanding of a DHCP relay agent that is required in a multi-subnet environment where a DHCP client and a DHCP server reside in different subnets. Chapter II explains why these DHCP relay agents are needed in DHCP operations. Chapter III describes the basic principles of DHCP operations using a DHCP relay agent. Finally, in Appendix, specific message parameters used by DHCP relay agents in each DHCP procedure will be presented.

Before you read this document it is recommended that you refer to the companion documents, “Understanding the Basic Operations of DHCP” [2] and “Understanding the Detailed Operations of DHCP” [3].

II. Why are DHCP Relay Agents Needed in DHCP Operations?

Generally, DHCP messages are broadcasted. So, in order for the messages to be exchanged between a DHCP client (PC) and DHCP server, both the client and server have to reside on the same subnet. That is because routers do not forward any broadcast IP packet (i.e. one with a destination MAC address of FF:FF:FF:FF:FF:FF and a destination IP address of 255.255.255.255) to other interfaces. Thus a broadcast DHCP packet sent by a DHCP client cannot be delivered to DHCP server(s) on different subnet(s) through a router (shown in Figure 1 - (a)). This restriction requires all individual subnets have its own DHCP server for DHCP operation, which is practically not feasible in network operators' networks or corporate computer networks (too many DHCP servers are required in the network!).

To address this problem, the concept of a DHCP relay agent has long been adopted [1]. As shown in Figure 1 - (b), enabling the DHCP relay agent function in the router allows DHCP messages to be exchanged between a DHCP client and DHCP server residing on different subnets.1 The core function of this DHCP relay agent is to convert a broadcast DHCP packet into a unicast one, and forward it to a DHCP server.

Figure 1. Comparison of DHCP operations between networks with and without a DHCP relay agent

III. Basic Operations of DHCP Relay Agents

This chapter describes how a PC (e.g. PC1) on “1.1.1.0/24” subnet, as shown in Figure 1 - (b), can communicate with the DHCP server using a DHCP relay agent for all DHCP operations, such as IP address allocation/lease, IP address renewal and IP address release.

3.1 IP Address Allocation/Lease Procedure  

The DHCP relay agent is located between a PC and DHCP server as shown in Figure 2. The DHCP relay agent receives DHCP Discover and Request messages broadcasted by the PC, and unicasts them directly to the DHCP server. At this point, the DHCP relay agent stores its IP address (the interface address at which it received the DHCP Discover/Request messages) in the “Relay Agent IP (=Gateway IP=giaddr)” field of the DHCP message to be relayed.

The DHCP server unicasts a DHCP Offer/Ack message, with the destination IP address set as the relay agent IP address, to the DHCP relay agent. The DHCP relay agent, after checking the “Broadcast Flag” field of the received message, replaces the destination IP address with the IP address of the PC (Broadcast Flag=0) or with the broadcast IP address (Broadcast Flag=1) depending on the “Broadcast Flag” value. It also replaces the source IP address with the IP address of the DHCP relay agent, and forwards the modified message to the PC.

Figure 2. IP address allocation/lease procedure in the network with a DHCP relay agent

1. DHCP Discover

As described in the references [2], “Understanding the Basic Operations of DHCP”, and [3], “Understanding the Detailed Operations of DHCP”, a DHCP client broadcasts a DHCP Discover message on the physical Ethernet subnet to discover all DHCP servers available on the subnet. Upon receiving packets that have a UDP destination port set to 67 (DHCP Discover/Request), a DHCP relay agent replaces the values in the fields of the packets as follows, and then unicasts the modified message to a DHCP server:

  • Destination MAC address: The broadcast MAC address sent by the PC is replaced with the DHCP server MAC address (m5).
  • Source MAC address: The PC MAC address (m1) is replaced with the uplink MAC address of the DHCP relay agent (m3).
  • Destination IP address: The broadcast IP address (255.255.255.255) sent by the PC is replaced with the DHCP server IP address (100.1.1.1).
  • Source IP address: The IP address sent by the PC (0.0.0.0) is replaced with the uplink IP address of the DHCP relay agent (100.1.1.254).
  • Relay Agent IP address: The IP address sent by the PC (0.0.0.0) is replaced with the downlink IP address of the DHCP relay agent (1.1.1.254), the IP address of the relay agent’s interface at which the DHCP Discover message was received.

2. DHCP Offer  

The DHCP server, by referring to the relay agent IP address (giaddr) in a DHCP Discover message, selects an IP address to allocate to the DHCP client from an IP pool, and sends a DHCP Offer message with the destination IP address set as the relay agent IP address2. The DHCP relay agent, when receiving the message, replaces the values in the fields of the packets as follows, and then sends the modified message on to the DHCP client (PC):

  • Destination MAC address: If the “Broadcast Flag” field of the DHCP Offer message sent by a DHCP server is 0 (zero), the DHCP relay agent replaces the value in this field with the PC MAC address (Client MAC field: m1), and unicasts the message. However, if the “Broadcast Flag” value is 1 (one), the relay agent replaces it with the broadcast MAC address (FF:FF:FF:FF:FF:FF), and broadcasts the message.
  • Source MAC address: The DHCP server MAC address (m5) is replaced with the downlink MAC address of the DHCP relay agent (m2).
  • Destination IP address: The DHCP server sends the DHCP Offer message, with the destination address set as the relay agent IP address in the DHCP Discover message (1.1.1.254), to a DHCP relay agent. If the “Broadcast Flag” value in the message is 0, the relay agent replaces the value with the IP address allocated to the PC (Your IP field: 1.1.1.10) for unicasting. However, if the “Broadcast Flag” value is 1, the relay agent replaces it with the broadcast IP address (255.255.255.255) for broadcasting.
  • Source IP address: The DHCP server IP address (100.1.1.1) is replaced with the downlink IP address of the DHCP relay agent (1.1.1.254).

3. DHCP Request

The DHCP client (PC) which received the DHCP Offer message broadcasts a DHCP Request message on the physical Ethernet subnet to request network information data such as IP addresses. The DHCP relay agent, upon receiving this message, replaces the values in the fields (same as in the DHCP Discover message) of the packets as follows, and then unicasts the message to the DHCP server:

  • Destination MAC address: The broadcast MAC address sent by the PC is replaced with the DHCP server MAC address (m5).
  • Source MAC address: The PC MAC address (m1) is replaced with the uplink MAC address of the DHCP relay agent (m3).
  • Destination IP address: The broadcast IP address (255.255.255.255) sent by the PC is replaced with the DHCP server IP address (100.1.1.1).
  • Source IP address: The IP address sent by the PC (0.0.0.0) is replaced with the uplink IP address of the DHCP relay agent (100.1.1.254)
  • Relay Agent IP address: The IP address sent by the PC (0.0.0.0) is replaced with the downlink IP address of the DHCP relay agent (1.1.1.254), the IP address of the relay agent’s interface at which the DHCP Discover message was received.

4. DHCP Ack

The DHCP server sends a DHCP Ack message with the destination IP address set as the relay agent IP address (giaddr)3. The DHCP relay agent, upon receiving this message, replaces the values in the fields of the packets as follows, and then unicasts the message to the DHCP client (PC):

  • Destination MAC address: If the “Broadcast Flag” field of the DHCP Ack message sent by the DHCP server is 0 (zero), the DHCP relay agent replaces the value in this field with the PC MAC address (Client MAC field: m1), and unicasts the message. However, if the “Broadcast Flag” value is 1 (one), the relay agent replaces it with the broadcast MAC address (FF:FF:FF:FF:FF:FF), and broadcasts the message.
  • Source MAC address: The DHCP server MAC address (m5) is replaced with the downlink MAC address of the DHCP relay agent (m2).
  • Destination IP address: The DHCP server sends the DHCP Ack message, with the destination address set as the relay agent IP address in the DHCP Request message (1.1.1.254), to a DHCP relay agent. If the “Broadcast Flag” value in the message is 0, the relay agent replaces the value with the IP address allocated to the PC (Your IP field: 1.1.1.10) for unicasting. However, if the “Broadcast Flag” value is 1, the relay agent replaces it with the broadcast IP address (255.255.255.255) for broadcasting.
  • Source IP address: The DHCP server IP address (100.1.1.1) is replaced with the downlink IP address of the DHCP relay agent (1.1.1.254).

3.2 IP Address Renewal Procedure

According to the reference [1], a DHCP client (PC) keeps/stores the DHCP server IP address acquired through a DHCP Ack message (in the DHCP Server Identifier field) during the IP address allocation procedure. Then, if it needs to use the IP address beyond the lease duration, it sends a DHCP Request message to the DHCP server, through unicasting, not broadcasting. And the DHCP server, in respond to the message, unicasts a DHCP Ack message to the DHCP client.

As such, in case DHCP messages are to be unicasted, the DHCP relay agent does not need to play its role (of converting a broadcast message to a unicast one) for DHCP operations. So, as can be seen in Figure 3, the DHCP relay agent is not involved in any DHCP operations during the IP address renewal procedure.

Figure 3. IP address renewal procedure in the network with a DHCP relay agent

1. DHCP Request

The DHCP client (PC) unicasts a DHCP Request message with the destination IP address set as the IP address of a DHCP server. Thus, a DHCP relay agent does not receive this message. In other words, no field of the DHCP Request message is replaced by the DHCP relay agent during the IP address renewal procedure.

2. DHCP Ack

The DHCP server unicasts a DHCP Ack message with the destination IP address set as the IP address of the DHCP client (PC). Again, a DHCP relay agent does not receive this message. In other words, no field of the DHCP Ack message is replaced by the DHCP relay agent during the IP address renewal procedure.

3.3 IP Address Release Procedure

According to the reference [1], RFC 1542, when an IP address is released, a DHCP client (PC) unicasts a DHCP Release message to a DHCP server directly. Thus, a DHCP relay agent is not involved in the IP address release procedure as shown in Figure 4.

Figure 4. IP address release procedure in the network with a DHCP relay agent

1. DHCP Release

A DHCP client unicasts a DHCP Release message with the destination IP address set as the IP address of a DHCP server. Thus a DHCP relay agent does not receive this message. In other words, no fields of the DHCP Ack message is replaced by the DHCP relay agent during the IP address release procedure.

References

[1] W. Wimer, “Clarifications and Extensions for the Bootstrap Protocol”, RFC 1542, Standard, October 1993.

[2] Netmanias Technical Document, “Understanding the Basic Operations of DHCP”, October 2013

[3] Netmanias Technical Document, “Understanding the Detailed Operations of DHCP”, October 2013 

Footnotes

1 Generally, routers and L3 switches support all of DHCP relay agent functions.

2 Unless the IP address of a DHCP relay agent is set as “0.0.0.0”, a DHCP server always unicasts a DHCP Offer message to the DHCP relay agent regardless of the Broadcast Flag value.

3 Unless the IP address of a DHCP relay agent is set as “0.0.0.0”, a DHCP server always unicasts a DHCP Ack message to the DHCP relay agent regardless of the Broadcast Flag value.

Appendix − Format of DHCP Messages in a Network with DHCP Relay Agents

This appendix provides specific examples of DHCP message parameters that are replaced by a DHCP relay agent during DHCP procedures. However, in case of IP address renewal and release procedures, a DHCP relay agent does NOT replace any part of DHCP messages. Thus, all messages related to those procedures are excluded in this appendix. 

DHCP Discover Message

Figure 5. DHCP Discover message in IP address allocation/lease procedure

Ethernet Header

  • Destination MAC Address: The Broadcast MAC address (0xFFFFFFFFFFFF) is replaced with the DHCP server MAC address (m5).
  • Source MAC Address: The PC MAC address (m1) is replaced with the uplink MAC address of the DHCP relay agent (m3).

IP Header

  • Source IP Address: The IP address (0.0.0.0) is replaced with the uplink IP address of the DHCP relay agent (100.1.1.254).
  • Destination IP Address: The broadcast IP address (255.255.255.255) is replaced with the DHCP server IP address (100.1.1.1).

DHCP Message Payload

  • Gateway IP Address (giaddr): The IP address (0.0.0.0) is replaced with the downlink IP address of the DHCP relay agent (1.1.1.254) that receives a DHCP Discover message from PC.

DHCP Offer Message

Figure 6. DHCP Offer message in IP address allocation/lease procedure

Ethernet Header

  • Destination MAC Address: The uplink MAC address of the DHCP relay agent (m3) is replaced with the broadcast MAC address (0xFFFFFFFFFFFF).

Note: In this example, as we assumed that the “Broadcast Flag” value is set to 1, the relay agent broadcasts the message.  

Which DHCPv4 message will a client send to accept an IPv4?

DHCPv4 Operation The client transmits a DHCPDISCOVER message on its local network when it boots or senses an active network connection. Because the client has no way of knowing the subnet to which it belongs, the DHCPDISCOVER message is an IPv4 broadcast (destination IPv4 address of 255.255. 255.255).

Which DHCPv4 message will a client send to accept an IPv4 address that is offered by a DHCP server choose one?

When a DHCP client receives DHCPOFFER messages, it will send a broadcast DHCPREQUEST message for two purposes. It indicates to the offering DHCP server that it would like to accept the offer and bind the IP address.

What kind of message is sent by a DHCP client?

It sends a DHCPREQUEST message to accept the offer, indicating which server it selected. This message is broadcast to the entire network to let all DHCP servers know which server was selected. If a server receives a DHCPREQUEST message, the server marks the address as leased.

Which information is sent in an IPv4 Dhcpoffer message?

The DHCP server then sends a DHCPOFFER message that includes the IP address and other network configuration information. When the router receives the DHCPOFFER message, it broadcasts the message to the client that sent the DHCPDISCOVER message.