Network Bytes · Episode 49 · CCNA 4.3 / 4.6
DHCP and DORA
When a device joins a network it gets its IP address from DHCP in four steps nicknamed DORA (Discover, Offer, Request, Acknowledge), and keeps it for a set time called a lease.
A hotel check-in for IP addresses
A new device on a network has no IP address, no subnet mask and no idea where the router is. Typing all that in by hand on every phone and laptop would be slow and error-prone. DHCP does it automatically. It works like checking into a hotel: you walk up to the front desk (the DHCP server), ask for a room, and get a room key for the length of your stay. At home, your Wi-Fi router is usually the DHCP server.
The four DORA steps
- Discover. The device has no address yet, so it can't talk to a specific server. It sends a broadcast to the whole local network: is there a DHCP server out there? DHCP runs over UDP: the client uses port
68and the server uses port67. - Offer. A DHCP server replies with an address it can lend, for example
192.168.1.23, along with options: the subnet mask (such as/24), the default gateway and a DNS server, plus the lease time. - Request. The device answers: yes please, I'll take that one. This message is usually broadcast too, so any other DHCP servers that made offers know theirs were declined.
- Acknowledge. The server confirms with an ACK. Now the device can start using the address and its settings.
Leases and renewing
The address isn't yours forever. The server hands it out for a set time, the lease. Roughly halfway through (at 50% of the lease, a timer called T1), the device tries to renew it with the server it got it from. If a device leaves and never renews, the address goes back into the server's pool for someone else. That's why the hotel analogy fits: rooms are reused after guests check out.
When the server is on another subnet
Broadcasts don't cross routers. In a business network, the DHCP server often sits in a data center on a different subnet from the users. The fix is a DHCP relay: the router interface facing the users is configured with ip helper-address <server IP>, so it picks up the broadcast and forwards it to the server as a normal unicast message.
Try it yourself
See your own DHCP lease. On Windows, open Command Prompt and run ipconfig /all: look for "DHCP Enabled", "DHCP Server", "Lease Obtained" and "Lease Expires". On a Mac, hold Option and click the Wi-Fi icon, or run ipconfig getpacket en0 in Terminal to see the server, subnet mask, router and lease time. On an iPhone or Android phone, open the details of your Wi-Fi network to see the IP address, router and DNS it was given. Then run ipconfig /renew on Windows (or choose Renew Lease in the Mac's network settings) and watch the lease times update.
Good to know
- DHCP for IPv4 is defined in RFC 2131. The client uses UDP port 68 and the server UDP port 67.
- The Discover is broadcast. The Request is also usually broadcast, so other servers know their offers were declined. The Offer and the Ack may be broadcast or unicast, depending on the client's broadcast flag.
- The lease time comes in the Offer and Ack. Clients try to renew at 50% of the lease (T1).
- When the server is on another subnet, a router relays the broadcast with
ip helper-address(DHCP relay, CCNA 4.6). - Home routers usually act as the DHCP server.
- "Hotel" is the analogy, and the
192.168.1.23address in the video is just an example.
For CCNA learners
This lines up with CCNA 200-301 exam topics 4.3, explain the role of DHCP and DNS within the network, and 4.6, configure and verify DHCP client and relay: know the four DORA messages in order, what the Offer carries, and why a relay (ip helper-address) is needed when the server is on another subnet.
Answer to the comment question
2 messages. The phone sends the Discover and the Request. The server sends the other two, the Offer and the Acknowledge. So it alternates: phone, server, phone, server.
Test your knowledge
Quick quiz: DHCP and DORA
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- IETF, "RFC 2131, Dynamic Host Configuration Protocol": DHCPDISCOVER, DHCPOFFER, DHCPREQUEST, DHCPACK; leases; T1 renewal at 50%
- IETF, "RFC 2132, DHCP Options and BOOTP Vendor Extensions": subnet mask, router, DNS server and lease time options
- Cisco, "Operate and Troubleshoot DHCP Snooping": walks through the DORA exchange on a Cisco switch
- Cisco, CCNA 200-301 v1.1 exam topics: 4.3 explain the role of DHCP and DNS within the network; 4.6 configure and verify DHCP client and relay
Video transcript
How does your phone get an IP address the second it joins Wi-Fi?
It asks for one, using DHCP, the Dynamic Host Configuration Protocol. It's like checking into a hotel that hands out rooms. The check-in has four steps, nicknamed DORA.
Discover. Your phone has no address yet, so it shouts to the whole network: is there a DHCP server out there?
Offer. A server replies: you can have this address, plus a subnet mask, a default gateway, and a DNS server.
Request. Your phone says: yes please, I'll take that one. Acknowledge. The server confirms, and the address is yours for a set time, called a lease.
Out of the four DORA messages, how many does your phone send? Comment your answer below!
That's your byte.
More from Network Bytes
- EP47OSPF neighbors and DR/BDR
- EP48HSRP / first-hop redundancy
- EP50NAT and PAT
- EP51"NTP: why time matters"