DHCP Configuration
DHCP automatically assigns IP addresses to devices - saves you from manually configuring every PC.
Why Use DHCP?
Section titled “Why Use DHCP?”You need DHCP when:
- You have many devices that need IP addresses (too tedious to configure manually)
- Devices move between networks (laptops, mobile devices)
- You want centralized IP address management
- You need to provide DNS, gateway, and other network settings automatically
Create DHCP Pool
Section titled “Create DHCP Pool”Router(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10Router(config)# ip dhcp pool VLAN10_POOLRouter(dhcp-config)# network 192.168.10.0 255.255.255.0Router(dhcp-config)# default-router 192.168.10.1Router(dhcp-config)# dns-server 8.8.8.8 8.8.4.4Router(dhcp-config)# domain-name domain.localRouter(dhcp-config)# lease 7Router(dhcp-config)# exitParameters:
- 192.168.10.1 192.168.10.10 - IP range to exclude from DHCP. Replace with your reserved IPs.
- VLAN10_POOL - Pool name. Replace with any descriptive name.
- 192.168.10.0 255.255.255.0 - Network and mask. Replace with your subnet.
- 192.168.10.1 - Default gateway. Replace with your router/SVI IP.
- 8.8.8.8 8.8.4.4 - DNS servers. Replace with Google DNS, your own DNS, or ISP DNS.
- domain.local - Domain name. Replace with your domain (optional).
- 7 - Lease time in days. Common values are 1-7 days.
Breakdown:
excluded-address- IPs reserved for servers, routers, printers (won’t be assigned by DHCP). In this example, .1-.10 are reserved.network- Subnet to assign IPs from (DHCP will assign .11-.254 in this example)default-router- Gateway address (usually the router/SVI IP)dns-server- DNS servers for clients (can be public DNS or your own)domain-name- Domain suffix (optional, helps with name resolution)lease- How many days the IP assignment lasts (default is 1 day, 7 days is common for offices)
Multiple DHCP Pools Example
Section titled “Multiple DHCP Pools Example”! Exclude addresses for VLAN 10Router(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10
! DHCP Pool for VLAN 10Router(config)# ip dhcp pool SALES_VLANRouter(dhcp-config)# network 192.168.10.0 255.255.255.0Router(dhcp-config)# default-router 192.168.10.1Router(dhcp-config)# dns-server 8.8.8.8Router(dhcp-config)# exit
! Exclude addresses for VLAN 20Router(config)# ip dhcp excluded-address 192.168.20.1 192.168.20.10
! DHCP Pool for VLAN 20Router(config)# ip dhcp pool ENGINEERING_VLANRouter(dhcp-config)# network 192.168.20.0 255.255.255.0Router(dhcp-config)# default-router 192.168.20.1Router(dhcp-config)# dns-server 8.8.8.8Router(dhcp-config)# exitDHCP Relay (Helper Address)
Section titled “DHCP Relay (Helper Address)”When to use: When your DHCP server is on a different subnet/VLAN from your clients. This is VERY common - you might have a Windows DHCP Server or a central router providing DHCP for multiple VLANs.
Why needed: DHCP requests are broadcasts, and broadcasts don’t cross routers/VLANs. The helper-address tells the router to forward DHCP broadcasts to your DHCP server.
Scenario: DHCP server is at 10.10.10.10, but clients are on different VLANs.
Router(config)# interface vlan 10Router(config-if)# ip helper-address 10.10.10.10Router(config-if)# exit
Router(config)# interface vlan 20Router(config-if)# ip helper-address 10.10.10.10Parameters:
- vlan 10, vlan 20 - Replace with your VLAN interface names (or subinterfaces like
GigabitEthernet0/0.10). - 10.10.10.10 - Replace with your DHCP server’s IP address.
Note: Configure
ip helper-addresson the interface where DHCP clients live, NOT where the DHCP server is.
Now DHCP requests from VLAN 10 and VLAN 20 are forwarded to the DHCP server at 10.10.10.10.
Disable DHCP Server
Section titled “Disable DHCP Server”If you’re using an external DHCP server (like Windows Server), disable the router’s DHCP service.
Router(config)# no service dhcpDelete DHCP Pool
Section titled “Delete DHCP Pool”Router(config)# no ip dhcp pool SALES_VLANClear DHCP Bindings
Section titled “Clear DHCP Bindings”Remove current DHCP leases (forces clients to renew).
Router# clear ip dhcp binding *Clear specific binding:
Router# clear ip dhcp binding 192.168.10.50Verify Configuration
Section titled “Verify Configuration”Router# show ip dhcp poolRouter# show ip dhcp bindingRouter# show ip dhcp server statisticsRouter# show ip dhcp conflictRouter# show running-config | section dhcpTypical output:
Router# show ip dhcp bindingIP address Client-ID/ Lease expiration Type Hardware address192.168.10.50 0100.5056.a3b2.4c Dec 20 2025 10:30 AM Automatic192.168.10.51 0100.5056.a3b2.5d Dec 20 2025 11:45 AM Automatic