IP Addresses Explained: IPv4, IPv6, NAT and CGNAT
An IP address is the numeric label that lets packets find a device on a network. IPv4 uses 32-bit addresses (about 4.3 billion in total) and is kept alive by network address translation (NAT), while IPv6 uses 128-bit addresses and removes the shortage. NAT and IPv6 rarely change latency by much, but they affect which devices can accept incoming connections and how traffic is routed.
On this page
- What is an IP address?
- IPv4: the original format
- IPv6: the replacement
- Public, private and special address ranges
- What are subnets and CIDR notation?
- What is NAT and how does it work?
- What is CGNAT?
- Does IPv4 vs IPv6 affect latency?
- Worked examples
- How IP addresses show up in latency testing
- Common mistakes and myths
- What to do next
Quick answer: an IP address is a number that identifies a device or interface on a network so that packets can be delivered to it. There are two versions in use. IPv4 uses 32-bit addresses written as four numbers, like 198.51.100.7, and is short of supply, so most homes sit behind NAT (network address translation), which lets many devices share one public address. IPv6 uses 128-bit addresses written in hexadecimal, like 2001:db8:1::7, and has room for every device. Neither version is inherently faster; what changes your latency is the route the packets take, not the address format.
What is an IP address?
The Internet Protocol (IP) is the part of the internet that handles addressing and forwarding. Every packet carries a source IP address and a destination IP address in its header. Routers read the destination address and forward the packet toward it, hop by hop, as described in how the internet works. Without addresses there would be nothing to route on.
An address belongs to a network interface (a Wi-Fi card, an Ethernet port, a mobile modem), not strictly to a person or a computer. A laptop with both Wi-Fi and Ethernet active has two addresses. A server may have many. Addresses can be static (configured by hand and unchanging) or dynamic (leased automatically, usually through DHCP, the Dynamic Host Configuration Protocol). Residential public addresses are typically dynamic: they may change when the router restarts or after a lease expires, although many ISPs keep them stable for long periods.
IPv4: the original format
An IPv4 address is 32 bits, written as four decimal numbers from 0 to 255 separated by dots (each number is one byte, called an octet). The total number of possible addresses is 232 = 4,294,967,296, a little under 4.3 billion. A large part of that space is reserved for special uses and is not available as ordinary public addresses.
That number seemed enormous in the early 1980s. With billions of phones, computers, sensors and servers, it is not. The central pool of free IPv4 blocks held by IANA ran out in 2011, and the regional internet registries that hand addresses to ISPs have since exhausted or nearly exhausted their own free pools. Today, new IPv4 addresses are mostly obtained by transfer or purchase, which is expensive. Three things stretched the supply: NAT, more careful allocation, and the slow rollout of IPv6.
IPv6: the replacement
IPv6 uses 128-bit addresses, giving 2128 (about 3.4 × 1038) possible addresses. They are written as eight groups of four hexadecimal digits separated by colons, with two shortening rules: leading zeros in a group can be dropped, and one run of all-zero groups can be replaced by ::. So 2001:0db8:0000:0000:0000:0000:0000:0007 is written 2001:db8::7.
Typical features of IPv6:
- No shortage. An ordinary home connection is usually given a whole /56 or /64 block or larger. A single /64 holds 264 addresses, far more than the entire IPv4 internet.
- Little need for NAT. Each device can have a globally reachable address. A router's firewall, not address translation, decides what may connect in, and by default consumer routers block unsolicited incoming connections.
- Simpler header and no fragmentation by routers. Packets that are too large are not split by routers on the way, so the sender must adapt its packet size.
- Automatic configuration. Devices can build their own addresses (SLAAC) from the router's announcements, and DHCPv6 is also available.
IPv4 and IPv6 are separate networks that run side by side. Most devices and many ISPs run dual stack, with both. When a site is available over both, modern devices try IPv6 first and fall back to IPv4 within a fraction of a second if it fails, a method known as "Happy Eyeballs".
Public, private and special address ranges
Some ranges are reserved and never routed across the public internet. Knowing them helps you read what you see in settings and traceroutes.
| Range | Name | Used for |
|---|---|---|
| 10.0.0.0/8 | Private | Large internal networks, about 16.7 million addresses |
| 172.16.0.0/12 | Private | Internal networks, 172.16.x.x to 172.31.x.x |
| 192.168.0.0/16 | Private | Most home routers (often 192.168.0.x or 192.168.1.x) |
| 100.64.0.0/10 | Shared address space | Carrier-grade NAT inside ISP networks |
| 127.0.0.0/8 | Loopback | The device itself (127.0.0.1, "localhost") |
| 169.254.0.0/16 | Link-local | Self-assigned when DHCP fails; a sign of a configuration problem |
| fe80::/10 (IPv6) | Link-local | Local-link communication, always present on IPv6 interfaces |
| fc00::/7 (IPv6) | Unique local | Private IPv6 networks |
| 2000::/3 (IPv6) | Global unicast | Normal public IPv6 addresses (most begin with 2 or 3) |
Everything else in IPv4 that is not reserved is a public address, reachable (subject to firewalls) from anywhere. If a tool shows your address as starting with 192.168, 10. or 172.16 to 172.31, it is showing your private address, not the one websites see.
What are subnets and CIDR notation?
A subnet is a block of consecutive addresses that share the same leading bits and sit on the same local network. The prefix length after a slash says how many leading bits are fixed. This is called CIDR (Classless Inter-Domain Routing) notation. The remaining bits identify hosts.
| Prefix | Mask | Total addresses | Usable hosts (IPv4) |
|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 |
| /24 | 255.255.255.0 | 256 | 254 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
Two addresses in each IPv4 subnet are reserved: the first (the network address) and the last (the broadcast address). A device that wants to reach an address in its own subnet sends the packet directly; for any other address it sends the packet to its default gateway, normally your router.
What is NAT and how does it work?
Network address translation lets many private devices share a single public IPv4 address. Your router rewrites the source address of each outgoing packet from the private address to its own public one, and remembers the mapping so that replies can be sent back to the right device. In its common form, called port address translation (PAT), the router also uses different source port numbers to tell the connections apart.
A simplified translation table at a home router might look like this:
| Inside (private) | Outside (public) | Destination |
|---|---|---|
| 192.168.1.23:51000 | 203.0.113.9:40001 | 93.184.216.34:443 |
| 192.168.1.40:51000 | 203.0.113.9:40002 | 93.184.216.34:443 |
| 192.168.1.40:52344 | 203.0.113.9:40003 | 198.51.100.20:443 |
Two devices used the same local port, 51000, but the router mapped them to different public ports. A reply to 203.0.113.9:40002 is therefore sent to the second device.
Consequences of NAT
- Outgoing connections just work. Browsing, streaming and most apps are unaffected.
- Incoming connections are blocked by default. The router has no mapping for unsolicited packets. Hosting a game server or remote access requires port forwarding, UPnP or a relay service.
- Entries expire. Idle mappings are removed after seconds to minutes, which is why long-lived idle connections need keepalive messages.
- Latency impact is tiny. Rewriting a header takes microseconds on decent hardware. A noticeable delay points to an overloaded or low-quality router, not to NAT itself.
What is CGNAT?
When an ISP has too few public IPv4 addresses for all customers, it performs NAT on its own network, so that many homes share one public address. This is carrier-grade NAT (CGNAT), often using the 100.64.0.0/10 range between your router and the ISP. Mobile networks use it extensively, and some fixed-line providers do.
You can often tell you are behind CGNAT if your router's WAN address (shown in its admin page) differs from the public address websites report, or if it begins with 100.64 to 100.127. Effects include:
- Port forwarding does not work, because you do not control the outer translation.
- Some peer-to-peer games and calling apps report a "strict" NAT type or route through relay servers, which can add latency compared with a direct connection.
- Many users sharing one address may trigger CAPTCHAs or rate limits on some websites.
Asking the ISP for a public address or for IPv6 service are the usual remedies. See talking to your ISP for how to raise it.
Does IPv4 vs IPv6 affect latency?
The address format does not change how fast light travels in fibre. Differences observed between the two come from paths. Sometimes IPv6 traffic takes a more direct route, particularly where an ISP peers well over IPv6 and uses CGNAT for IPv4. In other cases the IPv6 path is newer, less optimised and a few milliseconds slower. Real-world measurements typically show the two within a small margin, with either one occasionally winning. Because devices choose IPv6 first when it works, you are often using it without knowing.
For gaming and calls, the practical differences are about reachability: IPv6 can make direct peer-to-peer connections easier because no NAT sits in the way, and CGNAT on IPv4 can force relays. See latency for gaming. How the networks choose paths is covered in routing, BGP and peering.
Worked examples
Example 1: Reading an address
Your phone shows 10.20.3.57 and a website shows your address as 203.0.113.9. The first is private (inside 10.0.0.0/8): it only means something on your local network. The second is the public address of your router or your carrier's NAT, and it is the one servers see in their logs.
Example 2: Do two devices share a subnet?
Device A is 192.168.1.23/24 and device B is 192.168.2.40/24. A /24 fixes the first three numbers, so A is in 192.168.1.x and B is in 192.168.2.x. They are on different subnets and must communicate via a router. If both used /16 (255.255.0.0), they would share 192.168.x.x and could talk directly.
Example 3: Counting addresses
A company with a /22 IPv4 block has 2(32-22) = 1,024 addresses, of which 1,022 can be assigned to hosts. If it has 3,000 devices, it needs private addressing and NAT, or a larger block. In IPv6, a single /64 subnet has 264 = 18,446,744,073,709,551,616 addresses, so counting is never the issue.
Example 4: Spotting a configuration failure
A laptop reports an address of 169.254.17.80. That is link-local, which a device assigns itself when it cannot get an address from DHCP. The laptop is connected to the network at the link layer but the router is not answering DHCP, so it will not reach the internet until that is fixed, usually by restarting the router or checking the cable or Wi-Fi password.
How IP addresses show up in latency testing
When you test latency, you reach servers at public IP addresses. Names resolve to addresses through DNS (see DNS explained), and a name can return different addresses to different users, which is how CDNs and anycast send you to a nearby server. In the GlobeLatency test, your own public IP address is used to approximate your location on the live map and is stored with a saved test report for abuse control and ISP information, as described in the site's privacy information. IP-based location is approximate and is often only accurate to city or ISP level, particularly on mobile networks, behind a VPN or with CGNAT.
Common mistakes and myths
- "My IP address is 192.168.x.x." That is your private address. The public one is what the internet sees.
- "IPv6 will make my connection much faster." It removes address shortages and NAT limitations, but it does not shorten the physical path.
- "NAT is a firewall." It blocks unsolicited incoming connections as a side effect, but it was not designed for security. A real firewall policy is separate, and IPv6 networks rely on it.
- "Changing my IP address will fix my ping." A new address may land you on a different route, but usually it does not change latency materially. Congestion or distance is the cause far more often.
- "An IP lookup shows exactly where someone lives." It shows an approximate location of the network, often only the city or the ISP's hub.
- "Disabling IPv6 is a safe speed trick." It can break some services and rarely speeds anything up.
What to do next
To see how addresses are turned from names, read DNS explained. To learn what happens once a packet has an address, continue to TCP and UDP explained and how the internet works. If online games report a strict NAT or you suspect CGNAT, check your router's WAN address and ask your provider about options. To see your real round-trip times to servers around the world, run a free latency test.
Frequently asked questions
What is my IP address?
Usually you have two. Your public IP address is the one websites see, assigned by your ISP and shared by every device behind your router. Your private (local) IP address, such as 192.168.1.23, identifies your device inside your home network and is not reachable from the internet. Many websites display your public address, and your device settings show the private one.
Is IPv6 faster than IPv4?
Not inherently. The protocol itself does not make packets travel faster. Differences you may see come from the route: some networks have a shorter or less congested IPv6 path, others the opposite. Typically the two give similar latency, often within a few milliseconds, and devices usually prefer IPv6 when it works.
What is CGNAT and why does it matter?
Carrier-grade NAT (CGNAT) means your ISP shares one public IPv4 address among many customers, using addresses in the 100.64.0.0/10 range inside its network. It works fine for browsing and streaming, but makes port forwarding and hosting impossible and can complicate some games, VoIP and peer-to-peer apps. It adds a small processing step, usually well under a millisecond.
Does NAT increase ping?
Only negligibly. A home router translating addresses typically adds well under a millisecond, and a carrier-grade NAT adds a similar small amount. A poor or overloaded router can add more through queuing, but that is a device-quality problem, not an effect of NAT itself.
Why did we run out of IPv4 addresses?
IPv4 has 2^32, about 4.29 billion, addresses, designed when only a few computers were expected to be online. Billions of phones, computers and servers later, the central pool of unallocated blocks ran out in 2011, and regional registries followed. NAT, address reuse and IPv6 stretched or replaced the supply.
Can someone find my location from my IP address?
Only roughly. Geolocation databases map public addresses to a country, region or city and the ISP, often accurately to city level for fixed lines and less accurately for mobile networks and VPNs. An IP address does not reveal your street address or your name to ordinary website visitors.
What is a subnet mask or prefix length?
It tells devices which part of an address identifies the network and which part identifies the host. A /24 (mask 255.255.255.0) keeps the first 24 bits for the network and leaves 8 bits for hosts, so 256 addresses, 254 usable. Devices on the same subnet talk directly; anything else goes through the router.