Sie sind auf Seite 1von 14

Netmanias Technical Document: Understanding DHCP Relay Agents 가

www.nmcgroups.com

Understanding DHCP Relay Agents

Table of Contents

I. Overview
II. Why are DHCP Relay Agents Needed in DHCP Operations?
III. Basic Operations of DHCP Relay Agents
Appendix − Format of DHCP Messages in a Network with
DHCP Relay Agents

This document is the third in our DHCP technical documents series and explains the basic operations of a
DHCP relay agent. It covers the procedures of IP address allocation/lease, IP address renewal and IP
address release using a DHCP relay agent when a device and a DHCP server are located in different
subnets. It also describes how the parameters of DHCP messages are replaced by a DHCP relay agent
during such procedures.

November 5, 2013

www.netmanias.com
NMC Consulting Group (tech@netmanias.com)

About NMC Consulting Group


NMC Consulting Group is an advanced and professional network consulting company, specializing in IP network areas (e.g., FTTH, Metro Ethernet and IP/MPLS), service
areas (e.g., IPTV, IMS and CDN), and wireless network areas (e.g., Mobile WiMAX, LTE and Wi-Fi) since 2002.
Copyright © 2002-2013 NMC Consulting Group. All rights reserved.
Understanding DHCP Relay Agents

Abbreviations

ACK Acknowledgement
DA Destination Address
DHCP Dynamic Host Configuration Protocol
IHL Internet Header Length
IP Internet Protocol
MAC Medium Access Control
SA Source Address
TOS Type of Service
TTL Time To Live
UDP User Datagram Protocol

1
Understanding DHCP Relay Agents

I. Overview

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.

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

2
Understanding DHCP Relay Agents

(a) Network w/o DHCP relay agent PC


Broadcast Domain
(1 Subnet) DHCP Server
DHCP server unable to receive
any DHCP messages
L2 SW

Broadcast Domain
Internet
(1 Subnet) Router

Broadcast packets
L2 SW discarded by router

DHCP Discover/Request (Broadcast)

(b) Network w/ DHCP relay agent PC1 Broadcast Domain


(1.1.1.0/24) 100.1.1.1
DHCP Server
L2 SW DHCP messages delivered to
DHCP server through DHCP
relay agent
1.1.1.254/24
100.1.1.254/24
Broadcast Domain Internet
(2.1.1.0/254) Router

DHCP relay agent, converting


L2 SW DHCP Relay Agent broadcast DHCP messages to
unicast ones and forwarding to
DHCP server

DHCP Discover/Request (Broadcast) DHCP Discover/Request (Unicast)

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.

3
Understanding DHCP Relay Agents

Configuration: DHCP Server IP=100.1.1.1 DHCP Server IP=100.1.1.1


PC MAC=m1 DHCP Server MAC=m5
Downlink MAC=m2 Uplink MAC=m3
L2 Network
PC Downlink IP=1.1.1.254 Relay Uplink IP=100.1.1.254 DHCP
(Relay Agent IP)

1a DHCP Discover (Broadcast) 1b DHCP Discover (Unicast)


Ethernet Header {DA=FF:FF:FF:FF:FF:FF, SA=m1}, Ethernet Header {DA=m5, SA=m3},
IP Header {SIP=0.0.0.0, DIP=255.255.255.255}, IP Header {SIP=100.1.1.254, DIP=100.1.1.1},
DHCP Payload {Broadcast Flag=0 or 1, Relay Agent IP=0.0.0.0, DHCP Payload {Broadcast Flag=0 or 1, Relay Agent IP=1.1.1.254,
Client MAC=m1} Client MAC=m1}

2b DHCP Offer (Unicast or Broadcast) 2a DHCP Offer (Unicast)


Ethernet Header {DA=m1 or FF:FF:FF:FF:FF:FF, SA=m2}, Ethernet Header {DA=m3, SA=m5},
IP Header {SIP=1.1.1.254, DIP=1.1.1.10 or 255.255.255.255}, IP Header {SIP=100.1.1.1, DIP=1.1.1.254},
DHCP Payload {Broadcast Flag=0 or 1, Your IP=1.1.1.10, DHCP Payload {Broadcast Flag=0 or 1, Your IP=1.1.1.10,
Relay Agent IP=1.1.1.254, Client MAC=m1, Relay Agent IP=1.1.1.254, Client MAC=m1,
DHCP Server Identifier(54)=100.1.1.1, Options} DHCP Server Identifier(54)=100.1.1.1, Options}
3a DHCP Request (Broadcast) 3b DHCP Request (Unicast)
Ethernet Header {DA=FF:FF:FF:FF:FF:FF, SA=m1}, Ethernet Header {DA=m5, SA=m3},
IP Header {SIP=0.0.0.0, DIP=255.255.255.255}, IP Header {SIP=100.1.1.254, DIP=100.1.1.1},
DHCP Payload {Broadcast Flag=0 or 1, Relay Agent IP=0.0.0.0, DHCP Payload {Broadcast Flag=0 or 1, Relay Agent IP=1.1.1.254,
Client MAC=m1, DHCP Server Identifier(54)=100.1.1.1} Client MAC=m1, DHCP Server Identifier(54)=100.1.1.1}

4b DHCP Ack (Unicast or Broadcast) 4a DHCP Ack (Unicast)


Ethernet Header {DA=m1 or FF:FF:FF:FF:FF:FF, SA=m2}, Ethernet Header {DA=m3, SA=m5},
IP Header {SIP=1.1.1.254, DIP=1.1.1.10 or 255.255.255.255}, IP Header {SIP=100.1.1.1, DIP=1.1.1.254},
DHCP Payload {Broadcast Flag=0 or 1, Your IP=1.1.1.10, DHCP Payload {Broadcast Flag=0 or 1, Your IP=1.1.1.10,
Relay Agent IP=1.1.1.254, Client MAC=m1, Relay Agent IP=1.1.1.254, Client MAC=m1,
DHCP Server Identifier(54)=100.1.1.1, Options} DHCP Server Identifier(54)=100.1.1.1, Options}

IP address=1.1.1.10 allocation completed


Internet Access
SIP=1.1.1.10

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.

4
Understanding DHCP Relay Agents

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.

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.

5
Understanding DHCP Relay Agents

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.

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.

6
Understanding DHCP Relay Agents

PC MAC=m1 DHCP Server IP=100.1.1.1

PC Relay DHCP

T1 Timer Expired (IP Address Renewal Time)

1 DHCP Request (Unicast)


IP Header {SIP=1.1.1.10, DIP=100.1.1.1},
DHCP Payload {Client IP=1.1.1.10, Relay Agent IP=0.0.0.0, Client MAC=m1}

2 DHCP Ack (Unicast)


IP Header {SIP=100.1.1.1, DIP=1.1.1.10},
DHCP Payload {Client IP=1.1.1.10, Your IP=1.1.1.10, Relay Agent IP=0.0.0.0, Client MAC=m1, DHCP Server Identifier(54)=100.1.1.1, Options}

IP address=1.1.1.10 renewal completed


Internet Access
SIP=1.1.1.10

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.

PC MAC=m1 DHCP Server IP=100.1.1.1

PC Relay DHCP

Internet Access
SIP=1.1.1.10

DHCP client shut down (or “ipconfig /release”)

1 DHCP Release (Unicast)


IP Header {SIP=1.1.1.10, DIP=100.1.1.1},
DHCP Payload {Client IP=1.1.1.10, Relay Agent IP=0.0.0.0, Client MAC=m1, DHCP Server Identifier(54)=100.1.1.1}

IP address=1.1.1.10 release completed

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

7
Understanding DHCP Relay Agents

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,

8
Understanding DHCP Relay Agents

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

Downlink IP=1.1.1.254 Uplink IP=100.1.1.254 DHCP Server IP=100.1.1.1


L2 Network
PC PC MAC=m1 Downlink MAC=m2 Relay Downlink MAC=m3 DHCP Server MAC=m5 DHCP

DHCP Discover Message from PC to DHCP Relay Agent DHCP Discover Message from DHCP Relay Agent to DHCP Server
0B 2B 4B 0B 2B 4B
Destination MAC Address = FF:FF:FF:FF:FF:FF (Broadcast) Destination MAC Address = DHCP Server MAC (m5)
Ethernet

Ethernet
Source MAC Address = PC MAC Address (m1) Source MAC Address = DHCP Relay Agent Uplink MAC (m3)
EtherType = 0x0800 (IP) EtherType = 0x0800 (IP)
Ver = 4 IHL = 5 TOS Total Length Ver = 4 IHL = 5 TOS Total Length
Identification Flags Fragment Offset Identification Flags Fragment Offset
TTL Protocol=17(UDP) Header Checksum TTL Protocol=17(UDP) Header Checksum

IP
IP

Source IP Address = 0.0.0.0 Source IP Address = DHCP Relay Agent Uplink IP (100.1.1.254)
Destination IP Address = 255.255.255.255 (Broadcast) Destination IP Address = DHCP Server IP (100.1.1.1)
Source Port = 68 (bootpc) Destination Port = 67 (bootps) Source Port = 68 (bootpc) Destination Port = 67 (bootps)
UDP

UDP
UDP Length UDP Checksum UDP Length UDP Checksum
OP code=1(Req.) HW Type=Ethernet HW Length = 6 HOPS OP code=1(Req.) HW Type=Ethernet HW Length = 6 HOPS
Transaction ID (xid) Transaction ID (xid)
Seconds Broadcast Flag (1b) = 1 Seconds Broadcast Flag (1b) = 1
Client IP address (ciaddr) = 0.0.0.0 Client IP address (ciaddr) = 0.0.0.0
Your IP Address (yiaddr) = 0.0.0.0 Your IP Address (yiaddr) = 0.0.0.0

DHCP Message Payload


DHCP Message Payload

Server IP address (siaddr) = 0.0.0.0 Server IP address (siaddr) = 0.0.0.0


Gateway IP Address (giaddr) = 0.0.0.0 Gateway IP Address (giaddr) = DHCP Relay Agent Downlink IP (1.1.1.254)

Client Hardware Address (16B) (chaddr) = PC MAC Address (m1) Client Hardware Address (16B) (chaddr) = PC MAC Address (m1)

Server Name (64B) (sname) Server Name (64B) (sname)

Filename (128B) Filename (128B)

DHCP Message Type (Option 53) = 1 (DHCP Discover) DHCP Message Type (Option 53) = 1 (DHCP Discover)

Client Identifier (Option 51) = PC MAC Address (m1) Client Identifier (Option 51) = PC MAC Address (m1)

Parameter Request List (Option 55) = Option 1, 3, 6, ... Parameter Request List (Option 55) = Option 1, 3, 6, ...

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.

9
Understanding DHCP Relay Agents

DHCP Offer Message

Downlink IP=1.1.1.254 Uplink IP=100.1.1.254 DHCP Server IP=100.1.1.1


L2 Network
PC PC MAC=m1 Downlink MAC=m2 Relay Downlink MAC=m3 DHCP Server MAC=m5 DHCP

DHCP Offer Message from DHCP Relay Agent to PC DHCP Offer Message from DHCP Server to DHCP Relay Agent
0B 2B 4B 0B 2B 4B
Destination MAC Address = FF:FF:FF:FF:FF:FF (Broadcast) Destination MAC Address = DHCP Relay Agent Uplink MAC (m3)
Ethernet

Ethernet
Source MAC Address = DHCP Relay Agent MAC Address (m2) Source MAC Address = DHCP Server MAC (m5)
EtherType = 0x0800 (IP) EtherType = 0x0800 (IP)
Ver = 4 IHL = 5 TOS Total Length Ver = 4 IHL = 5 TOS Total Length
Identification Flags Fragment Offset Identification Flags Fragment Offset
TTL Protocol=17(UDP) Header Checksum TTL Protocol=17(UDP) Header Checksum

IP
IP

Source IP Address = DHCP Relay Agent Downlink IP (1.1.1.254) Source IP Address = DHCP Server IP Address (100.1.1.1)
Destination IP Address = 255.255.255.255 (Broadcast) Destination IP Address = DHCP Relay Agent Downlink IP (1.1.1.254)
Source Port = 67 (bootps) Destination Port = 68 (bootpc) Source Port = 67 (bootps) Destination Port = 68 (bootpc)
UDP

UDP
UDP Length UDP Checksum UDP Length UDP Checksum
OP code=2(Reply) HW Type=Ethernet HW Length = 6 HOPS OP code=2(Reply) HW Type=Ethernet HW Length = 6 HOPS
Transaction ID (xid) Transaction ID (xid)
Seconds Broadcast Flag (1b) = 1 Seconds Broadcast Flag (1b) = 1
Client IP address (ciaddr) = 0.0.0.0 Client IP address (ciaddr) = 0.0.0.0
Your IP Address (yiaddr) = 1.1.1.10 Your IP Address (yiaddr) = 1.1.1.10
Server IP address (siaddr) = 0.0.0.0 Server IP address (siaddr) = 0.0.0.0
Gateway IP Address (giaddr) = DHCP Relay Agent Downlink IP (1.1.1.254) Gateway IP Address (giaddr) = DHCP Relay Agent Downlink IP (1.1.1.254)
DHCP Message Payload

DHCP Message Payload


Client Hardware Address (16B) (chaddr) = PC MAC Address (m1) Client Hardware Address (16B) (chaddr) = PC MAC Address (m1)

Server Name (64B) (sname) Server Name (64B) (sname)

Filename (128B) Filename (128B)

DHCP Message Type (Option 53) = 2 (DHCP Offer) DHCP Message Type (Option 53) = 2 (DHCP Offer)

Subnet Mask (Option 1) = 255.255.255.0 (/24) Subnet Mask (Option 1) = 255.255.255.0 (/24)

Router IP (Option 3) = 1.1.1.254 Router IP (Option 3) = 1.1.1.254

Domain Name Server IP (Option 6) = 10.1.1.1, 10.1.1.2 Domain Name Server IP (Option 6) = 10.1.1.1, 10.1.1.2

IP Address Lease Time (Option 51) = 3,600 seconds (1 hour) IP Address Lease Time (Option 51) = 3,600 seconds (1 hour)

DHCP Server Identifier (Option 54) = 100.1.1.1 DHCP Server Identifier (Option 54) = 100.1.1.1

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.
 Source MAC Address: The DHCP server MAC address (m5) is replaced with the downlink MAC address of the DHCP relay agent (m2).

IP Header
 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).
 Destination IP Address: The downlink IP address of the DHCP relay agent (giaddr=1.1.1.254) is replaced with the broadcast IP address
(255.255.255.255).
Note: In this example, as we assumed that the “Broadcast Flag” value is set to 1, the relay agent broadcasts the message.

10
Understanding DHCP Relay Agents

DHCP Request Message

Downlink IP=1.1.1.254 Uplink IP=100.1.1.254 DHCP Server IP=100.1.1.1


L2 Network
PC PC MAC=m1 Downlink MAC=m2 Relay Downlink MAC=m3 DHCP Server MAC=m5 DHCP

DHCP Request Message from PC to DHCP Relay Agent DHCP Request Message from DHCP Relay Agent to DHCP Server
0B 2B 4B 0B 2B 4B
Destination MAC Address = FF:FF:FF:FF:FF:FF (Broadcast) Destination MAC Address = DHCP Server MAC (m5)
Ethernet

Ethernet
Source MAC Address = PC MAC Address (m1) Source MAC Address = DHCP Relay Agent Uplink MAC (m3)
EtherType = 0x0800 (IP) EtherType = 0x0800 (IP)
Ver = 4 IHL = 5 TOS Total Length Ver = 4 IHL = 5 TOS Total Length
Identification Flags Fragment Offset Identification Flags Fragment Offset
TTL Protocol=17(UDP) Header Checksum TTL Protocol=17(UDP) Header Checksum

IP
IP

Source IP Address = 0.0.0.0 Source IP Address = DHCP Relay Agent Uplink IP (100.1.1.254)
Destination IP Address = 255.255.255.255 (Broadcast) Destination IP Address = DHCP Server IP (100.1.1.1)
Source Port = 68 (bootpc) Destination Port = 67 (bootps) Source Port = 68 (bootpc) Destination Port = 67 (bootps)
UDP

UDP
UDP Length UDP Checksum UDP Length UDP Checksum
OP code=1(Req.) HW Type=Ethernet HW Length = 6 HOPS OP code=1(Req.) HW Type=Ethernet HW Length = 6 HOPS
Transaction ID (xid) Transaction ID (xid)
Seconds Broadcast Flag (1b) = 1 Seconds Broadcast Flag (1b) = 1
Client IP address (ciaddr) = 0.0.0.0 Client IP address (ciaddr) = 0.0.0.0
Your IP Address (yiaddr) = 0.0.0.0 Your IP Address (yiaddr) = 0.0.0.0
Server IP address (siaddr) = 0.0.0.0 Server IP address (siaddr) = 0.0.0.0
Gateway IP Address (giaddr) = 0.0.0.0 Gateway IP Address (giaddr) = DHCP Relay Agent Downlink IP (1.1.1.254)
DHCP Message Payload

DHCP Message Payload


Client Hardware Address (16B) (chaddr) = PC MAC Address (m1) Client Hardware Address (16B) (chaddr) = PC MAC Address (m1)

Server Name (64B) (sname) Server Name (64B) (sname)

Filename (128B) Filename (128B)

DHCP Message Type (Option 53) = 3 (DHCP Request) DHCP Message Type (Option 53) = 3 (DHCP Request)

Client Identifier (Option 51) = PC MAC Address (m1) Client Identifier (Option 51) = PC MAC Address (m1)

Requested IP Address (Option 50) = 1.1.1.10 Requested IP Address (Option 50) = 1.1.1.10

DHCP Server Identifier (Option 54) = 100.1.1.1 DHCP Server Identifier (Option 54) = 100.1.1.1

Parameter Request List (Option 55) = Option 1, 3, 6, ... Parameter Request List (Option 55) = Option 1, 3, 6, ...

Figure 7. DHCP Request 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 Request message from PC.

11
Understanding DHCP Relay Agents

DHCP Ack Message

Downlink IP=1.1.1.254 Uplink IP=100.1.1.254 DHCP Server IP=100.1.1.1


L2 Network
PC PC MAC=m1 Downlink MAC=m2 Relay Downlink MAC=m3 DHCP Server MAC=m5 DHCP

DHCP Ack Message from DHCP Relay Agent to PC DHCP Ack Message from DHCP Server to DHCP Relay Agent
0B 2B 4B 0B 2B 4B
Destination MAC Address = FF:FF:FF:FF:FF:FF (Broadcast) Destination MAC Address = DHCP Relay Agent Uplink MAC (m3)
Ethernet

Ethernet
Source MAC Address = DHCP Relay Agent MAC Address (m2) Source MAC Address = DHCP Server MAC (m5)
EtherType = 0x0800 (IP) EtherType = 0x0800 (IP)
Ver = 4 IHL = 5 TOS Total Length Ver = 4 IHL = 5 TOS Total Length
Identification Flags Fragment Offset Identification Flags Fragment Offset
TTL Protocol=17(UDP) Header Checksum TTL Protocol=17(UDP) Header Checksum

IP
IP

Source IP Address = DHCP Relay Agent Downlink IP (1.1.1.254) Source IP Address = DHCP Server IP Address (100.1.1.1)
Destination IP Address = 255.255.255.255 (Broadcast) Destination IP Address = DHCP Relay Agent Downlink IP (1.1.1.254)
Source Port = 67 (bootps) Destination Port = 68 (bootpc) Source Port = 67 (bootps) Destination Port = 68 (bootpc)
UDP

UDP
UDP Length UDP Checksum UDP Length UDP Checksum
OP code=2(Reply) HW Type=Ethernet HW Length = 6 HOPS OP code=2(Reply) HW Type=Ethernet HW Length = 6 HOPS
Transaction ID (xid) Transaction ID (xid)
Seconds Broadcast Flag (1b) = 1 Seconds Broadcast Flag (1b) = 1
Client IP address (ciaddr) = 0.0.0.0 Client IP address (ciaddr) = 0.0.0.0
Your IP Address (yiaddr) = 1.1.1.10 Your IP Address (yiaddr) = 1.1.1.10
Server IP address (siaddr) = 0.0.0.0 Server IP address (siaddr) = 0.0.0.0
Gateway IP Address (giaddr) = DHCP Relay Agent Downlink IP (1.1.1.254) Gateway IP Address (giaddr) = DHCP Relay Agent Downlink IP (1.1.1.254)
DHCP Message Payload

DHCP Message Payload


Client Hardware Address (16B) (chaddr) = PC MAC Address (m1) Client Hardware Address (16B) (chaddr) = PC MAC Address (m1)

Server Name (64B) (sname) Server Name (64B) (sname)

Filename (128B) Filename (128B)

DHCP Message Type (Option 53) = 5 (DHCP Ack) DHCP Message Type (Option 53) = 5 (DHCP Ack)

Subnet Mask (Option 1) = 255.255.255.0 (/24) Subnet Mask (Option 1) = 255.255.255.0 (/24)

Router IP (Option 3) = 1.1.1.254 Router IP (Option 3) = 1.1.1.254

Domain Name Server IP (Option 6) = 10.1.1.1, 10.1.1.2 Domain Name Server IP (Option 6) = 10.1.1.1, 10.1.1.2

IP Address Lease Time (Option 51) = 3,600 seconds (1 hour) IP Address Lease Time (Option 51) = 3,600 seconds (1 hour)

DHCP Server Identifier (Option 54) = 100.1.1.1 DHCP Server Identifier (Option 54) = 100.1.1.1

Figure 8. DHCP Ack message in IP address allocation/lease procedure

Ethernet Header
 Destination MAC Address: The uplink MAC address of the DHCP relay agent is replaced with the broadcast MAC address (0xFFFFFFFFFFFF).
Note: In this example, as we assumed that the “Broadcast Flag” is set to 1, the relay agent 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).

IP Header
 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).
 Destination IP Address: The downlink IP address of the DHCP relay agent (giaddr=1.1.1.254) is replaced with the broadcast IP address
(255.255.255.255).
Note: In this example, as we assumed that the “Broadcast Flag” value is set to 1, the relay agent broadcasts the message.

12
Understanding DHCP Relay Agents

Netmanias Research and Consulting Scope

99 00 01 02 03 04 05 06 07 08 09 10 11 12 13

eMBMS/Mobile IPTV
CDN/Mobile CDN
Transparent Caching
BSS/OSS
Services Cable TPS
Voice/Video Quality
IMS
Policy Control/PCRF
IPTV/TPS
LTE

Mobile Mobile WiMAX


Network Carrier WiFi
LTE Backaul
Data Center Migration
Carrier Ethernet
FTTH
Wireline
Data Center
Network
Metro Ethernet
MPLS
IP Routing

Visit http://www.netmanias.com to view and download more technical documents.

About NMC Consulting Group


NMC Consulting Group is an advanced and professional network consulting company, specializing in IP network areas (e.g., FTTH, Metro Ethernet and IP/MPLS), service
areas (e.g., IPTV, IMS and CDN), and wireless network areas (e.g., Mobile WiMAX, LTE and Wi-Fi) since 2002.
Copyright © 2002-2013 NMC Consulting Group. All rights reserved.

Das könnte Ihnen auch gefallen