Stop Static IP Struggles! Set Up a DHCP Server on Your Cisco Switch/Router
What is DHCP?
DHCP stands for Dynamic Host Configuration Protocol. It is a network protocol used to automatically assign IP addresses to devices. DHCP uses a process called DORA to provide IP configuration to clients.
DHCP DORA Process
The DORA process works as follows:
1. Discover: The client sends a DHCPDISCOVER broadcast message to find a DHCP server.
2. Offer: The DHCP server replies with a DHCPOFFER message containing an available IP address.
3. Request: The client requests the offered IP address using a DHCPREQUEST message.
4. Acknowledge: The server confirms the request by sending a DHCPACK message.
After the DORA process completes, the client receives an IP address along with subnet mask, default gateway, and DNS server information. This process repeats when the device restarts or the lease expires.
Benefits of DHCP (DORA Process)
- Automatic IP Assignment: No need to manually configure IP addresses on each device.
- Centralized Management: IP addresses are managed from one central location.
- Dynamic Allocation: IP addresses can be reused when devices disconnect.
Configure DHCP Server on Cisco Switch
Configuration Steps
Step 1: Login to the switch using SSH or Telnet.
Step 2: Enter global configuration mode using configure terminal.
Step 3: Create a DHCP pool using ip dhcp pool pool_name.
Step 4: Exclude reserved IP addresses.
Step 5: Define the network and subnet mask.
Step 6: Configure the default gateway.
Step 7: Configure the DNS server.
Step 8: Set the lease duration.
Step 9: Exit configuration mode.
Step 10: Save the configuration.
DHCP Configuration Example
SW01# configure terminal SW01(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.50 SW01(config)# ip dhcp pool DHCPPOOL SW01(dhcp-config)# network 192.168.10.0 255.255.255.0 SW01(dhcp-config)# default-router 192.168.10.1 SW01(dhcp-config)# dns-server 8.8.8.8 SW01(dhcp-config)# lease 30 23 59 SW01(dhcp-config)# end
DHCP Verification
After configuration, verify DHCP operation using the show ip dhcp binding command.
SW01# show ip dhcp binding
IP address Client-ID/ Lease expiration Type
Hardware address
192.168.10.51 00D0.5812.EDDB -- Automatic
192.168.10.52 0002.4A65.8B87 -- Automatic
192.168.10.53 000B.BE29.D786 -- Automatic
The output confirms that the DHCP server has successfully assigned IP addresses to multiple client devices.
Conclusion
DHCP simplifies network management by automatically assigning IP addresses to devices using the DORA process. It reduces manual configuration and prevents IP conflicts.
Configuring a Cisco switch as a DHCP server is straightforward and useful in small to medium networks. Proper verification ensures that clients receive correct IP information.