DHCP explained: DORA, pools and relay
Short answer
DHCP (Dynamic Host Configuration Protocol) gives a host its IP address, subnet mask, default gateway and DNS servers automatically. The exchange is four messages, known as DORA: the client broadcasts a Discover, the server answers with an Offer, the client sends a Request for that address, and the server confirms with an Acknowledge.
DHCP hands every host an IP address, mask, default gateway and DNS server automatically. This lesson walks the four-message DORA exchange, shows a working server pool, explains excluded addresses and the relay that lets one server cover many subnets, and lists what to check when a client gets no address.
Open this labThe four messages: DORA
A new client has no address and does not know where the server is, so it starts with a broadcast:
| Step | Message | Sent by | Purpose |
|---|---|---|---|
| 1 | Discover | Client (broadcast) | Is there a DHCP server on this network? |
| 2 | Offer | Server | Here is an address you can have, with the gateway and DNS |
| 3 | Request | Client (broadcast) | I accept that offer |
| 4 | Acknowledge | Server | Confirmed — the lease starts now |
A working DHCP pool on a router
Exclude the addresses already assigned by hand (the gateway, servers, printers) first, then define the pool:
Edge(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10
Edge(config)# ip dhcp pool OFFICE
Edge(dhcp-config)# network 192.168.10.0 255.255.255.0
Edge(dhcp-config)# default-router 192.168.10.1
Edge(dhcp-config)# dns-server 8.8.8.8 1.1.1.1
Edge(dhcp-config)# exitWhy one server can serve many subnets: DHCP relay
Discover is a broadcast, and routers do not forward broadcasts. So a client on a subnet with no DHCP server of its own gets nothing — unless the router interface facing that client is told to relay. ip helper-address <server-ip> on that interface turns the broadcast into a unicast to the server, which answers from the pool that matches the client's subnet.
When a client gets no address
Work through these, closest to the client first:
- The client is set to obtain an address automatically, and its link is up.
- The switch port is in the VLAN the pool serves.
- A pool exists for that subnet, with addresses left after the exclusions.
- If the server is on another subnet, the gateway interface has ip helper-address pointing at it.
- A client that gives up assigns itself a 169.254.x.x (APIPA) address — a sign it heard no Offer at all.
Common questions
- What does DORA stand for in DHCP?
- Discover, Offer, Request, Acknowledge — the four messages a client and server exchange to lease an address.
- What is a 169.254 address?
- An automatic private (APIPA, link-local) address a host gives itself when it asked for DHCP and no server answered.
- What does ip helper-address do?
- It makes a router interface relay DHCP broadcasts it receives to a DHCP server on another subnet, as unicast.
- Why exclude addresses from a DHCP pool?
- So the server never leases an address already set by hand on the gateway, a server or a printer, which would cause a duplicate.
Practice this in the lab
Reading helps. Wiring it up yourself and breaking it makes it stick.
Open the lab