DHCP Server Configuration in Cisco Switch

Dynamic Host Configuration Protocol, or DHCP, is a network protocol used (via DHCP server) to dynamically or automatically assign IP address and other info (e.g.Gateway,DNS) to each hosts in the network.

Here’s a sample configuration of running DHCP server in a Layer 3 switch.

Host Setup:
Gateway: 192.168.10.1
Netmask: 255.255.255.0
DNS Server: 192.168.20.254, 8.8.8.8

Layer 3 Switch(tested in Cisco 49xx)
VLAN ID: 888
IP Block: 192.168.10.0/24

 

Fig.A. Hosts connected to switch

  1. Configure respective interfaces for access vlan

L3-Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
L3-Switch(config)#
interface fa0/0
description PC1
switchport access vlan 888
switchport mode access
load-interval 30
spanning-tree portfast

interface fa1/0
description PC2
switchport access vlan 888
switchport mode access
load-interval 30
spanning-tree portfast

interface fa2/0
description Mac1
switchport access vlan 888
switchport mode access
load-interval 30
spanning-tree portfast

 

2. Configure the VLAN and  gateway(SVI)

vlan 888
name Office LAN VLAN

interface Vlan888
description Office LAN
ip address 192.168.10.1 255.255.255.0
load-interval 30

 

3. Configure DHCP service

ip dhcp pool LAN-OFFICE
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 192.168.20.254 8.8.8.8

Optional: Can put excluded address to reserve IPs for host’s static configuration

ip dhcp excluded-address 192.168.10.1 192.168.10.100

Note: Expected IP to dynamically assigned to host is 192.168.10.101

4. Verify using these commands

show ip dhcp pool [WORD]
show ip dchp binding

Sample Output:

L3-Switch#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type
Hardware address/
User name
192.168.10.101 2c37.0174.3c63.96 Jan 19 2021 03:23 AM Automatic
192.168.10.102 2590.27ea.0100.da Jan 19 2021 05:06 AM Automatic

One Comment

  1. Elliot said:

    awesome. thanks for this info, really helps me

Leave a Reply

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