Sub topic 7
DHCP: automatic addressing and reservations
This chapter assumes you know IPv4 basics: private ranges, subnet masks, default gateways, and APIPA (the 169.254.0.0/16 self-assigned address). It covers how DHCP hands out settings, how a reservation works, and the errors you will see on the exam.
What DHCP does
Dynamic Host Configuration Protocol (DHCP) gives each device its network settings automatically. In a SOHO network the router usually runs the DHCP server. A DHCP server hands out:
- An IP address and subnet mask
- A default gateway
- DNS server addresses
- A lease time, which is how long the device may keep the address
Without DHCP you would type these values into every phone, laptop, and printer by hand. Typing mistakes and duplicate addresses would follow.
The DORA exchange
A client with no address broadcasts a request, because it does not yet know where the server is. The four steps are easy to remember as DORA.
DHCP uses UDP. The server listens on port 67 and the client on port 68.
Leases and renewal
The address is leased, not owned. Near the halfway point of the lease, the client asks the server to renew it. If the server never answers and the lease expires, the client gives up the address. When a Windows client cannot reach any DHCP server, it assigns itself an APIPA address in 169.254.0.0/16. That address works only on the local link, so the device cannot reach the internet.
Address pools and reservations
The router's DHCP settings include a pool, which is the range of addresses it may give out. For example, a pool of 192.168.1.100 to 192.168.1.199 leaves the rest of the subnet free for fixed devices.
A DHCP reservation ties one address to one device's MAC address. The device still asks DHCP for its settings, but the server always gives it the same address. Reservations suit printers, file servers, and any device you target with port forwarding.
| Method | Where it is set | Best for |
|---|---|---|
| Dynamic DHCP | Router hands out any free address | Phones, laptops, guests |
| DHCP reservation | Router, matched by MAC address | Printers, servers, cameras |
| Static address | On the device itself | Network gear, when you cannot use a reservation |
If you use static addresses, choose them outside the DHCP pool. An address inside the pool can be given to another device, which causes an address conflict.
Checking and renewing a lease
Run ipconfig /all to see the DHCP server, lease times, and gateway. To request a fresh lease, use:
ipconfig /release
ipconfig /renewCommon problems
- 169.254.x.x address: The client could not reach a DHCP server. Check the cable or Wi-Fi link, then confirm the DHCP server is enabled and running.
- Address conflict: Two devices have the same address, often from a static address inside the pool.
- Two DHCP servers: A second router (a rogue server) gives out wrong gateway or DNS values. Disable DHCP on the extra device.
- Pool exhausted: Every address is leased. Widen the pool or shorten the lease time.
Exercise
A office printer must always be at 192.168.1.50 so staff computers can find it, but you want the router to keep managing addresses. What should you configure, and what identifies the printer to the router?
Show answer
Create a DHCP reservation on the router for 192.168.1.50. The router matches the printer's MAC address and always gives it that address.
Exercise
A laptop shows the address 169.254.12.7 and cannot reach the internet. What does this mean, and what are two things to try?
Show answer
The laptop could not get a lease from a DHCP server and used APIPA. Check the physical or wireless connection and confirm DHCP is enabled on the router. Then run ipconfig /release and ipconfig /renew.