Compared
Public vs private IP address
A private address comes from three ranges anyone may use inside their own network: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. It is never routed on the internet. A public address is unique on the internet and reachable from it. Devices with private addresses reach the internet through NAT, behind a public one.
Side by side
| Public address | Private address | |
|---|---|---|
| Ranges | The rest of the assigned address space | 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 |
| Unique | Across the whole internet | Only inside one network: two homes can both use 192.168.1.10 |
| Routed on the internet | Yes | No |
| Handed out by | Your provider, from a regional registry's blocks | Whoever runs the network, usually its router's DHCP |
| Reaches the internet | Directly | Through NAT on a router that has a public address |
| Reached from the internet | Directly, where a firewall allows it | Only through a port forward on that router |
Each one explained
- Private addresses
- Address ranges any organisation may use inside, never routed on the internet: 10/8, 172.16/12, 192.168/16.
- IP address
- A device's address across networks: 32 bits, written as four numbers like 10.0.1.10.
- NAT
- A router rewriting addresses as packets pass, usually to hide many private devices behind one address.
- Port forward
- One port on the router's public address passed to one device and port inside.
See the difference on real machines
Each lab is a small network of real Linux machines in your browser.
- Public and private IP addresses: how two homes use one address
- NAT: share one public address across a whole building
- Port forwarding: let the internet reach one machine behind NAT
Open Public and private IP addresses: how two homes use one address