Lesson 5 of 6 · 10 min
Public vs private IP addresses and NAT
Follow a packet from your laptop to a website. Meet private IPv4 ranges, shared public addresses, and the router’s translation table.
By Calxo AI · Updated
Your laptop and a website disagree. Both can be right.
Your Wi-Fi settings say 192.168.1.10. A website that reports your IP address shows something else. Has your laptop forgotten its own address?
No. You are looking at the connection from two different places. Inside your home, the laptop uses a private address. In a typical IPv4 home network, the router translates outgoing traffic so it can share an Internet-facing address with your phone and other devices.
Think of an office with desk extensions and a main telephone number. The extensions make sense inside the office; the outside caller sees the main number. It is a useful starting picture, though a router tracks network connections rather than telephone calls.
Laptop: 192.168.1.10
Phone: 192.168.1.20
LAN: 192.168.1.1
Outside: 203.0.113.9*
Source: 203.0.113.9*
The router keeps the map
Three private ranges, many separate networks
RFC 1918 sets aside three IPv4 blocks for private networks. Separate homes and organisations can reuse them. Your laptop and a friend’s laptop can both be 192.168.1.10 because they are on different networks. Two interfaces using that address on the same LAN would usually create a conflict.
| Block | First address | Last address |
|---|---|---|
10.0.0.0/8 | 10.0.0.0 | 10.255.255.255 |
172.16.0.0/12 | 172.16.0.0 | 172.31.255.255 |
192.168.0.0/16 | 192.168.0.0 | 192.168.255.255 |
The 172 range is the sneaky one: 172.16 through 172.31, not every address beginning with 172. Also, 192.168.0.0/16 is the whole reserved private block; your home might use only 192.168.1.0/24 from it. If slash notation needs a refresh, visit the CIDR lesson.
“Not private” does not automatically mean “public”
Public unicast addresses can be globally routed when properly allocated and advertised. Having one does not guarantee that a service is reachable: routing and firewall rules still decide whether traffic gets through.
There are other categories too. 127.0.0.1 is loopback, used to reach your own device. 169.254.0.0/16 is link-local. The 203.0.113.0/24 and 198.51.100.0/24 ranges in our diagrams are documentation space. These are outside RFC 1918, but they are not ordinary globally reachable public addresses.
Private addresses are not globally unique and should not be routed across the public Internet. They can still communicate across deliberately connected private networks, such as through a VPN. “Private” describes the address’s scope; it is not a promise of encryption or anonymity.
Follow one connection through NAT
NAT means Network Address Translation. The many-devices-sharing-one-address version commonly used at home also translates transport ports. It is called NAPT (Network Address Port Translation), often PAT.
A port is a numbered endpoint used by a transport protocol such as TCP or UDP. An address gets the packet to the host; the transport information helps the host identify the right conversation. Our example uses TCP and destination port 443 for HTTPS.
- The laptop starts a TCP connection from
192.168.1.10:51514to our pretend website at198.51.100.20:443. - The router changes the source to
203.0.113.9:62001and remembers the translation. The website destination stays the same. - The website replies to
203.0.113.9:62001. - The router finds the connection state, restores destination
192.168.1.10:51514, and sends the reply onto the home network.
192.168.1.10:51514 → 198.51.100.20:443203.0.113.9:62001 → 198.51.100.20:443198.51.100.20:443 → 203.0.113.9:62001198.51.100.20:443 → 192.168.1.10:51514But what if the phone picks the same port?
It can. A phone at 192.168.1.20 may also choose source port 51514 while talking to the same server. The router can give it a different external port:
| Device | Internal source | Translated source |
|---|---|---|
| Laptop | 192.168.1.10:51514 | 203.0.113.9:62001 |
| Phone | 192.168.1.20:51514 | 203.0.113.9:62002 |
The reply to 62002 goes to the phone’s mapping. The outside IP address is shared, but the connections remain distinguishable. Real devices track protocol and connection state; mapping and filtering policies vary. This little table is a teaching model, not a complete router implementation.
Sometimes there is another translator upstream
Your provider may share a public IPv4 address across customers using carrier-grade NAT, or CGNAT. RFC 6598 reserves 100.64.0.0/10 for shared address space: 100.64.0.0 through 100.127.255.255. It is distinct from RFC 1918 private space.
- Home LAN: laptop 192.168.1.10
- Home router NAT: example WAN address 100.64.12.3
- Provider NAT: shared public-side address, represented here by 203.0.113.9
- Website: sees the final translated source
If your router’s WAN address and a website’s reported address differ, upstream NAT is one possibility. A VPN, proxy, or comparing IPv4 with IPv6 can also explain the mismatch. A 100.64/10 WAN address is a clue, not a complete diagnosis.
Translation, security, and privacy have different jobs
NAT does not encrypt your traffic. HTTPS provides encryption for the web connection. A firewall controls permitted traffic. A home router often provides NAT and a stateful firewall together, which makes their roles easy to mix up.
An unsolicited inbound connection usually needs an explicit mapping or another traversal mechanism in this setup, but do not treat NAT as a complete security policy. Port forwarding changes reachability, and provider NAT may prevent a home-router forward from working by itself.
Sharing an outside address also does not make you anonymous: websites can use accounts, cookies, and other signals. And this is an IPv4 lesson. IPv6 often uses globally scoped device addresses without this many-to-one translation; firewall policy still matters.
A small experiment, no router changes needed
Use the walkthrough below to switch between laptop and phone. Watch what changes on the outward journey, then what changes on the reply. The destination website stays put; the home router translates the home-side endpoint.
Keep three questions separate: What kind of address is it? What translation happened? What traffic is allowed? Answering one does not automatically answer the other two.
Try it · Follow the reply
NAT packet walkthrough
Choose a device, then follow one TCP connection through the router. Addresses on the Internet side are documentation placeholders.
At your device
- TCP source
- 192.168.1.10:51514
- TCP destination
- 198.51.100.20:443
The device starts a connection to the website. Its private source address is still present.
Teaching example: one router, no VPN or proxy, two active mappings to the same TCP server. Actual port selection, mapping behaviour, and timeouts vary. This shows header translation, not decryption of HTTPS content.
Check your understanding
Choose an answer for every question, then check your work. You can retry as often as you like.
Sources and scope
This lesson explains IPv4 address scope and illustrative TCP NAT mappings. Documentation addresses stand in for live public endpoints. Real routing, mapping, filtering, and provider behaviour depend on the network.
- RFC 1918 — Private IPv4 ranges
- RFC 3022 — NAT and address/port translation
- RFC 6598 — Shared address space for carrier-grade NAT
- RFC 5737 — Documentation-only example addresses
- IANA — IPv4 special-purpose address registry