GNS3: Offloading DHCP service to another router acting as DHCP server

Most tutorial examples (for reasons of simplicity) will include DHCP server configuration on the same router that’s connected to the multiple VLANs so that IP addresses can be provided to devices on the network.

For a more clean (and realistic) setup, the DHCP crud can be taken out of the core router and moved to a different router acting solely as a DHCP server for your network as seen below in the topology:

dhcp-offloading

This simple topology has the standard R1 “Router-on-a-Stick” set up with two VLANs, one for PC1 and different one for PC3.  There are many tutorials out there for the “ROAS” configuration so that step will not be covered here.  RDHCP is a separate router acting as a DHCP server and will take care of all DHCP requests.

Realistic networks almost always run a separate DHCP server to provide IP addresses to devices on the network.  Since a router can be set to act as a DHCP server, it’s ideal for a lab demonstrating the proof-of-concept of offloading DHCP service to another device / server.

In the topology, R1 (10.10.10.1) and RDHCP (10.10.10.10) are directly connected with each other.

When a DHCP request is broadcast by a device, it will bubble up to R1’s sub-interface for the VLAN and at which point, a DHCP relay agent can take over and forward the request to the offloaded DHCP server.

On R1,

include the line for DHCP relay agent on each of the sub-interfaces for the VLANs:

interface FastEthernet1/0.10
encapsulation dot1Q 10
ip address 192.168.10.1 255.255.255.0
ip helper-address 10.10.10.10
!
interface FastEthernet1/0.20
encapsulation dot1Q 20
ip address 192.168.20.1 255.255.255.0
ip helper-address 10.10.10.10
!

When DHCP packets are forwarded to RDHCP, the DHCP server will know which pool to use by checking the IP addresses of the sub-interface that sent the traffic.

If 192.168.10.1, then RDHCP knows to use the pool for VLAN 10, 192.168.20.1 for VLAN 20 pool.

RDHCP:

ip dhcp   excluded-address   192.168.10.1   192.168.10.20
ip dhcp  excluded-address  192.168.20.1   192.168.20.20

ip dhcp pool TEN
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 8.8.8.8
!
ip dhcp pool TWENTY
network 192.168.20.0 255.255.255.0
default-router 192.168.20.1
dns-server 8.8.8.8
!

RDHCP also needs to know where to send back its DHCP responses so that the packets can make it all the way back to the devices.  Set up two static routes, one for each VLAN to send back the traffic to R1. R1 can then route the packets onto the right VLAN:

RDHCP:

ip route   192.168.10.0   255.255.255.0   10.10.10.1
ip route   192.168.20.0   255.255.255.0   10.10.10.1

routes1

Test a VPCS PC and have it make a DHCP request. Note that it gets the first available IP address after the excluded range of the pool:

pc1

Verify the DHCP bindings on RDHCP to see a list of leased IP addresses that have been given out:

binding

This entry was posted in Networking. Bookmark the permalink.