DHCP Relay Agent: How to Implement in Packet Tracer

Introduction

DHCP Relay Agent is the process of assigning an IP address from one subnet to another subnet. The DHCP server will be in one network, while the clients will be in another network. So that the DHCP server and its client will be in different networks. The Router or Layer Three Switch will act as a relay agent. The word Relay means, the process of transferring something from one place to another place. So the Router or L3 Switch will pass DHCP messages to the desired network.

How does the DHCP relay agent work?

DHCP Relay Agent working

Suppose PC1 wants an IP address dynamically, then it will start broadcasting to get an IP address from the DHCP server. The PC1 broadcast can go only to the Router’s fast Ethernet 0/0, and it can’t travel across the Router. Similarly, if PC11 wants an IP address from the DHCP server, and there is no DHCP server in this network network2. In this case, the DHCP server is in network 1, so the PC11 will start broadcasting for it and that broadcast will terminate at Router fastethernet 0/1. Hence PC11 will not get an IP address! In the current scenario, we will need a Relay Agent, which will pass our client’s DHCP request message to the specified DHCP server. So we will configure the Router interface fastethernet 0/1 as a Relay Agent.

The IP-helper command on interface fastethernet 0/1 makes it a DHCP Relay Agent. The IP-helper command helps in finding the DHCP server. It also ensures that the interface on which DHCP relay functionally is enabled is reachable to the DHCP client broadcast. When the clients in network 2 broadcast for the IP address, then the interface on which the relay agent is enabled converts this broadcast into the unicast message and sends it to the specified DHCP server.

The DHCP relay agent must know the IP address of a DHCP server and must be reachable. Moreover, the client broadcast must be reachable to the interface relay agent. The DHCP relay agent listens at the UDP port number 67, while the client uses UDP port 68 for its communication.

Why We Use It?

DHCP relay agent helps to provide IP addresses to different subnets. It helps a large organization to place its DHCP server in a central location. Because the large organization has different subnets for their different sites. So the DHCP relay agent helps the organization’s clients obtain their IP addresses.

            It helps to minimize broadcast messages because it forwards DHCP messages only to the specified DHCP server. It also helps for easier IP address management efficiently. Moreover, it helps in scalability by allowing the extension of DHCP services without the need to deploy a DHCP server on each subnet. Similarly, it plays an important role in network security.

Lab Topology for DHCP Relay Agent

DHCP Relay Agent Lab

Assign IP addresses to the Router interfaces: Assign 192.168.10.1/24 to the fast Ethernet 0/0 and 192.168.20.1/24 to the interface fast Ethernet 0/1.

Configure DHCP pool for network 1 having subnet ID 192.168.10.0/24. The pool’s name is marwat10. The other parameters are as below in the screenshot:

configuring DHCP pool 1

Also, configure the 2nd Pool of IP addresses for network 2.

configuring DHCP pool 2

If the PC11 in network 2, wants an IP address from the DHCP server in network 1, then it will fail. Because we didn’t configure the IP-helper command on the Router. We will configure this command on the Router fastethernet 0/1 interface. It will help in identifying the DHCP server in response to the Client broadcast for the DHCP server. It will take the broadcast from the client and will forward it to the DHCP server. The IP-helper command must know the DHCP server’s IP location. The IP address of the server is 192.168.10.11:

IP helper-address command

Go to PC1 and try to Pick up an IP address from the server.

IP helper-address command

The PC1 has successfully got its IP address from the server. Now, this time go to PC11 in network 2 and try for an IP address from the server in network 1.

wait for IP address

As the server is in network 1, so it takes a few seconds.

Assining IP address through relay agent

The PC11 in network 2 has successfully got its IP address from the server located in network 1.

Suppose if our network is larger, and the DHCP server is not directly connected to the Router. Because, in our last scenario, the DHCP server was in one interface, and the clients were on another interface. But we want to complicate our network.

DHCP Relay for Multiple Networks

We will use this lab for our multiple networks.

Relay agent for multiple network

Configure IP address on Router Interfaces.

IP address on Routers

We configured two DHCP pools in the previous scenario, which were marwat10 and marwat20. So, remain it as was configured. Don’t make any changes in the DHCP server. We will also use these pools in this lab.

configuring both pools

Configure IP-helper command on Router R2 interface fastethernet 0/1.

configuring relay agent on R2

Now try to get an IP address in network 3 at the client’s PC.

Assign IP to the Network 3 clients

The PC11 in network 3 got its IP address dynamically from the DHCP server that is located in network 1. It got all the other configured parameters with IP addresses from the DHCP server.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *