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. Show 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:
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):
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:
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):
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
IP Header
DHCP Message Payload
DHCP Offer Message Figure 6. DHCP Offer message in IP address allocation/lease procedure Ethernet Header
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.
|