DHCP
Every time a laptop joins a network, it needs four things before it can do anything: an IP address, a subnet mask, a default gateway, and a DNS server. Typing those by hand on hundreds of devices is impossible. DHCP hands them out automatically through a fixed four-message exchange called DORA. This lesson covers the process, the exact ports, the Cisco configuration, and the relay trick that lets one server serve many subnets.
Why DHCP exists
DHCP (Dynamic Host Configuration Protocol) gives a host its network settings automatically, at the moment it joins. This is often called zero-config networking: plug in, and it works. Without DHCP, an administrator would have to type the same four values on every device and fix them by hand whenever the network changed.
DHCP is the reason a visiting phone can join a Wi-Fi network without anyone configuring it. It removes the most error-prone manual task in networking: keeping addresses unique and correct across every device.
IP address
The address the host uses on the local segment.
Subnet mask
Which addresses are local and which must be reached through a router.
Default gateway
The router interface to send traffic for anywhere else.
Ports and the DORA process
DHCP runs over UDP, and both endpoints are servers of a sort, so it uses two distinct port roles:
| Endpoint | UDP port | Role |
|---|---|---|
| DHCP server | 67 | Listens for client requests and sends offers and acknowledgments. |
| DHCP client | 68 | Sends requests and receives the server’s replies. |
Because a brand-new client has no IP address yet, the very first message is a broadcast. The client sends from source address 0.0.0.0 to destination address 255.255.255.255, asking if any DHCP server is listening.
Step 3 is broadcast on purpose. In a network with more than one DHCP server, the client may receive several offers. Broadcasting the request names the server whose offer it accepts and lets every other server withdraw theirs. Only after the DHCPACK in step 4 does the client actually configure its interface.
Lease time and renewal
DHCP does not give an address away forever — it leases it. An address is valid for the lease duration (commonly 8 days on a LAN, or just hours on a busy Wi-Fi network). The lease is what lets addresses be recycled when devices leave. Move the slider to see the two renewal points.
- At T1, roughly 50% of the lease, the client tries to renew by unicasting directly to the server that granted the lease.
- At T2, roughly 87.5% of the lease, if no renewal has happened, the client broadcasts so any DHCP server can renew or reassign.
- If the lease expires with no renewal, the client must stop using the address and start DORA again.
DHCP options
DHCP encodes settings as numbered options, defined in RFC 2132. Four appear constantly in CCNA material. Select each one.
| Option | Name | Provides |
|---|---|---|
| 1 | Subnet Mask | The client’s subnet mask. |
| 3 | Router | The default gateway address. |
| 6 | Domain Name Server | One or more DNS server addresses. |
| 51 | IP Address Lease Time | How long the address may be used. |
DHCP on Cisco IOS, and the relay
A Cisco router can act as a DHCP server for a directly connected LAN. First reserve the addresses that must stay static (routers, servers, printers), then define the pool. This example serves the 192.168.1.0/24 network:
! 1. Reserve the static range so DHCP never hands it out R1(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10 ! 2. Create the pool and give it a name R1(config)# ip dhcp pool LAN-POOL ! 3. Network, gateway, and DNS for this pool R1(dhcp-config)# network 192.168.1.0 255.255.255.0 R1(dhcp-config)# default-router 192.168.1.1 R1(dhcp-config)# dns-server 8.8.8.8 R1(dhcp-config)# exit R1(config)# end ! 4. Verify who has been assigned what R1# show ip dhcp binding
The ip dhcp excluded-address range keeps .1 through .10 out of the pool, so the gateway (.1) and any servers are never handed to a client. The default-router command sets option 3; dns-server sets option 6; network supplies option 1; and the router fills in option 51 with its default lease time.
DHCP relay (ip helper-address)
Here is the problem DHCP would otherwise have: the first message is a broadcast, and routers do not forward broadcasts between subnets. If the DHCP server sits on a different subnet than the clients, the clients’ broadcasts never reach it.
ip helper-address <server-ip>. It converts the client’s DHCP broadcast into a unicast addressed to the DHCP server on another subnet, and relays the reply back.! On the gateway interface that faces the clients R1(config)# interface gigabitEthernet0/0 R1(config-if)# ip helper-address 192.168.2.10
The helper address is placed on the interface closest to the clients — the LAN gateway interface — and points at the DHCP server. With it in place, one central DHCP server can serve many subnets, each relayed by its own gateway.
ip helper-address on the gateway interface. Check that first.Troubleshooting
Pick the symptom you are seeing and the table below gives you the cause and the check.
| Symptom | Likely cause | Check / fix |
|---|---|---|
| Client gets 169.254.x.x (APIPA) | No DHCP reply reached the client. | Verify the server is up and reachable; check for a missing relay. |
| No offer on a different subnet | Broadcast cannot cross a router and no relay is configured. | Add ip helper-address <server> on the client-facing gateway interface. |
| Some clients fail, others work | DHCP pool exhausted — all leases are in use. | Check show ip dhcp binding; enlarge the pool, shorten the lease, or free addresses. |
| Client ignores an address it already has | A static address falls inside the pool range. | Reserve it with ip dhcp excluded-address. |
169.254.0.0/16 range? If yes, DHCP failed. (2) Is the server on the same subnet? If no, is there an ip helper-address? That sequence solves most DHCP tickets.Review
Check what you have learned with these review questions.
Sources & references
- Droms, R. RFC 2131: Dynamic Host Configuration Protocol (1997). rfc-editor.org/rfc/rfc2131.
- Alexander, S. & Droms, R. RFC 2132: DHCP Options and BOOTP Vendor Extensions (1997). rfc-editor.org/rfc/rfc2132.
- IANA. Service Name and Transport Protocol Port Number Registry (DHCP 67/68). iana.org.
- Cisco. CCNA (200-301) Exam Topics, IP Services (DHCP configuration and relay). cisco.com.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.