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 network, and the basic idea of NAT from earlier chapters. It covers a fourth block that is neither private nor public, and the reason it exists.
The problem: running out of public addresses
IPv4 has about 4.3 billion addresses. Registries handed out the last free blocks of public space years ago. An internet service provider (ISP) that signs up new customers still has to give each one a way onto the internet.
The usual home arrangement is a router that holds one public address on its outside interface. The router uses NAT to share that address among the devices in the house. A shortage of public addresses means an ISP may have none left to give each customer's router.
The ISP's answer is to add a second layer of NAT inside its own network. This is carrier-grade NAT (CGNAT), also called large-scale NAT. The customer's router no longer gets a public address. It gets an address that is only meaningful inside the ISP, and the ISP translates it to a public address further upstream.
Why RFC 1918 space was not enough
The ISP could number its customer-facing links from RFC 1918 space, such as 10.0.0.0/8. This causes a conflict.
Customers already use RFC 1918 space inside their homes and offices. If the ISP gives a customer's router the address 192.168.1.1 on the outside, and the customer's own LAN is 192.168.1.0/24, the router has the same network on both sides. Routing becomes ambiguous. A router cannot reliably tell which side owns 192.168.1.20.
The same problem appears if the ISP uses 10.0.0.0/8 and a customer runs a VPN into a company network that also uses 10.0.0.0/8. Overlapping ranges break routing, as the earlier chapter on pitfalls described.
The ISP needs a block that customers will not normally use inside their own networks, and that is also not routed on the public internet.
The shared address space block
RFC 6598 reserved 100.64.0.0/10 for this purpose. It is called the shared address space.
| Property | Value |
|---|---|
| Prefix | 100.64.0.0/10 |
| First address | 100.64.0.0 |
| Last address | 100.127.255.255 |
| Number of addresses | 4,194,304 (2^22) |
| Second octet range | 64 to 127 |
| Defined by | RFC 6598 |
The /10 prefix means the first 10 bits are fixed. The first octet is 100 (binary 01100100). The next two bits of the second octet are 01. The remaining 6 bits of the second octet, together with the third and fourth octets, are free. That gives 2^22 addresses, and the second octet runs from 64 (01000000) to 127 (01111111).
You can confirm this with the standard library:
import ipaddress
SHARED = ipaddress.ip_network("100.64.0.0/10")
print(SHARED.network_address) # 100.64.0.0
print(SHARED[-1]) # 100.127.255.255
print(SHARED.num_addresses) # 4194304
print(SHARED.netmask) # 255.192.0.0The netmask 255.192.0.0 has 192 (11000000) in the second octet, which is why the block ends at 127 and not 255.
How CGNAT works
The block is used only on the link between the customer's router and the ISP's CGNAT device. The customer router's outside (WAN) interface gets a 100.64.0.0/10 address. Its inside (LAN) interface still uses an RFC 1918 network. The ISP's CGNAT device holds a pool of real public addresses and translates between the two.
The laptop's connection is translated twice on the way out:
- The home router rewrites the source from 192.168.1.20 to 100.64.12.9, with a chosen source port.
- The CGNAT device rewrites the source from 100.64.12.9 to a public address such as 203.0.113.7, with another port.
The CGNAT device keeps a translation table. Many subscribers share one public address, and the table maps each (shared address, port) pair to a (public address, port) pair. A single public address has only about 65,000 ports per protocol, so a CGNAT usually limits how many ports each subscriber may use.
Replies come back to the public address. The CGNAT device looks up the port in its table and forwards the packet to the right subscriber's router.
What shared space is and is not
The block has its own status. It sits between private and public space.
| Property | RFC 1918 private | Shared 100.64.0.0/10 | Public |
|---|---|---|---|
| Routable on the public internet | No | No | Yes |
| Intended use | Inside a customer's network | Between an ISP and its customers' routers | Any |
| Usable inside a home LAN | Yes | Not recommended | n/a |
| Defined by | RFC 1918 | RFC 6598 | Registries |
Routers on the public internet should not forward packets with source or destination addresses in 100.64.0.0/10. ISPs filter this block at their borders so that it does not leak. Treat it as private from the point of view of the wider internet.
It is not RFC 1918 space, though. Software that checks addresses against the three RFC 1918 ranges will not recognize it. Software that treats everything outside RFC 1918 as public will treat it as public. Both can give wrong answers.
Python's ipaddress module reflects this. In current Python versions, an address in the shared block is neither private nor global:
import ipaddress
address = ipaddress.ip_address("100.64.12.9")
print(address.is_private) # False
print(address.is_global) # FalseA classifier that wants to name this case must check for it explicitly:
import ipaddress
SHARED = ipaddress.ip_network("100.64.0.0/10")
def classify(text):
address = ipaddress.ip_address(text)
if address in SHARED:
return "shared (CGNAT)"
if address.is_private:
return "private or special-purpose"
return "public"
print(classify("100.64.12.9")) # shared (CGNAT)
print(classify("100.127.255.1")) # shared (CGNAT)
print(classify("100.128.0.1")) # public
print(classify("10.0.0.1")) # private or special-purpose
print(classify("8.8.8.8")) # publicThe check for the shared block comes first so that it does not depend on how a particular Python version classifies it.
Practical consequences
Detecting that you are behind CGNAT
If your router's WAN address is in 100.64.0.0/10, your ISP is using CGNAT. A second sign is that the WAN address shown on your router differs from the address that an external "what is my IP" service reports. With only one layer of NAT, the two match.
Inbound connections and port forwarding
A host behind CGNAT cannot be reached from the internet by default. The home router can forward a port to a device on the LAN, but the CGNAT device in front of it does not forward that port to the router. Hosting a server, using some peer-to-peer or gaming features, or reaching your own network remotely can therefore fail. Options include asking the ISP for a public address, using a tunnel or relay service that your device connects out to, or using IPv6.
Address-based logging and blocking
Many subscribers can appear to servers as the same public address. A server that blocks or rate-limits by IP address may block many unrelated customers at once. Abuse reports tied to one address can be hard to trace to one person without the ISP's translation logs.
Overlap with your own networks
Avoid using 100.64.0.0/10 inside a LAN when you can. If your LAN uses it and your ISP also puts your WAN in it, you have the same overlap problem described earlier. Cloud providers, VPN products, and container platforms sometimes use this block for internal purposes. Check before assigning it to avoid collisions.
Common errors
- Assuming that any address that is not in the three RFC 1918 ranges is public. The shared block is a counterexample.
- Writing 100.0.0.0/8 or 100.64.0.0/8 when you mean 100.64.0.0/10. The first covers a huge public range. The second is not a valid network address for that prefix length.
- Stopping the range at 100.255.255.255 instead of 100.127.255.255.
- Concluding that a device has a public address because its address is not 10.x, 172.16.x, or 192.168.x.
Exercise
A customer's router reports a WAN address of 100.100.50.2, and a "what is my IP" website shows 203.0.113.44. Is the router behind carrier-grade NAT, and which prefix does its WAN address belong to? Would 100.128.0.9 on a WAN interface show the same thing?
Show answer
Yes. 100.100.50.2 falls inside 100.64.0.0/10 (second octet 100 is between 64 and 127), and it differs from the public address the website reports, so the ISP is translating it with CGNAT. 100.128.0.9 is outside the block, because the shared space ends at 100.127.255.255. It is an ordinary public address, so it would not indicate CGNAT.