How to Configure DHCP Server on Cisco Switches
The DHCP service allows hosts to obtain their IP configuration from a DHCP server automatically. Cisco switches and routers include DHCP. You can use them as a DHCP server. This tutorial explains how to configure the DHCP service on a Cisco switch and use it as a DHCP server.
Lab setup
Create a practice lab as shown in the following image and configure the switch to function as the DHCP server. You can use any network simulator software or use real Cisco devices for practice. This tutorial uses Packet Tracer and provides the download links for the lab used in it, with and without configurations.
Download link of the pre-created practice lab

This lab is optional and is intended for hands-on practice. Set it up if you want to gain practical experience with the concepts discussed. If you are interested only in the commands and configurations, feel free to skip this section.
DHCP configuration commands
The following table lists the commands you need to configure a Cisco switch to act as a DHCP server.
| Command | Description |
| Switch>enable | Enter Privilege Exec mode. |
| Switch#configure terminal | Enter global configuration mode. |
| Switch(config)#ip dhcp excluded-address [starting address] [ending address] | Create a range of excluded IP addresses. |
| Switch(config)#ip dhcp pool [pool name] | Create a DHCP pool and enter DHCP pool configuration mode. |
| Switch(dhcp-config)#network [network ID] [subnet mask] | Define a range of IP addresses that the DHCP server should offer to clients. |
| Switch(dhcp-config)#default-router [IP address of default gateway] | Set the default gateway's IP address. |
| Switch(dhcp-config)#dns-server [IP address of DNS server] | Set the DNS Server IP address. |
| Switch(dhcp-config)#exit | Exit DHCP pool configuration mode. |
| Switch(config)#interface vlan [ID] | Enter VLAN configuration mode for VLAN [ID]. |
| Switch(config-if)#ip address [any available IP address from the pool] [subnet mask] | Set an IP address on the VLAN. |
| Switch(config-if)#no shutdown | Enable the VLAN. |
| Switch(config-if)#exit | Exit VLAN configuration mode. |
| Switch(config)#exit | Exit global configuration mode. |
| Switch#copy running-config startup-config. | Copy the running configuration to the startup configuration. |
Configuring the DHCP service on the switch
Access the switch command prompt and execute the following commands.
Switch>enable Switch#configure terminal Switch(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.10 Switch(config)#ip dhcp pool test Switch(dhcp-config)#network 192.168.1.0 255.255.255.0 Switch(dhcp-config)#default-router 192.168.1.1 Switch(dhcp-config)#dns-server 4.4.4.4 Switch(dhcp-config)#exit Switch(config)#interface vlan 1 Switch(config-if)#ip address 192.168.1.5 255.255.255.0 Switch(config-if)#no shutdown Switch(config-if)#exit Switch(config)#exit Switch#

In the above configuration:-
| Switch>enable | Enter Privilege exec mode. |
| Switch#configure terminal | Enter Global configuration mode. |
| Switch(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.10 | Create a range of reserved IP addresses (192.168.1.1-192.168.1.10). Reserved addresses are assigned to resources that require static IP configurations, such as routers, servers, and printers. |
| Switch(config)#ip dhcp pool test | Create a DHCP pool (test) and enter DHCP pool configuration mode. |
| Switch(dhcp-config)#network 192.168.1.0 255.255.255.0 | Define a range of all available IP addresses (192.168.1.0/255.255.255.0). This IP range also includes the reserved IP addresses excluded in the first step. However, the DHCP server never offers them to the DHCP clients. |
| Switch(dhcp-config)#default-router 192.168.1.1 | Specify the default gateway IP. |
| Switch(dhcp-config)#dns-server 4.4.4.4 | Define the DNS server IP. |
| Switch(dhcp-config)#exit | Exit DHCP pool configuration mode. |
| Switch(config)#interface vlan 1 | Enter interface configuration mode for VLAN1. |
| Switch(config-if)#ip address 192.168.1.5 255.255.255.0 | Assign the IP address 192.168.1.5 to VLAN1. This IP address belongs to the IP range configured in the DHCP pool. It maps VLAN1 to the DHCP pool. |
| Switch(config-if)#no shutdown | Change the interface status to up. |
| Switch(config-if)#exit | Exit Interface configuration mode. |
| Switch(config)#exit | Exit Global configuration mode. |
DHCP uses the client's Vlan IP address to determine the IP pool. The client's Vlan is the Vlan configured on the switch port connected to the client. For example, if a client is connected to port F0/5 and Vlan 10 is configured on that port, then the client's vlan will be Vlan 10. By default, all switch ports belong to VLAN 1. This means, unless you create or configure additional VLANs, DHCP will use VLAN1's IP address to determine the pool.
Configuring DHCP clients
To configure a host as a DHCP client, set the host's IP configuration option to DHCP. Select the PC, navigate to Desktop, choose IP configuration, and select the DHCP option.

Configure all PCs as DHCP clients by following the steps described above.
Verifying the DHCP server
To verify the DHCP server configuration, check the PCs' IP configurations.

To view IP configuration on the command prompt, use the 'ipconfig' command.

Viewing leased addresses and DHCP statistics
To view IP addresses leased by the DHCP server, use the 'show ip dhcp binding' command.

To view DHCP pool statistics and information, use the 'show ip dhcp pool [pool-name]' command.

The following link provides this lab with all the configurations explained above.
Configured the packet tracer lab of the example
This tutorial is part of the tutorial series "DHCP (Dynamic Host Configuration Protocol) basic concepts, configurations, functions, and options explained". Other parts of this series are the following.
Chapter 1 What DHCP is and Types of DHCP Explained
Chapter 2 How DHCP works explained with examples
Chapter 3 DHCP Configuration Parameters and Settings Explained
Chapter 4 How to Configure DHCP Server on Cisco Switches
Chapter 5 Configure DHCP Server for multiple VLANs on the Switch
Chapter 6 How to Configure DHCP Server on Cisco Routers
Chapter 7 How DHCP Relay Agents work Explained
Chapter 8 How to Configure DHCP Relay Agent on Cisco Routers
Chapter 9 How DHCP Snooping works Explained
Chapter 10 Configure DHCP Snooping on Cisco Switches
Conclusion
A DHCP service dynamically manages IP addresses. You can configure it on any supported device. Cisco routers and switches support it. This tutorial explained the commands and configurations to run it on a Cisco switch using an example in the Packet Tracer network simulator.
Author Laxmi Goswami Updated on 2026-02-11