The Wayback Machine - https://web.archive.org/web/20241007213448/https://www.geeksforgeeks.org/dhcp-relay-agent-in-computer-network/
Open In App

DHCP Relay Agent in Computer Network

Last Updated : 13 Apr, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Prerequisite – Dynamic Host Configuration Protocol (DHCP), How DHCP server dynamically assigns IP address to a host? 

To assign an IP address to the host dynamically, the DHCP client exchanges DHCP messages with the DHCP server in the DORA process. 

In the DORA process, the discover and request message is broadcast, the offer and the acknowledgement message is broadcast or unicast depending upon the value of the broadcast flag i.e. If the value of the broadcast flag is 1, then the offer and acknowledgement message is broadcast and if 0, the messages are unicast. But this is valid only when the DHCP server is present in the same network because the router doesn’t forward any broadcast packet. What if the server is present in a different network? Here comes the role of DHCP relay agent. 

DHCP Relay Agent – 
The DHCP relay agent is any TCP/IP host which is used to forward requests and replies between the DHCP server and client when the server is present on a different network. Relay agents receive DHCP messages and then generate a new DHCP message to send out on another INTERFACE. Also, the DHCP relay agent adds a giaddr (gateway address of the packet) field and also the Relay agent information option 82 if enabled. The options field is removed when the server reply is forwarded to the host. 

DHCP relay agents are commonly used in large enterprise networks where the DHCP server is located on a different network segment than the client devices.The DHCP relay agent listens for DHCP broadcast messages from the client devices and then forwards those messages to the DHCP server, encapsulating them in a unicast packet.The DHCP relay agent may be configured with one or more IP addresses of DHCP servers that it can forward requests to.The giaddr field in the DHCP relay agent message is used to indicate the IP address of the relay agent interface on which the message was received.The Relay Agent Information option (option 82) may be used to add additional information to the DHCP request message, such as the interface or port number on which the request was received, or the VLAN ID of the requesting device.DHCP relay agents may be implemented in dedicated hardware devices, or they may be implemented in software on routers or other network devices.Some DHCP relay agents may include additional features such as DHCP packet filtering, rate limiting, or access control based on the source or destination IP address.If a DHCP relay agent is not properly configured, it can cause delays or failures in the DHCP process, leading to network connectivity issues for client devices.

Note – The discover and request messages are unicast by the DHCP relay agent. 

Example – 

Here is a topology in which there is a DHCP client having no IP address. There is a DHCP server having IP address 192.168.2.2 and there is a router in the middle which we want as the DHCP relay agent has an IP address 192.168.1.1 on interface fa0/0 and 192.168.2.1 on interface fa0/1.  

Now, first, the discover message is broadcast by the DHCP client to find out the DHCP server which is received by the switch as it is in the same broadcast domain. The switch broadcast the DHCP packet in the network, received by both PC and Router(DHCP Relay Agent). The PC and the router receive the broadcast packet but the PC drops the packet as the DHCP server is present in the different network therefore the packet has to be delivered to the default gateway only.  

The router, with DHCP relay agent feature, enabled, replaces the source address with its own address and the destination IP address with DHCP server IP address i.e. the DHCP relay agent unicast the packet to DHCP server. DHCP relay agent adds giaddr field into the packet and forwards it to the DHCP server. giaddr field is added to the packet so that the server should know from which pool, it has to assign the IP address. 

In our case, the giaddr field will contain 192.168.1.1 (IP address of the interface on which the router [DHCP relay agent] receives the discover message). 

The server replies with a unicast DHCP offer to the router offering the unleashed IP address.  

In return, the router broadcast the DHCP Offer message to the network which has sent the DHCP request. The broadcast message is received by a switch as shown in the above figure.  

The switch broadcasts the DHCP offer message to the hosts. Therefore, the message is received by the DHCP client  

Now, the DHCP client broadcast the DHCP request message, showing the acceptance of the IP address, for the server which is received by the switch. The switch broadcast the DHCP request message to the other host and the router(DHCP Relay Agent)as shown in the above figure.  

The router replaces the source IP address with its own IP address and destination IP remains the same i.e. It is unicast by the DHCP relay agent  

The server replies with a unicast DHCP Acknowledgement message to the router (DHCP relay agent) as shown in the above figure.  

The router in turn broadcast the DHCP Acknowledgement message to the network it receives the DHCP request for an IP address. The broadcast message is received by a switch as shown in the above figure.  

The broadcast DHCP Acknowledgement message is received by the DHCP client as the switch broadcast the message through all its ports. 

Configuration – 

This is the basic configuration of the client, router, dhcp_server. The router has been assigning IP addresses 192.168.1.1 on fa0/0 and 192.168.2.1 on fa0/1. 

ROUTER(config)#int f0/0
ROUTER(config-if)#ip address 192.168.1.1 255.255.255.0
ROUTER(config-if)#no shutdown
ROUTER(config)#int f0/1
ROUTER(config-if)#ip address 192.168.2.1 255.255.255.0
ROUTER(config-if)#no shutdown

The DHCP_SERVER is assigned IP Address 192.168.2.2 on the interface fa0/0 and the DHCP pool is defined with name POOL1 and network of 192.168.1.0 with subnet mask 255.255.255.0 is assigned to the pool POOL1.  

 
DHCP_SERVER(config)#int f0/0
DHCP_SERVER(config-if)#ip address 192.168.2.2 255.255.255.0
DHCP_SERVER(config-if)#no shutdown
DHCP_SERVER(config)#ip dhcp pool POOL1
DHCP_SERVER(dhcp-config)#network 192.168.1.0 255.255.255.0
DHCP_SERVER(dhcp-config)#default-router 192.168.1.1
DHCP_SERVER(dhcp-config)#exit

Now, the IP helper-address command is used for configuring the router as a DHCP relay agent, giving 192.168.2.2 the address of DHCP_server.  

ROUTER(config)#int f0/0
ROUTER(config-if)#ip helper-address 192.168.2.2
ROUTER(config-if)#exit

 


Previous Article
Next Article

Similar Reads

Comparison between X.25 and Frame Relay
X.25 : It is a standard ITU-T standard protocol.It consists of PSE packet switching exchange nodes.X.25 model is based on traditional telephony concept. Frame Relay : It is a packet switching telecommunication used for efficient data transfer which speeds up the transmission.It is used to connect LAN with public wide area networks. Difference betwe
1 min read
Internet Relay Chat (IRC)
Prerequisite - Chat Conferencing Protocols Internet Relay Chat (IRC) is an Internet application that was developed by Jakko Oikarinen in Finland. Chat is the most convenient immediate way to communicate with others via Internet. There are a number of topics called "channels" through which you can chat with many people all over the world. After join
5 min read
How does Frame Relay Work?
Frame Relay is a packet-switching network protocol that is designed to work at the data link layer of the network. It is used to connect Local Area Networks (LANs) and transmit data across Wide Area Networks (WANs). It is a better alternative to a point-to-point network for connecting multiple nodes that require separate dedicated links to be estab
4 min read
What is Local Management Interface (LMI) In Frame Relay?
Frame Relay sends information in packages called frames via a shared Frame Relay network. Each frame contains all the information needed to move it to the right place. Therefore, each end can connect to multiple locations with a single network access link. Frame Relay is like a direct connection between the last two points online. The storage areas
6 min read
Difference between Frame Relay and ATM
In data communication there are two important protocols namely, Frame Relay and Asynchronous Transmission Mode (ATM). It is crucial for network engineers and IT professionals to comprehend these two so they could select that is suitable for their network. In this article we will see comparison of Frame Relay and ATM. What is Frame Relay?Frame Relay
5 min read
Why Star network is More Efficient in Network Fault Tolerance in Place of Bus Network?
Answer: Star networks offer better fault tolerance than bus networks because a single point of failure in a star network (the central hub) affects only the connected device, while a fault in a bus network can disrupt communication for all devices on the bus.Advantages of Star Topology Over Bus Topology Individual Connection Points: In a star networ
2 min read
Basic Network Attacks in Computer Network
Many people rely on the Internet for many of their professional, social and personal activities. But there are also people who attempt to damage our Internet-connected computers, violate our privacy and render inoperable the Internet services. Given the frequency and variety of existing attacks as well as the threat of new and more destructive futu
7 min read
DHCP Snooping
Prerequisite - Dynamic Host Configuration Protocol (DHCP) Every protocol that we learn in Computer Network have some rules, these rules govern working of protocols. These rules sometimes provide way for attackers to take advantage of network. Attackers can also use working of DHCP to compromise our network. In this article we’ll learn how our netwo
3 min read
How to Configure DHCP Server on a Cisco Router?
In this article, we will discuss the overview of DHCP and will focus to implement How to Configure DHCP Server on a Cisco Router step by step. Let's discuss it one by one. Overview :DHCP (Dynamic Host Configuration Protocol) configuration is performed on routers to assign an IP address, subnet mask, gateway address ad DNS server address to the host
3 min read
Setting IP Address Using DHCP Server
Every computer on the network has to have an IP address for communication purposes. An IP address is an identifier for a computer or device on a network. The IP address can be assigned in two ways i.e. Static IP or Dynamic IP. Static IP: A static IP is where a user assigns an IP address manually. It has certain drawbacks for example you have 100 co
5 min read
DHCP Full Form
DHCP stands for Dynamic Host Configuration Protocol. It is the critical feature on which the users of an enterprise network communicate. DHCP helps enterprises to smoothly manage the allocation of IP addresses to the end-user clients' devices such as desktops, laptops, cellphones, etc.  Why Use DHCP?It is used because it automates the process of as
4 min read
Difference between DNS and DHCP
DNS and DHCP are two very critical services over a network. DNS refers to the Domain Name System, whereas DHCP refers to the Dynamic Host Configuration Protocol; these are two different but complementary services in the management of communication across a network. Whereas DNS works by translating human-readable domain names into the IP addresses t
4 min read
Difference between BOOTP and DHCP
BOOTP stands for Bootstrap Protocol and DHCP stands for Dynamic Host Configuration Protocol. These protocols square measure used for getting the information science address of the host alongside the bootstrap info. The operation of each protocol is totally different in some manner. Dynamic host configuration protocol is also the extended version of
5 min read
Dynamic Host Configuration Protocol (DHCP)
Dynamic Host Configuration Protocol is a network protocol used to automate the process of assigning IP addresses and other network configuration parameters to devices (such as computers, smartphones, and printers) on a network. Instead of manually configuring each device with an IP address, DHCP allows devices to connect to a network and receive al
14 min read
How to Find Network IP Address of Computer Using Computer Name?
Answer: By using the command "ping" followed by the computer name in the command prompt or terminal.To find the network IP address of a computer using its computer name: Open Command Prompt or Terminal Begin by opening the Command Prompt (Windows) or Terminal (macOS/Linux) on your computer. Use the Ping Command Type "ping" followed by the computer
1 min read
Differences between Wireless Adhoc Network and Wireless Sensor Network
1. Wireless Adhoc Network: A wireless ad-hoc network is a wireless network deployed without any framework or infrastructure. This incorporates wireless mesh networks, mobile ad-hoc networks, and vehicular ad-hoc networks. Its history could be traced back to the Defense Advanced Research Project Agency (DARPA) and Packet Radio Networks (PRNET) which
3 min read
Difference between Next Generation Network and Traditional Network
1. Next Generation Network : In short Next Generation Network is termed as NGN which is packet based network used for both telephony and data. It uses multiple broadband and Quality of Services (QoS) enabled transport technologies to establish advance communication system. NGN can handle multiple type of services/traffic such as voice, audio, video
5 min read
Difference between Network Administrator and Network Engineer
1. Network Administrator :A network administrator is a someone in an organization whose job is to manage organization's computer network. They also do jobs like on-site server organization , software networking and also placing the network in there correct position which is also called as Network Integrity. Those are the main thing in their job to
3 min read
Difference Between Network Security and Network Administration
In the world of information technology, there are two important and distinct roles that are often confused: network security and network administration. While these two jobs may be closely related, they require different sets of skills and responsibilities. It’s significant to understand the differences between network security and network administ
5 min read
Difference Between Network Management and Network Monitoring
Pre-requisites: Areas of Network Management Network management and Network monitoring are two important functions in maintaining the performance and security of a network. While they are often used interchangeably, they are distinct concepts with different goals and methods. Network management refers to the process of controlling, configuring, and
3 min read
Difference Between Network Congestion and Network Latency
Network congestion refers to a situation in which a network experiences an excessive amount of traffic, resulting in a reduction of available bandwidth and increased delays for network users. This can occur in both wired and wireless networks and can have a significant impact on the performance and reliability of the network. Congestion can occur d
9 min read
How Does a Network Topology Affect Your Decision in Setting up a Network?
Answer: Different Network Topology offer different costs, security, reliability, etc. So we choose one of the network topology as a blueprint for setting up our network according to the features that we required.By Network Topology we get to know how different nodes are connected in the network. There are different types of network topology like Bu
2 min read
How does a Network Interface Card (NIC) Facilitate Connectivity in a Wired Network?
Answer: A network interface card (NIC) facilitates connectivity in a wired network by providing an interface between the physical layer which provides the physical connection with the cables and the data link layer which provides reliable communication channel. The NIC converts the digital data into electrical data so that it can be transferred usi
2 min read
Difference Between Network Topology and Network Protocols
Network Topology and Network Protocols are closely related but distinct concepts in the field of computer networking. Network Topology refers to the physical and logical arrangement of devices on a network, while Network Protocols refer to the rules and standards that govern the communication between devices on a network. Understanding the differen
5 min read
Difference between Software Defined Network and Traditional Network
Whenever it comes to networks, new trends keep on adding up and thus it becomes essential to know about the dissimilarities that SDN Networks and Traditional Networks possess. Given the ever-increasing need for the expansion, fault tolerance, and resource optimization of the networks that connect today’s business environments, organizations, and IT
7 min read
Difference between Storage Area Network (SAN) and Network Attached Storage (NAS)
When it comes to managing and storing data in an IT setup it’s important to know the different storage options available. Two key technologies are Storage Area Network (SAN) and Network Attached Storage (NAS). SAN is a high-speed network that connects servers to storage devices, enabling efficient data transfer and centralized management making it
7 min read
MAC Filtering in Computer Network
There are two kinds of network Adapters. A wired adapter allows us to set up a connection to a modem or router via Ethernet in a computer whereas a wireless adapter identifies and connects to remote hot spots. Each adapter has a distinct label known as a MAC address which recognizes and authenticates the computer. Mac address is shown in the format
10 min read
Redundant Link problems in Computer Network
Basically, redundant links are used to prevent nasty network failure. These are used to provide redundancy, i.e back up when a link fails, i.e a frame can be forwarded out through another path but it can cause problems also. Here are some of these problems: Broadcast Storm - A switch forwards out the broadcast frame, generated by another device, to
4 min read
Port Security in Computer Network
Attackers' task is comparatively very easy when they can enter the network they want to attack. Ethernet LANs are very much vulnerable to attack as the switch ports are open to use by default. Various attacks such as Dos attack at layer 2, address spoofing can take place. If the administrator has control over the network then obviously the network
3 min read
EtherChannel in Computer Network
EtherChannel is a port link aggregation technology in which multiple physical port links are grouped into one logical link. It is used to provide high-speed links and redundancy. A maximum of 8 links can be aggregated to form a single logical link. EtherChannel, also known as Link Aggregation Control Protocol (LACP), is a technique used in computer
5 min read
Article Tags :