Private IPs, NAT and DHCP
Level 2 · Addresses and ports
Why your laptop has a private address and your home has one public one. How NAT shares that address, and how DHCP hands out the rest.
Course contentsLesson 4 of 13
Level 1 · Networks and packets
Level 2 · Addresses and ports
Level 3 · How data travels
Level 4 · HTTP, the language of the web
Level 5 · Locked lines and go-betweens
After this lesson you can
- Tell a public from a private IP address
- Explain how NAT lets a home share one address
- Say what DHCP does when a device joins
12 mincovers 4 glossary entries
Worth reading first: IP Addresses and Subnets
How a whole home shares one address
A public IP address is one the whole internet can reach. Only one device may use it at a time. A private IP address only works inside a local network. Most homes get one public address from their provider. Every device inside gets a private one, and the router shares the public one between them.
Three blocks of addresses are set aside as private. They start with 10, with 172.16 to 172.31, and with 192.168. Any home or office may use them, and millions do at once. Routers on the internet will not carry them, so they never clash.
NAT, or network address translation, is how the sharing works. When your laptop sends a request out, the router swaps the private address for the public one and notes who asked. When the answer comes back, it swaps the address back and hands it to the laptop.
NAT has a side effect. A stranger on the internet cannot start a talk with your laptop, because the router has no note saying who should get it. That blocks a lot of unwanted traffic. It also means a server at home needs a rule in the router before anyone outside can reach it.
DHCP is the service that hands out the private addresses. When a phone joins the Wi-Fi, it asks for an address, and the router gives one from its block for a set time, often a day. It also tells the phone where the router is and which service to ask about names.
Servers usually skip DHCP. A server that moved to a new address every few days would be hard to find. So it gets a fixed address, either typed into the server or saved in the router for that machine.
People often think their public address is fixed. On most home plans it can change now and then, for example after the router restarts. That is fine for browsing, and a problem for hosting a site at home. Hosting providers give servers a public address that stays put.
Worked example
A family of four online at once
A family has two laptops, two phones and a TV. The router hands them 192.168.1.10 to 192.168.1.14 as they join.
All five stream and browse at the same time. Every website they visit sees only the family's one public address, 203.0.113.7.
The words for this lesson4
Check yourself
Why can millions of homes all use the address 192.168.1.10?
Finished this lesson?
Marking it complete also marks its 4 glossary entries learned, which updates your roadmap and your saved page. 0 are already marked.