DHCP Explained: How Your Device Gets Its Address
0 / 6 steps
The goal
By the end you will know what DHCPIn plain words: The front desk of your network. When a phone or laptop joins, DHCP hands it an address, like a hotel handing you a room key, so nobody types it in by hand.Technical: Dynamic Host Configuration Protocol. A service, normally on your router, that leases each device an IP address, subnet mask, gateway and DNS server automatically.Click for the full glossary entry is in plain words, have found the settings it gave your own computer, understood the four-message conversation called DORAIn plain words: The four-step chat a device has to get an address: it asks, an offer comes back, it says yes, and the server confirms.Technical: Discover, Offer, Request, Acknowledge: the four DHCP messages, sent over UDP ports 68 (device) and 67 (server).Click for the full glossary entry, and (if you want) watched that conversation happen in Wireshark.
Your own computer only. Steps 1 to 3 only read information. Step 4 briefly drops and restores your own connection, so skip it on a shared or work computer, or while someone is on a video call. On a Mac, see the Mac page for the equivalent commands.
DHCP in one minute
Every device on a network needs an address, like every room in a hotel needs a number. Typing one in by hand on every phone, TV and laptop would be a nightmare. DHCP is the front desk: when a device joins, it asks, and the front desk hands it an address from a pool, plus the other details it needs to get online. The address is only lent for a while, which is called a lease. Your home router almost certainly does this job.
Words in this lesson
Hover (or tap and hold) a dotted word for a quick definition. Every word is also in the StashGrid glossary.
- DHCP — the service that hands out addresses automatically
- DORA — Discover, Offer, Request, Acknowledge
- Lease — how long a device may keep an address before renewing
- IP address — the number that identifies a device on a network
- Default gateway — the router your device sends outside traffic to
- DNS — turns names like stashgrid.ai into numbers
- 169.254 address — what Windows invents when DHCP does not answer
Why this lesson. When someone says “my internet is not working” and the Wi-Fi shows connected, the cause is often DHCPIn plain words: The front desk of your network. When a phone or laptop joins, DHCP hands it an address, like a hotel handing you a room key, so nobody types it in by hand.Technical: Dynamic Host Configuration Protocol. A service, normally on your router, that leases each device an IP address, subnet mask, gateway and DNS server automatically.Click for the full glossary entry: the device joined the network but never got an address. Knowing how the handout works tells you what to check.
DHCP is the only network protocol with a perfectly good hotel analogy, so I will allow it. Do not push your luck with the rest. — Nyx
Before you start. You need a Windows computer and a command prompt. Steps 1 to 4 use nothing else. Step 5 is optional and uses WiresharkIn plain words: A free tool that lets you watch the actual messages travelling over your network, like a window onto the mail room.Technical: A packet analyser that captures traffic on an interface and decodes it by protocol.Click for the full glossary entry; if you have not used it yet, do Lab 12 first. Subnet masks and private addressesIn plain words: An address used inside your home or office only, like an apartment number: many buildings reuse the same ones.Technical: Reserved ranges: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Not routable across the internet.Click for the full glossary entry are explained in the subnetting lesson.
Steps
01See what DHCP gave you
> ipconfig /all
The output is long. Find the section for the connection you are using (Wi-Fi or Ethernet) and read these lines:
- DHCPIn plain words: The front desk of your network. When a phone or laptop joins, DHCP hands it an address, like a hotel handing you a room key, so nobody types it in by hand.Technical: Dynamic Host Configuration Protocol. A service, normally on your router, that leases each device an IP address, subnet mask, gateway and DNS server automatically.Click for the full glossary entry Enabled: Yes — your address came from DHCP rather than being typed in.
- IPv4 AddressIn plain words: A device’s street address on a network: four numbers separated by dots, like 192.168.1.37.Technical: A 32-bit number (IPv4), written as four octets. It combines which network the device is on and which device it is on that network.Click for the full glossary entry and Subnet MaskIn plain words: A number that tells a device which part of an address is the street (the network) and which part is the house number (the device).Technical: A 32-bit pattern of ones then zeros, written like 255.255.255.0. Ones mark the network part, zeros the device part.Click for the full glossary entry — what you were given.
- Default GatewayIn plain words: The door out of your network. It is your router.Technical: The router address your device sends traffic to when the destination is not on its own subnet. At home, often 192.168.1.1.Click for the full glossary entry — your routerIn plain words: The box that connects your home to the internet and passes data between networks.Technical: Forwards packets between networks. At home it is usually also the Wi-Fi access point and the DHCP server.Click for the full glossary entry.
- DHCP Server — who gave you the address. At home this is usually your router, such as 192.168.1.1.
- DNSIn plain words: The internet’s phone book. You type an easy name like stashgrid.ai, and DNS looks up the number address that computers really use, the way a street address tells the mail carrier where to go.Technical: Domain Name System. A worldwide set of servers that turns names into IP addresses. Your device asks a DNS server (usually your router or your provider) every time you visit a site.Click for the full glossary entry Servers — where your computer asks “what number is this name?”
- LeaseIn plain words: An address that is lent to you for a while, like a library book you have to renew.Technical: The time a DHCP server lets a device keep an address before it must renew. Home routers often use hours to a day.Click for the full glossary entry Obtained and Lease Expires — when you got it and when you must renew.
Why this matters. Five things you never typed in, all delivered by one conversation. This is the screen a technician checks first when a device cannot get online.
02Learn the four messages: DORA
When a device joins the network it has no address, so it has to shout to everyone. The conversation always goes in the same four steps, which spell DORAIn plain words: The four-step chat a device has to get an address: it asks, an offer comes back, it says yes, and the server confirms.Technical: Discover, Offer, Request, Acknowledge: the four DHCP messages, sent over UDP ports 68 (device) and 67 (server).Click for the full glossary entry:
- D — Discover. The device broadcasts: “Is there a DHCPIn plain words: The front desk of your network. When a phone or laptop joins, DHCP hands it an address, like a hotel handing you a room key, so nobody types it in by hand.Technical: Dynamic Host Configuration Protocol. A service, normally on your router, that leases each device an IP address, subnet mask, gateway and DNS server automatically.Click for the full glossary entry server out there? I need an address.”
- O — Offer. A DHCP server answers: “Here, you can have 192.168.1.37.”
- R — Request. The device replies: “Yes please, I will take 192.168.1.37.” (It asks formally in case more than one server made an offer.)
- A — Acknowledge. The server confirms: “It is yours for the next so many hours.”
This happens over two fixed doors called ports: devices listen on UDP port 68 and servers on UDP port 67. You do not need to remember the numbers for daily use, but the exam likes them.
Why this matters. If you know the four steps, you can tell exactly where a failure happens. “Discover goes out, no Offer comes back” means no DHCP server is answering.
03Understand leases, reservations and static addresses
The address is lent, not given. When half the leaseIn plain words: An address that is lent to you for a while, like a library book you have to renew.Technical: The time a DHCP server lets a device keep an address before it must renew. Home routers often use hours to a day.Click for the full glossary entry is used up, your device quietly asks to renew it, and the server almost always says yes. If a device leaves the network and the lease runs out, the address goes back in the pool for someone else.
- Dynamic — the normal case. Addresses come from a pool and may change.
- Reservation — you tell the routerIn plain words: The box that connects your home to the internet and passes data between networks.Technical: Forwards packets between networks. At home it is usually also the Wi-Fi access point and the DHCP server.Click for the full glossary entry “always give this device this address.” The device still uses DHCPIn plain words: The front desk of your network. When a phone or laptop joins, DHCP hands it an address, like a hotel handing you a room key, so nobody types it in by hand.Technical: Dynamic Host Configuration Protocol. A service, normally on your router, that leases each device an IP address, subnet mask, gateway and DNS server automatically.Click for the full glossary entry, but gets the same address every time. Good for printers and servers.
- Static — you type the address into the device yourself, and DHCP is not involved. Fine for network gear, risky if two devices end up with the same one.
Why this matters. “The printer stopped working” is very often “its address changed.” A reservation fixes that for good.
04Release and renew your address
You can ask for a fresh address on purpose. Your connection will drop for a few seconds. Do this one at a time, not in the middle of a call or on a work computer.
> ipconfig /release
Your address disappears (it becomes 0.0.0.0 and the internet stops). Then:
> ipconfig /renew
After a few seconds you get an address back, usually the same one. Run ipconfig /all again and compare LeaseIn plain words: An address that is lent to you for a while, like a library book you have to renew.Technical: The time a DHCP server lets a device keep an address before it must renew. Home routers often use hours to a day.Click for the full glossary entry Obtained: it has a new time.
Why this matters. This is the classic first fix for “connected, but no internet.” It forces the whole DORAIn plain words: The four-step chat a device has to get an address: it asks, an offer comes back, it says yes, and the server confirms.Technical: Discover, Offer, Request, Acknowledge: the four DHCP messages, sent over UDP ports 68 (device) and 67 (server).Click for the full glossary entry conversation to happen again.
05Optional: watch it happen in Wireshark
Open WiresharkIn plain words: A free tool that lets you watch the actual messages travelling over your network, like a window onto the mail room.Technical: A packet analyser that captures traffic on an interface and decodes it by protocol.Click for the full glossary entry and start a capture on the connection you are using (Lab 12 shows how). In the filter bar type dhcp and press Enter. (On older Wireshark versions the filter is bootp.)
Now go back to the command promptIn plain words: A window where you type instructions instead of clicking. The shortcut name is cmd.Technical: Windows’ text-mode shell (cmd.exe). PowerShell is a newer one. On a Mac the equivalent is Terminal.Click for the full glossary entry, run ipconfig /release, then ipconfig /renew. Return to Wireshark.
You should see up to four lines, named DHCPIn plain words: The front desk of your network. When a phone or laptop joins, DHCP hands it an address, like a hotel handing you a room key, so nobody types it in by hand.Technical: Dynamic Host Configuration Protocol. A service, normally on your router, that leases each device an IP address, subnet mask, gateway and DNS server automatically.Click for the full glossary entry Discover, DHCP Offer, DHCP Request and DHCP ACK. Click each one and expand Dynamic Host Configuration Protocol to see the address being offered and the leaseIn plain words: An address that is lent to you for a while, like a library book you have to renew.Technical: The time a DHCP server lets a device keep an address before it must renew. Home routers often use hours to a day.Click for the full glossary entry time. Depending on your routerIn plain words: The box that connects your home to the internet and passes data between networks.Technical: Forwards packets between networks. At home it is usually also the Wi-Fi access point and the DHCP server.Click for the full glossary entry and adapter you may see only the Request and ACK. If so, say so in your notes rather than assuming it is wrong: capture what your own machine actually does.
Check your own capture rather than assuming. Real networks are messier than diagrams. — Nyx
06When DHCP goes wrong: the 169.254 address
If Windows asks for an address and gets no answer, it gives itself one that starts with 169.254In plain words: The “I could not get a real address, so I made one up” address. You are connected but cannot get online.Technical: APIPA / link-local address. Windows assigns itself one in 169.254.0.0/16 when DHCP does not answer.Click for the full glossary entry. Run ipconfig: if you see 169.254.x.x, your computer joined the network but DHCPIn plain words: The front desk of your network. When a phone or laptop joins, DHCP hands it an address, like a hotel handing you a room key, so nobody types it in by hand.Technical: Dynamic Host Configuration Protocol. A service, normally on your router, that leases each device an IP address, subnet mask, gateway and DNS server automatically.Click for the full glossary entry did not answer.
- Restart the routerIn plain words: The box that connects your home to the internet and passes data between networks.Technical: Forwards packets between networks. At home it is usually also the Wi-Fi access point and the DHCP server.Click for the full glossary entry (unplug for 30 seconds), then plug back in and wait two minutes.
- Check the cable or reconnect to the Wi-Fi.
- Run ipconfig /renew.
- If many devices have the same problem, the router’s address pool may be full or its DHCP turned off. Log in to the router and check.
The attacker’s view. Because devices believe the first DHCP offer they hear, a fake DHCP server on the network can hand out a wrong gatewayIn plain words: The door out of your network. It is your router.Technical: The router address your device sends traffic to when the destination is not on its own subnet. At home, often 192.168.1.1.Click for the full glossary entry or DNSIn plain words: The internet’s phone book. You type an easy name like stashgrid.ai, and DNS looks up the number address that computers really use, the way a street address tells the mail carrier where to go.Technical: Domain Name System. A worldwide set of servers that turns names into IP addresses. Your device asks a DNS server (usually your router or your provider) every time you visit a site.Click for the full glossary entry, steering traffic through the attacker. This is called a rogue DHCP server.
The defender’s move. Managed switchesIn plain words: A little extra word after a command that changes how it works, like setting the oven to “fan.”Technical: An argument starting with - or / that modifies a command, for example the -d in tracert -d. Each command has its own list.Click for the full glossary entry have a feature called DHCP snooping that only trusts DHCP replies from the ports where the real server lives. It is a Security+ topic.
What you learned
- DHCP — automatically hands out addresses and settings
- DORA — Discover, Offer, Request, Acknowledge
- lease — an address is lent, not owned, and must be renewed
- ipconfig /all — shows what DHCP gave you and who gave it
- ipconfig /release and /renew — ask for a new address on purpose
- 169.254.x.x — DHCP did not answer
Read the official spec
In Wireshark (step 5), click a DHCP packet and expand Options. You will see the numbers below next to the values your computer was given.
- RFC 2131 — the DHCP protocol itself: the DORA messages, leases, and renewal attempts at 50% (T1) and 87.5% (T2) of the lease time
- RFC 2132 — the options a device receives, each with a number: 1 subnet mask, 3 router (default gateway), 6 DNS servers, 15 domain name, 51 lease time, 53 message type, 54 server identifier
- RFC 8415 — DHCPv6, the IPv6 version
- RFC 3927 — why Windows invents a 169.254 address when DHCP does not answer
Tried it? Tell us
Nova drafted this lesson from Steven’s ideas. If a step broke, looked different on your screen, or you know a simpler way, tell us. Screens change between Windows and Mac versions, so your menus may not match exactly.
NextIPv6 Explained: Why It Exists and Why We Still Use IPv4 Too→
Go deeper
- Subnetting without tears — what the mask and the slash mean
- Networking glossary — DHCP, DORAIn plain words: The four-step chat a device has to get an address: it asks, an offer comes back, it says yes, and the server confirms.Technical: Discover, Offer, Request, Acknowledge: the four DHCP messages, sent over UDP ports 68 (device) and 67 (server).Click for the full glossary entry, leaseIn plain words: An address that is lent to you for a while, like a library book you have to renew.Technical: The time a DHCP server lets a device keep an address before it must renew. Home routers often use hours to a day.Click for the full glossary entry and more
- Lab 12: your first Wireshark capture — the tool for step 5
Original walkthrough. The concepts and commands match Microsoft’s documentation; the WiresharkIn plain words: A free tool that lets you watch the actual messages travelling over your network, like a window onto the mail room.Technical: A packet analyser that captures traffic on an interface and decodes it by protocol.Click for the full glossary entry step has not yet been run end to end on every adapter type, which is why it says what you may see rather than what you will see. If something does not match what your computer does, tell me and I will fix it.