DHCP — server, relay, and client
DHCP gives every host an IP, mask, gateway, and DNS without anyone touching the keyboard. This chapter walks through the DORA exchange, configures a router as a DHCP server, and explains the ip helper-address relay.
What you'll learn
- List the four DHCP messages in order: Discover, Offer, Request, Acknowledge.
- Configure a DHCP pool on a router.
- Explain when ip helper-address is required.
The DORA exchange
All four are sent inside UDP. The client's source IP is 0.0.0.0 until the lease is granted; broadcast destination 255.255.255.255 is used for Discover and Request.
What the client ends up with is a lease: an address and a mask, a default gateway, one or more DNS servers, and a time limit. The rest of this chapter follows those four messages in detail — who hears each one, how a server picks the address, how a router relays them, and what to check when a host ends up with no address at all.
- Discover — client broadcasts 'I need an address' (UDP 67).
- Offer — server replies with a candidate lease (UDP 68).
- Request — client formally requests the offered address.
- Acknowledge — server confirms the lease.
Configure a router as DHCP server
Read the configuration top to bottom. The exclusion keeps the router's own address and the hand-configured devices out of the pool. The network line sets the subnet and the mask the clients receive. default-router and dns-server fill in the gateway and the resolvers, and lease sets how long a client may keep its address, in days. The two show commands list the pool and the leases it has handed out.
R1(config)# ip dhcp excluded-address 10.0.10.1 10.0.10.20
R1(config)# ip dhcp pool LAN10
R1(dhcp-config)# network 10.0.10.0 /24
R1(dhcp-config)# default-router 10.0.10.1
R1(dhcp-config)# dns-server 10.0.99.53 10.0.99.54
R1(dhcp-config)# lease 3
R1(dhcp-config)# end
R1# show ip dhcp pool
R1# show ip dhcp binding10 more sections in this chapter, plus a 4-question quiz and a hands-on lab.
Modules 2–8 are part of the Course & Lab Pass and All-Access Max — start with a free account
You can see the title, summary, learning objectives and the opening sections. The rest of this chapter, like all of modules 2–8, comes with the Course & Lab Pass and All-Access Max. A free account opens Module 1: How Networks Work end-to-end and saves your labs — start there, no card required.
- Read every chapter in Module 1 — How Networks Work
- Save labs of up to 5 devices
- Save up to 3 topologies
- See the full course syllabus + chapter titles
Free account · no card required · compare plans any time
Build it step by step
- Guest Wi-Fi that actually associatesStand up a WPA2-PSK guest network on a bridged access point and prove a laptop joins it and reaches the wired LAN. · 6 steps · ~15 min · 5 devices
- Let the router hand out the addressesBuild a four-device office LAN, address one PC by hand, then put a DHCP pool on the router so the next machine configures itself. · 6 steps · ~15 min · 4 devices
- One DHCP server for every floorServe a user floor from a central DHCP server on another subnet — watch the first request die at the router, then relay it with ip helper-address. · 6 steps · ~20 min · 5 devices
- Let the core switch hand out the addressesRun two department VLANs, their gateways and their DHCP pools on a single switch — and find out why a perfect pool can still hand out nothing. · 7 steps · ~20 min · 3 devices
- Fix it: Fix the desks DHCP forgotThe clinic's desks come up with no address. Find why the DHCP server never hears them — then why their leases still go nowhere. · 6 steps · ~16 min · 5 devices
- Campus capstonePut it all together: two wiring closets, two VLANs, DHCP for the desks, and one public address for the whole site. · 9 steps · ~35 min · 8 devices
- Branch office capstoneStaff and guests on one switch: guests lease an address the moment they plug in, reach the internet, and never see a staff file. · 10 steps · ~40 min · 7 devices