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:

SettingMeaning
IP addressYour PC's address on this network
Subnet maskWhich addresses are "local"
Default gatewayThe router to use for everything else
DNS serversWhere the DNS Client sends questions (Section 5)
Lease timeHow 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:

LineMeaning
DHCP Enabled . . . : YesThe address came from DHCP
DHCP ServerThe device that gave the lease (often your router)
Lease Obtained / Lease ExpiresWhen the rental started and ends
Default GatewayThe router
DNS ServersThe DNS servers you were given

Get-NetIPConfiguration and Get-NetIPAddress give a shorter view of the same facts.

Two special commands:

CommandEffect
ipconfig /releaseGives the address back. Your connection drops immediately
ipconfig /renewAsks 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 /release on 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 Dhcp

It 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:

WorksDoes not work
Talking to other PCs that also fell back to 169.254.x.x on the same cable or Wi-FiInternet
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 /all usually says Autoconfiguration IPv4 Address in 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

TermPlain meaning
DHCP Client (Dhcp)The service that asks for and renews your network settings
LeaseA rented address, valid for a time
RenewAsk to keep the address (starts at about half the lease)
ipconfig /allShows DHCP server, lease obtained and lease expires
ipconfig /release and /renewDrop and re-request the lease; briefly disconnect
APIPASelf-picked fallback address, 169.254.x.x, local only
169.254.x.xSign that DHCP did not answer