Skip to content

CCNA course / Run the services networks rely on · Step 1 of 11

Guide: DHCPSwitch

Guide

DHCP: how hosts get addresses, and how to protect and troubleshoot it

DHCP automatically gives hosts IPv4 addresses and other network settings. This guide covers the exchange, Cisco IOS configuration, switch protection, and the checks that help find common failures.

7 parts · video · 29 practice questions

DHCP clients and leases

A DHCP client can obtain its own interface address dynamically. On a Catalyst IOS XE routed interface, enter ip address dhcp. The no ip address dhcp form removes an address acquired this way. A DHCP client can relinquish a lease by sending DHCPRELEASE, which surrenders the address and cancels the remaining lease.

Server and relay port
UDP port 67
Client port
UDP port 68
Default lease
one-day lease
Link-local example
169.254.x.x

The server tracks assigned addresses in bindings. On a Cisco IOS DHCP server, show ip dhcp binding lists leased addresses, client hardware or client identifiers, and expiration. show ip dhcp pool reports pool capacity and use; show ip dhcp conflict lists addresses the server marked as conflicting. These are different views: bindings are current leases, while conflicts are addresses withheld after a conflict check.

DHCPv4 uses UDP port 67 for servers and relays and UDP port 68 for clients. Leases have a duration and renewal and rebinding timers. Catalyst IOS XE DHCP pools default to a one-day lease and support an unlimited lease with lease infinite. When a pool has no usable address left, new clients cannot get a lease and may self-assign an IPv4 link-local address such as 169.254.x.x. Inspect the pool, leases, exclusions, and conflicts before changing its size or lease duration.

IOS XE
interface GigabitEthernet0/0
 ip address dhcp
show dhcp lease
show ip dhcp binding
show ip dhcp pool
show ip dhcp conflict
Practice this part:CCNA: DHCP (10)
References (3)

Pools, options, and exclusions

A Cisco IOS DHCP pool defines the subnet and the settings offered to clients. Its network statement identifies the subnet; the server selects a pool matching the directly connected client subnet or, for a relayed request, the subnet identified by the relay agent address. Thus separate PC and voice subnets use matching pools, rather than pool order or a client's MAC vendor prefix determining the choice.

Inside pool configuration, default-router supplies the clients' default gateway (DHCP option 3). Option 150 supplies one or more TFTP server IP addresses; Cisco IOS XE Catalyst zero-touch provisioning documentation uses it to point devices to a TFTP server. DNS is a separate setting, configured with dns-server.

Use the global configuration command ip dhcp excluded-address low-address [high-address] to keep static addresses out of dynamic allocation. Exclusions are ranges, not client-specific reservations, and can be configured before or after a pool. To remove a pool or exclusion, negate the original command with no. Exclude static devices' addresses before clearing conflicts: clearing a conflict record only removes the record, so an address still in use can be detected again or accidentally leased.

IOS XE
ip dhcp excluded-address 10.10.10.1 10.10.10.10
ip dhcp pool DATA
 network 10.10.10.0 255.255.255.0
 default-router 10.10.10.1
 dns-server 10.10.10.53
 option 150 ip 10.10.10.20
no ip dhcp pool DATA
no ip dhcp excluded-address 10.10.10.1 10.10.10.10
References (3)

DORA: the four-message exchange

A client without an address normally starts with DHCPDISCOVER, a local broadcast. A server replies with DHCPOFFER; the client broadcasts DHCPREQUEST to select and request an offer; the server confirms with DHCPACK. The initials are DORA: Discover, Offer, Request, Acknowledge. The initial client broadcast uses UDP 68 to server UDP 67. A server response is sent to the client side on UDP 68.

Client broadcast
UDP 68
Server port
UDP 67
Discovery message
DHCPDISCOVER
Acknowledgement
DHCPACK
The four DORA messages, then a relayed request across subnets, as a 24 second clip. Watch on its own page

The offer can include the leased address, subnet mask, lease duration, default router, DNS servers, and other options. If the client does not receive usable DHCP service, it cannot use the intended routed configuration; an IPv4 link-local 169.254.x.x address is a common symptom on client operating systems.

References (1)

Relaying requests across subnets

Routers do not forward a client's local DHCP broadcast by default. When clients and the server are on different subnets, configure ip helper-address on the router interface that receives the client broadcasts, such as the client VLAN SVI or subinterface. The helper turns the broadcast into a unicast sent to the configured server address.

The relay places the receiving interface's address in the DHCP gateway address field, giaddr. The server uses that subnet indication to choose a matching pool and returns its reply to the relay. For a working end-to-end path, verify the server has a pool matching the client subnet indicated by giaddr and has a route back to the relay address. Also check routing and ACLs in both directions.

IOS XE
interface Vlan20
 ip helper-address 10.1.1.10
References (2)

DHCP snooping and trusted ports

DHCP snooping filters DHCP messages to stop an unauthorized server from answering clients. It is disabled by default. Enable it globally and for every client VLAN that needs protection. Once active, ports are untrusted by default, including trunks. Server-originated messages such as DHCPOFFER and DHCPACK received on an untrusted port are dropped.

Default state
disabled by default
Relay-agent information
DHCP option 82

Mark only interfaces that should receive legitimate server replies as trusted, commonly the uplink toward the legitimate DHCP server or relay. Trust is evaluated on the receiving switch: a downstream switch trusts its upstream-facing port, while the upstream switch can leave its downstream-facing port untrusted when no legitimate server is behind that downstream switch. A trunk is not trusted just because it is a trunk. Forgetting to trust the path for legitimate replies can stop clients from obtaining leases; a rogue DHCP server on an untrusted user port is blocked.

DHCP option 82 carries relay-agent information. A switch may reject a packet arriving on an untrusted port if the packet already contains option 82. In an edge and aggregation design where the edge inserts option 82, the aggregation switch can be configured with ip dhcp snooping information option allow-untrusted to accept that pre-existing information. Disabling local option 82 insertion alone does not authorize received option 82 data.

IOS XE
ip dhcp snooping
ip dhcp snooping vlan 20
interface GigabitEthernet1/0/48
 ip dhcp snooping trust
ip dhcp snooping information option allow-untrusted
Practice this part:CCNA: DHCP Snooping (8)
References (1)

The snooping binding table

A DHCP snooping switch learns bindings by watching client DHCP exchanges on untrusted interfaces. The table associates a client's MAC address, leased IP address, remaining lease time, VLAN, and learned interface. It is useful for checking what the switch learned and is also used by other first-hop security features. show ip dhcp snooping binding displays the dynamic bindings; it is not a list of all DHCP servers or configured exclusions.

The snooping table and a DHCP server's lease bindings are different tables. Use show ip dhcp snooping binding on the switch for snooping-learned client location and lease data; use show ip dhcp binding on a Cisco IOS DHCP server for server-issued leases and client identifiers.

IOS XE
show ip dhcp snooping binding
show ip dhcp binding
References (2)

DHCPv4 troubleshooting

Start by identifying where the exchange stops. Confirm the client VLAN and addressing, the server pool's network and available addresses, and whether a server is local or reached through a relay. For a remote server, verify ip helper-address is on the client-facing interface, then confirm the server has a pool matching giaddr and a route back to that relay address.

If clients receive an address but cannot leave their subnet, check that the matching pool includes default-router. If clients receive 169.254.x.x or no address and the pool is exhausted, show ip dhcp pool helps compare total addresses with leases, exclusions, and conflicts. Expand the scope, shorten the lease duration, or remove stale automatic bindings only after confirming the intended subnet and static ranges. Cisco IOS XE provides clear ip dhcp binding {address | *} to delete an automatic binding; this returns an address to the pool and should only be used for a binding confirmed to be stale.

For duplicate-address symptoms, inspect show ip dhcp conflict. Cisco IOS can mark a conflicting address unavailable. If the entries correspond to statically addressed devices, configure ip dhcp excluded-address for their range first, then clear the conflict records if needed. Clearing records without excluding the devices does not fix the cause.

If DHCP snooping is enabled and clients fail, verify snooping is enabled for their VLAN and that the receiving port for legitimate server replies is trusted. Snooping treats ports, including trunks, as untrusted by default; replies arriving on an untrusted uplink are discarded.

IOS XE
show ip dhcp pool
show ip dhcp binding
show ip dhcp conflict
show ip dhcp snooping
show ip dhcp snooping binding
References (2)

Check your understanding

DHCP: how hosts get addresses, and how to protect and troubleshoot it

All 7 sections · no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.