Cyberlium

Networking › Module 2 › Lesson 4

BeginnerModule 2Lesson 4/5

Public vs Private IP

RFC1918 private ranges, NAT, and how home and enterprise networks reach the internet

15 min+24 XP3 quiz
Module progress4 of 5

Opening

ip addr and "what is my IP" are answering different questions.

Your laptop on home Wi-Fi probably shows 192.168.something in ip addr. A browser site titled "what is my IP" shows a different number — the address the internet saw. Both can be true. One is private (RFC1918), local to your LAN. The other is public, or at least the address after NAT. Defenders who mix them up write the wrong firewall object, dox the wrong host, or think a private address is a password. You will learn the three reserved ranges, NAT as many-to-one (a preview of Module 5), CGNAT, and how to inventory YOUR private address without treating it as a credential — and without pasting an internal map on the public internet.

1. RFC1918 is reserved so the internet will not route it as a destination

IPv4 private space is defined in RFC1918 so organizations can number internal hosts without asking a registry for a unique public block for every printer. Three ranges: 10.0.0.0/8 (10.0.0.0–10.255.255.255) — huge, common in enterprises and cloud VPCs. 172.16.0.0/12 (172.16.0.0–172.31.255.255) — note it is not all of 172.0.0.0/8; 172.15 and 172.32 are not in this reservation. 192.168.0.0/16 (192.168.0.0–192.168.255.255) — home routers and labs. Packets with these destinations are not meant to be forwarded across the public internet. If they leak as a source without NAT, many providers will drop them as martians.

Private is not "secret." It is "not globally unique and not globally routable." Two companies can both use 10.0.0.0/8. That is why VPNs and overlapping RFC1918 blocks hurt. It is also why you must not treat 10.1.1.5 as a password: millions of networks own that pattern. Operational caution still applies: do not paste a full internal diagram (subnet plan, jump hosts, naming) into a public gist. That is topology disclosure, not because 10/8 is cryptographically sensitive.

Public IPv4 is the rest of unicast space that registries assign and that default-free routers know how to reach (plus specials you already met: loopback 127/8, documentation 192.0.2.0/24, etc.). A home ISP used to hand your router a public address. Many now put you behind CGNAT (carrier-grade NAT): your router's WAN address is itself private (often 100.64.0.0/10, RFC6598 shared space), and the ISP NATs many customers onto one public IP. Then "what is my IP" is even further from ip addr — there may be two translation layers.

2. NAT many-to-one: why the website disagrees with ip addr

Network Address Translation, in the common home/enterprise outbound form, rewrites the source of packets as they leave. Many private hosts share one public (or CGNAT) address. The router stores a table: inside 192.168.1.50:54321 maps to public 203.0.113.9:40000 (example). Return packets hit that public IP and port; the router rewrites them back to the laptop. From the outside, the household is one IP. That is many-to-one (NAPT / PAT). Module 5 goes deeper on NAT and firewalls; here you only need the mismatch: local inet ≠ internet-visible source.

That mismatch is why SOC attribution is hard. A public IP in a log may be an ISP NAT pool, a VPN egress, a cloud load balancer, or a coffee shop. It is not a home address you can knock on. Conversely, seeing 192.168.1.50 in an internal log is useful inside that LAN and meaningless as a global locator. Port forwarding (or a firewall DNAT) is the reverse hole: map one public port to one internal host. It is how game servers and cameras get exposed — and how accidental exposure happens. NAT is not a substitute for host firewalls; it is a rewriting trick that also happens to hide inbound paths until you punch them.

How to observe the split safely: ip addr (or ip -br addr) on YOUR machine shows private (or rarely a real public) on the NIC. ip route shows the default via — usually the CPE/router. A "what is my IP" site shows whatever source address arrived at that site after NAT. You do not need to run scanners. You do not need to publish either number. If you check a public-IP site, use a page you already trust; you are making an outbound web request, not attacking anyone. Prefer documenting the disagreement in lab notes over pasting results in public.

3. Wrong vs right: treating RFC1918 as a credential or as "unhackable"

Worked failure mode — home LAN versus the internet. Stay on addresses you already have:

  • Wrong

    You put 192.168.1.14 in a password vault and refuse to tell IT, or you dump the whole 10.0.0.0/8 host map on Twitter. Or you assume private IPs cannot be reached so Windows updates and host firewalls are optional. Or you nmap 192.168.0.0/16 "because it is private so it must be mine" on cafe Wi-Fi.

  • Right

    Classify YOUR inet from ip addr as RFC1918 or not. Expect a website to show a different public/CGNAT view. Private ≠ secret password, and private ≠ permission to scan whatever LAN you sat down on. Do not paste internal maps publicly. NAT is many-to-one, not invisibility.

4. Practical: classify YOUR inet; notice it is not the internet's view

Read ip -br addr and ip route on a host you own. Circle whether the non-lo IPv4 sits in 10/8, 172.16/12, or 192.168/16. That is the private side. You already know loopback is neither public nor RFC1918 LAN.

Command guide

Private vs loopback on your VM / WSL only

YOUR machine — classify, do not sweep

Command — copy this

ip -br addr
ip addr
ip route

Is non-lo inet in RFC1918? 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 (not all of 172.x) 192.168.0.0/16 192.168.0.0 – 192.168.255.255

127.0.0.1 is loopback, not "the house public IP" A "what is my IP" website (if you choose a trusted one) is NAT's view, not ip addr

NEVER: nmap cafe/school 192.168.0.0/16 because "private means mine" NEVER: paste a full internal subnet map on a public forum

Mission: RFC1918 check plus the NAT mismatch in one sentence

1) On your own VM or WSL, run ip -br addr. Write whether your non-lo IPv4 is in 10/8, 172.16/12, 192.168/16, or something else. 2) Write one sentence: "ip addr is this interface; a public what-is-my-IP site is the address after NAT/CGNAT." 3) Write: private is not a password, and I will not paste an internal map publicly. Do not scan other LANs.

Stuck? Ask Cyberlium AI Mentor

If 172.32.0.1 looks "private because it starts with 172," ask Cyberlium AI Mentor for a hint — not a scan. Try: "Hint only: why is 172.16/12 not the same as all 172.x, and why would ip addr still differ from a website?"

You numbered IPv4, sliced it with CIDR, met IPv6, and now you can split private RFC1918 from the address the internet sees after NAT or CGNAT. Next up — Quiz — IP Addressing — ten APPLY scenarios on bits, masks, v6, and whether a number in a log is a person, a LAN, or a NAT pool.

Knowledge Check

1

APPLY: ip addr on a cafe laptop shows 10.12.3.88/16. A "what is my IP" site shows 203.0.113.40. What is the best explanation?

Multiple choice

Knowledge Check

2

APPLY: Which address is inside RFC1918 172.16.0.0/12, and which is a trap?

Multiple choice

Knowledge Check

3

APPLY: True or False: Sitting on a 192.168.0.0/24 cafe Wi-Fi means you own that subnet and may nmap it, because RFC1918 cannot be someone else's network.

True or False

← Previous

Answer all 3 knowledge checks to continue. (0/3 answered)