Oct 24 2013

Run a DHCP Relay on a Cisco Catalyst 2960 Switch

Published by at 10:54 pm under Cisco

Having a DHCP relay on a layer 2 switch is usually a nonsense. However, a DHCP server happened to crash and I had no access to configure a new DHCP service on a remote site.
My only option was to set a DHCP relay on the switch that will forward requests to another site to avoid a massive change for static IP.
Some say layer 2 devices cannot deal with DHCP but hey, this is on the Cisco catalyst 2960 feature list… I even got this to work on a LAN base image.

Cisco catalyst DHCP relay

First I create a new scope on a Windows DHCP server hosted on the main site whose IP is 192.168.15.240.
 

Windows DHCP Ranges


Here’s how I configured my Cisco 2960: Small site, one vlan (VLAN 50), all ports in the same vlan

interface Vlan50
 ip address 192.168.50.11 255.255.255.0
 no ip route-cache
!
ip default-gateway 192.168.50.254

service dhcp

ip dhcp pool My_Dhcp_Pool
   relay source 192.168.50.0 255.255.255.0
   relay destination 192.168.15.240
!

 
Make sure you have the connectivity to the DHCP server

my_switch#ping 192.168.15.240

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.15.240, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 33/42/59 ms

 
The Cisco 2960 vlan interface must be configured with an appropriate IP address and netmask of course. Then it must be activated using the no shutdown command.
Since the switch has only one interface, it can provide IPs on a single range. I don’t think a DHCP request received on a port assigned to a different vlan would get a response, I haven’t tested it though.
 
Disable the DHCP relay if you need it no more

no service dhcp

This solution can be used as a backup with just a Cisco 2960 switch acting as a DHCP relay. In most scenarios, a layer 3 hardware such as a router, or a server on the network would handle DHCP leases.


No responses yet

Trackback URI | Comments RSS

Leave a Reply