How to Configure DHCP Relay Agent on Layer 3 Switch (l3 Switch) - Netizzan

How to Configure DHCP Relay Agent on Layer 3 Switch (l3 Switch)

Dynamic Host Configuration Protocol (DHCP) is a protocol that automatically assigns IP addresses to host devices existing on a network from the pool of IP addresses configured on the DHCP server.

In small networks, the DHCP server is always in the same subnet with all the DHCP clients; however, when the network grows to two or more subnetworks, some DHCP clients will appear to be in a different subnetwork than the DHCP servers. In this case, the network devices sitting between the subnetworks need to be configured as DHCP relay agents. This relay agent will help extend the DHCP request and reply to and from between the DHCP client and the DHCP server.

Although routers are traditionally used as DHCP relay agents, Layer 3 switches can also be used as relay agents because they posses routing capabilities.

In this post, I will be showing you how to Configure DHCP Relay Agent on Layer 3 Switch.

Let’s dive in!

Network Topology

The network topology we will be making use of in this post is shown in the image below. As you can see, it comprises a DHCP server, a layer 3 switch, 2 layer 2 switches, and PCs.

In this post, we will configure the server0 on the left as a DHCP server and then configure the layer 3 switch as a DHCP relay agent so that all the host devices on the 192.168.5.0/24 subnetwork can obtain IP addresses automatically from the DHCP server(server0).

network topology showing layer 3 switch, DHCP server and host devices

How to Configure DHCP Relay Agent on Layer 3 Switch

The steps to configure DHCP Relay Agent on Layer 3 Switch is Outlined below;

Step 1: Configure the Interfaces of the Layer 3 switch

The layer 3 switch is using the fa0/1 to connect to the 192.168.5.0/24 subnetwork and the fa0/2 to the 192.168.4.0/24 subnetwork. So we need to assign an IP address to each of these interfaces.

Because this is a layer 3 switch, we need to turn the switchport into routed port and then enable IP routing on the global config mode.

Enter the following commands to configure the interfaces of the layer 3 switch;

Switch>en
Switch#configure terminal
Switch(config)#hostname L3
L3(config)#int fa0/1
L3(config-if)#no switchport
L3(config-if)#ip address 192.168.5.1 255.255.255.0
L3(config-if)#int fa0/2
L3(config-if)#no switchport
L3(config-if)#ip address 192.168.4.1 255.255.255.0
L3(config-if)#exit
L3(config)#ip routing

Step 2: Configure the DHCP Server

As you can see from the network topology, the DHCP server (server 0) is located on the left side of the network. Tap on it and navigate to the “services” tab, then select DHCP from the left corner.

Image of DHCP server

As shown in the image above, add the subnetwork 192.168.4.0/24 to the DHCP pool and name it serverPool. Note that our starting IP address is 192.168.4.5, so we have reserved 192.168.4.1 to 192.168.4.4 for special purposes. After filling it appropriately, as shown above, tap save to save the DHCP pool.

After saving it, edit the field to create the second DHCP pool (Pool_1) for the second subnetwork (192.168.5.0/24) and click on “add.”.

An image showing how to configure DHCP pool on server in packet tracer

Step 3: Configure the Layer switch as DHCP relay agent

Enter the following commands to configure the layer 3 switch as DHCP relay agent;

L3>enable
L3#configure terminal
L3(config)#int fa0/1
L3(config-if)#ip helper-address 192.168.4.2

Note: The command above was entered on the interface connecting to the DHCP client, for which the messages need to be forwarded to the DHCP server by the Layer 3 switch.

Step 4: Configure the DHCP Client

Tap on one of the PCs, and then navigate to the “config tab.” Then enable DHCP as shown in the image below.

Enabling DHCP on PC4

As you can see above, PC4 has obtained its IP address automatically from the DHCP server through the layer 3 switch (relay agent). Repeat the above step on every other PC to get them to obtain an IP address from the DHCP pool.

Recommended; How to Configure DHCP on Layer 3 Switch In Packet Tracer

Related content;

How to Configure DHCP Server For Multiple VLANS in Packet Tracer

DHCPv4 Server & DHCPv4 Client Configuration on Cisco Router

How to Configure DHCP on Layer 2 Switch in Packet Tracer

How to Configure DHCP Snooping In Cisco Packet Tracer

How to Configure DHCP on Layer 3 Switch In Packet Tracer

Leave a Comment

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

Scroll to Top