Public vs private IP addresses, NAT and CGNAT explained

How public and private IPs differ, how NAT lets a household share one address, why NAT type matters for games, what CGNAT breaks, and how to get a public IP.

Popo
On this page

What is an IP address? covered the basics: a public address is unique on the whole internet, a private address only works inside a local network such as your home or office, and your router uses NAT to send everyone at home out through one public address. This article goes further: how NAT actually works, the trouble it causes, and what changes when your ISP adds a second layer of NAT.

The three private ranges

IPv4 sets aside three ranges that any local network can use freely, and routers on the internet won't forward packets addressed to them:

RangeAddressesTypical use
10.0.0.0/8About 16.8 millionCorporate networks, ISP internals
172.16.0.0/12About 1 millionCorporate networks, containers and VMs
192.168.0.0/1665,536Home routers

On top of these, 100.64.0.0/10 is reserved for carrier-grade NAT, and it isn't public either. For what the number after the slash means, see CIDR notation explained.

Since anyone can use these ranges, different networks often clash. If your home network is 192.168.1.x and so is your office network, then once you're on the office VPN from home, your computer can't tell whether 192.168.1.10 means a device at home or at work. Moving your home router to a less common range, such as 192.168.37.x, fixes it.

Home · 192.168.1.0/24

Your NAS192.168.1.10
Wi-Fi
Your laptopOn home Wi-Fi and the company VPN
VPN

Company, over VPN · 192.168.1.0/24

File server192.168.1.10

Open 192.168.1.10: which one?

Both sides are 192.168.1.0/24. Your computer's routing table ends up with two identical routes and can only use one, so devices on the other side become unreachable.

Can websites see your private address? Your browser's WebRTC feature used to hand private addresses straight to web pages. Mainstream browsers now replace them with a random name ending in .local by default. To see what a web page can get through WebRTC, press F12 to open the developer tools and paste these lines into the Console:

Browser console
const pc = new RTCPeerConnection();pc.createDataChannel('');pc.onicecandidate = (e) => e.candidate && console.log(e.candidate.candidate);void pc.createOffer().then((offer) => pc.setLocalDescription(offer));candidate:1053123806 1 udp 2113937151 f6ebde4d-174f-472a-9f9b-6a3bfd439260.local 61196 typ host generation 0 ufrag xNqR network-cost 999candidate:2833343421 1 udp 2113939711 a0a2842a-2423-4c21-a94c-48dd668bd00e.local 51219 typ host generation 0 ufrag xNqR network-cost 999

That's Chrome with default settings (November 2026). Each line is a candidate address; typ host means the device's own network interface, and in place of the address there's a random .local name, not 192.168.x.x. The two lines are for IPv4 and IPv6. If a real private address shows up here, your browser has this protection turned off. The WebRTC leak test runs the same check and also looks for exposed public addresses.

How NAT keeps track of who's who

If everyone at home shares one public address, how does returning traffic find the right device? Through ports. Every connection has a port number as well as an address. When the router sends a packet out, it rewrites the source address and port and writes the mapping down in a table (address:port):

PrivatePublic
192.168.1.23:51000203.0.113.45:40001
192.168.1.8:51000203.0.113.45:40002

The phone and the laptop happened to use the same port, 51000, so the router gave them different public ports. When a website replies to 203.0.113.45:40002, the router looks it up, sees it's the laptop's connection, rewrites it back to 192.168.1.8:51000 and passes it in.

Entries only get created when you start a connection. If someone outside connects to 203.0.113.45 out of the blue, the router has no entry and no idea where to send it, so it drops the packet. That's why devices behind NAT can't be reached directly from outside.

NAT type: why it matters for online games

Online games and video calls often want two users to connect directly instead of going through a server. When both are behind NAT, they first use a server to learn each other's public address and port, then both send packets to each other at once to "punch a hole". Whether that works depends on how each NAT behaves:

  • Some NATs use the same public port for a given private port no matter where the connection goes, so outsiders can get through fairly easily.
  • Others pick a new public port for every new destination, so the port learned through the server is useless to anyone else and hole punching rarely works. This is called symmetric NAT, and carrier-grade NAT is often this kind.

Endpoint-independent

  • 192.168.1.8:51000203.0.113.45:40001To server A
  • 192.168.1.8:51000203.0.113.45:40001To server B

Same public port for every destination. Others can reach you on the port the server saw: hole punching works.

Symmetric

  • 192.168.1.8:51000203.0.113.45:40001To server A
  • 192.168.1.8:51000203.0.113.45:40002To server B

A new public port for each destination. The port the server saw is useless to anyone else: hole punching usually fails.

The same computer, from the same private port, connects to two servers in turn. In hole punching, the server tells the other side the port it saw; a symmetric NAT used a new port for the new destination, so the other side's connection to the old port is dropped.

Game consoles report the result as a NAT type: Xbox shows Open, Moderate or Strict, and PlayStation shows Type 1, 2 or 3. The stricter it is, the fewer players you can connect to directly, the slower matchmaking gets, and the more often traffic has to be relayed through a server, which adds latency.

Port forwarding and UPnP

To let outsiders reach a device at home directly, such as a NAS, a game console or a site you host yourself, set up port forwarding on your router: a fixed rule that sends a port on your public address to a private address and port.

Many routers also support UPnP, which lets consoles and download apps request port forwarding automatically, often improving your NAT type without any manual setup. But any program can use it to open ports on your router, malware included, so turn it off if you don't need it.

Both only work if your router has a real public address.

With a public IP: forwarding works

Someone outside
203.0.113.45:8443
Your routerRule: 8443 → NAS 443
NAS192.168.1.20:443

Behind CGNAT: forwarding never gets a chance

Someone outside
203.0.113.45:8443
ISP’s NAT gatewayNo rule for you; the connection is dropped
Your router100.64.12.34Has the rule, but traffic never arrives
Top: the rule is on your router, and outside connections reach it. Bottom: outside connections hit your ISP's gateway first, which has no rule for you, so the rule on your own router never gets used.

Carrier-grade NAT: a second layer

Because IPv4 addresses ran out, many ISPs no longer give each household a public address. They add another layer of NAT inside their own network so that many households share one public address. This is carrier-grade NAT (CGNAT), and every connection goes through two translations:

WhereAddress seen
Your computer192.168.1.8
Your router's internet side100.64.12.34
The ISP's NAT gateway203.0.113.45

Many ISPs give each customer a block of public ports and log which customer used which ports on which public address at what time, so they can trace traffic when required. Mobile data almost always works this way, and it's increasingly common on home broadband.

Behind CGNAT:

  • Port forwarding stops working. You can only set up forwarding on your own router. You have no control over the ISP's layer, so outsiders still can't get in.
  • Games and direct connections get harder. Carrier-grade NAT is usually symmetric, and consoles typically report a strict NAT type.
  • You share a reputation. If someone else behind the same public address sends spam or hammers an API, and a site blocks or challenges the address, you're affected too; see Residential, mobile and datacenter IPs.
  • Your location may be off. CGNAT gateways sit in a few cities, so addresses get located there.

The Shared devices field in a CKIP lookup estimates how many devices are using an IP at the same time. Addresses behind CGNAT usually show higher numbers than ordinary home broadband.

How to tell if you're behind CGNAT

The most reliable test is to compare two addresses: the WAN address in your router's admin page and the IPv4 address websites see. If they match, you have your own public address. If the WAN address is between 100.64.0.0 and 100.127.255.255, or a private address such as 10.x.x.x, you're behind CGNAT. The last section of What is an IP address? walks through the steps.

If you can't easily log in to your router, look at the first few hops of a traceroute. Windows:

Command Prompt
tracert -d -h 4 ckip.net

macOS and Linux:

Terminal
traceroute -n -m 4 ckip.net

The first hop is your own router. If the next one is an address starting with 100.64 to 100.127, you're most likely behind CGNAT. ISPs also use 10.x addresses for their own equipment, though, so a 10.x hop alone isn't proof; the WAN address comparison is the real test.

Another common setup is double NAT at home: the ISP's modem is in router mode and your own router is plugged in behind it. Port forwarding then has to be set up on both, or you can switch the modem to bridge mode and let your router dial the connection.

Getting a public IP

  • Ask your ISP. Some ISPs will switch your home connection to a public IPv4 address if you call support; others require a business plan or charge extra. The address is usually still dynamic; a fixed address normally means a business line.
  • Use IPv6. Many home connections already have public IPv6, so every device has its own public address and can be reached from outside once you allow it on the router's firewall; see IPv4 vs IPv6. The catch is that whoever connects needs IPv6 too.
  • Use a reverse tunnel. Your device at home connects out to a server that has a public address, and outside traffic goes to that server and back down the connection to your home. Cloudflare Tunnel and frp work this way, with no public IP needed.

① Your device connects out first

NAS at homeNo public IP needed
Outbound connection, kept open
Tunnel serverHas a public address (Cloudflare Tunnel, frp …)

② Visitors come back through that connection

Someone outside
Visits the server
Tunnel server
Forwarded back
NAS at home
What matters is that your home connects out first. NAT only blocks connections started from outside, not ones you start, so even two layers of NAT don't get in the way.