The Big Picture: Who Gives Your PC Its Address?
When you plug in a cable or join Wi-Fi, you do not type an IP address, a gateway or DNS servers. Something does it for you. In the previous chapter you learned the DHCP conversation (Discover, Offer, Request, Acknowledge). Here we meet the Windows part that starts that conversation: the DHCP Client service.
6.1 Automatic Configuration
What it is: The DHCP Client is a Windows service. Its short name is Dhcp. When a network adapter comes up, the service asks the local DHCP server (usually your router) for settings.
What the server hands out:
| Setting | Meaning |
|---|---|
| IP address | Your PC's address on this network |
| Subnet mask | Which addresses are "local" |
| Default gateway | The router to use for everything else |
| DNS servers | Where the DNS Client sends questions (Section 5) |
| Lease time | How long you may keep the address |
The lease. The address is not given forever. It is leased (rented) for a time, such as 8 hours or 24 hours. This keeps old addresses from being used up by PCs that left.
Time ─────────────────────────────────────────────────►
│ lease obtained lease expires │
│ │ │ │
│ 50%: try to renew 87.5%: try any server │
│ (ask the same server) (if the first is silent) │
The usual rule: at about half the lease time the PC quietly asks the same server to renew. If that fails, it tries again later, and at the very end it starts the whole process again. Normally you never notice any of this.
Where the facts live. The lease details are kept by Windows (for example in the registry, under the adapter's settings, hedge) so they survive a restart.
How to see the lease:
ipconfig /all
Find your active adapter. These lines matter:
| Line | Meaning |
|---|---|
DHCP Enabled . . . : Yes | The address came from DHCP |
DHCP Server | The device that gave the lease (often your router) |
Lease Obtained / Lease Expires | When the rental started and ends |
Default Gateway | The router |
DNS Servers | The DNS servers you were given |
Get-NetIPConfiguration and Get-NetIPAddress give a shorter view of the same facts.
Two special commands:
| Command | Effect |
|---|---|
ipconfig /release | Gives the address back. Your connection drops immediately |
ipconfig /renew | Asks for a lease again. The connection returns after a moment |
Warning: These two briefly disconnect you from the network. Do not run them in the middle of a download, a video call or remote work. Never run
/releaseon a PC you are controlling remotely (for example by Remote Desktop), or you may lose your connection to it. The lab in this chapter does not ask you to use them.
Check the service:
Get-Service DhcpIt should be Running. The DHCP Client service also helps with things like registering the PC's name in DNS (hedge: depends on the network).
6.2 APIPA (Automatic Private IP Addressing) Fallback
What it is: What if the DHCP server is not there (router off, bad cable, Wi-Fi problem)? Windows does not give up and leave you with nothing. After a few tries it gives itself an address from a special range: 169.254.0.1 to 169.254.255.254. This is APIPA, Automatic Private IP Addressing. (It is a form of link-local addressing.)
Ask DHCP ──► Offer received? ──► YES: use the leased address
│
NO (after several tries)
▼
Pick a random 169.254.x.x address
(check with ARP that nobody else uses it)
│
▼
Works only with other 169.254.x.x PCs
on the same local network. No gateway, no internet.
Keeps asking DHCP in the background.
What APIPA gives you and what it doesn't:
| Works | Does not work |
|---|---|
| Talking to other PCs that also fell back to 169.254.x.x on the same cable or Wi-Fi | Internet |
| Other subnets (no gateway) |
The big clue: If ipconfig shows an address starting with 169.254, the problem is almost always DHCP failed. Look at the router, the cable, the Wi-Fi password, and the DHCP server, not at DNS or the internet.
Windows tip: The network icon in the taskbar may show "No internet" or a yellow warning when you have a 169.254 address.
ipconfig /allusually saysAutoconfiguration IPv4 Addressin that case, which is the Windows name for APIPA.
IPv6 note: IPv6 has its own link-local addresses beginning with fe80::. Every adapter normally has one, even on a healthy network. That is normal and not an error.
Summary
| Term | Plain meaning |
|---|---|
DHCP Client (Dhcp) | The service that asks for and renews your network settings |
| Lease | A rented address, valid for a time |
| Renew | Ask to keep the address (starts at about half the lease) |
ipconfig /all | Shows DHCP server, lease obtained and lease expires |
ipconfig /release and /renew | Drop and re-request the lease; briefly disconnect |
| APIPA | Self-picked fallback address, 169.254.x.x, local only |
| 169.254.x.x | Sign that DHCP did not answer |