Sub topic 14
Shared address space (100.64.0.0/10) and carrier-grade NAT
This chapter assumes you know the three RFC 1918 private ranges, how a CIDR prefix defines a block, and the basic idea of NAT from the earlier chapters. It covers a fourth block that looks private but is not.
Why a fourth block exists
The RFC 1918 ranges are free for anyone to use inside their own network. Internet service providers (ISPs) ran into a problem as public IPv4 addresses ran out. They could not give every customer a public address. They wanted to put many customers behind one shared public address, using NAT run by the ISP. This is called carrier-grade NAT (CGNAT), or large-scale NAT.
The ISP needs addresses for the link between the customer's router and the ISP's NAT device. RFC 1918 space is a poor fit. A customer's home network often already uses 192.168.0.0/16 or 10.0.0.0/8. If the ISP used the same range on its side, the two networks would overlap, and routing would break.
RFC 6598 solved this by reserving 100.64.0.0/10 as shared address space. It is not public and it is not RFC 1918. It exists only for the link between an ISP and its customers.
The numbers
A /10 prefix leaves 22 host bits.
import ipaddress
net = ipaddress.ip_network("100.64.0.0/10")
print(net.netmask) # 255.192.0.0
print(net.network_address) # 100.64.0.0
print(net.broadcast_address) # 100.127.255.255
print(net.num_addresses) # 4194304The block runs from 100.64.0.0 to 100.127.255.255. That is about 4.2 million addresses. The second octet covers 64 to 127 because the prefix fixes the first two bits of that octet as 01.
How CGNAT works
With CGNAT, a customer's home router performs NAT as usual, so the devices in the house keep their RFC 1918 addresses. The router's outside interface gets an address from 100.64.0.0/10 instead of a public one. A second NAT, inside the ISP, translates that shared address to a public address.
The traffic is translated twice. Many customers share one public address, and the ISP's device tracks each connection by port number.
Rules for shared space
- Do not use 100.64.0.0/10 on your own internal network if you might sit behind a CGNAT. It can collide with your ISP's use.
- Packets from this block must not appear on the public internet. ISPs filter them at their edge.
- The block is not in
is_privatefor every Python version. Check it explicitly rather than assuming.
import ipaddress
SHARED = ipaddress.ip_network("100.64.0.0/10")
def is_shared_space(text):
return ipaddress.ip_address(text) in SHARED
print(is_shared_space("100.64.0.1")) # True
print(is_shared_space("100.127.255.1")) # True
print(is_shared_space("100.128.0.1")) # False
print(ipaddress.ip_address("100.64.0.1").is_global) # Falseis_global is False for this block, which tells you it is not routable on the public internet.
Common problems with CGNAT
You share a public address with other customers. Hosting a server at home, or opening a port with port forwarding, usually fails because the ISP's NAT does not forward inbound connections to you. Some services also treat a shared public address as one user and rate-limit it.
A quick check for CGNAT: compare the address on your router's outside interface with the public address a "what is my IP" site reports. If they differ, and the router's address falls in 100.64.0.0/10, you are behind CGNAT.
Exercise
Your router's outside interface shows 100.100.20.5, but a "what is my IP" site shows 198.51.100.9. What does this tell you, and why can you not simply host a web server at home?
Show answer
100.100.20.5 is inside 100.64.0.0/10 (the second octet 100 is between 64 and 127), so it is shared address space. The different public address means your ISP is running carrier-grade NAT and translating your traffic. Inbound connections arrive at the ISP's NAT, which has no rule sending them to your router, so a home server is not reachable without help from the ISP.