Why do we need private IPv4 addressing?
During the beginning deployment of IP addressing and the wider internet in the late 80s/early 90s the original design was to give every networked device a public IP address. IANA (Internet Assigned Numbers Authority) would give organisations huge address blocks of the public IP address space. For example, Apple was provided with 17.0.0.0/8 which allowed for over 16 million IP addresses. The internet grew rapidly and the IETF (Internet Engineering Task Force) directed IANA to reserve 3 address blocks from the global pool which can be used in the private networks (LANs) under RFC (Request for Comments) 1918. You can read the RFC here: https://www.rfc-editor.org/rfc/rfc1918.html. To quote an excerpt below:
"The Internet has grown beyond anyone's expectations. Sustained exponential growth continues to introduce new challenges. One challenge is a concern within the community that globally unique address space will be exhausted."
Due to the 32-bit size of an IP address, there are only 4,294,967,296 available. While this may seem like a large number, imagine if every device in your home was assigned a publicly routed IP address, then multiply those devices to the number of households and businesses across the world and you can quickly see why the IETF saw an IP address exhaustion as a big issue. The following 3 IP address blocks were marked by IANA as private address space, and packets with an IP address within these ranges is not routed across the internet.
IANA delegates IP address assignment to 5 RIRs (Regional IP Registries) across the world of which they are responsible for giving public IP addresses to Service Providers and organisations alike. The five RIRs are as below, I've also included the date of when the IPv4 address space for that RIR became exhausted:
-
AFIRNIC (African Network Information Centre) - https://stats.afrinic.net/ipv4/exhaustion/ipv4_pool
-
ARIN (American Registry for Internet Numbers) - 24/11/15 exhausted IPv4 address pool
-
APNIC Asia-Pacific Network Information Centre) - https://www.apnic.net/manage-ip/ipv4-exhaustion/
-
LACNIC (Latin America and Caribbean Network Information Centre) - 21/08/20 exhausted IPv4 address pool
-
RIPE (Réseaux IP Européens Network Coordination Centre) - 25/09/19 exhausted IPv4 address pool
There are 3 key implementations to solve the IPv4 exhaustion:
-
NAT
-
The allocation of private address spaces by IANA
-
IPv6 (Covered in the next articles)
​
NAT (Network Address Translation)
Let's look at how a typical home would connect to the internet. You buy internet connectivity from a Service Provider, which they in turn have a pool of public IP addresses they have obtained from their most local RIR. This pool of public IP addresses is then used to assign out to the Service Provider's customers' home routers. While the WAN (Wide Area Network) port is configured with a single public IP address, the router uses private IP addresses on the LAN (Local Area Network) side. Using NAT allows the devices on the private address network to access the internet via the router. See the below diagram:
If we look at the above diagram the router is acting as a gateway (hence why it's called the Default Gateway) as it sits on the edge of the LAN. We can see the LAN interface of the router is configured with 192.168.1.254, and the WAN interface is configured with 215.15.69.212. Instead of giving each device on the LAN a public IP address, the router performs an action called NAT for every packet that needs to route out to the internet. In it's simplest definition NAT replaces the source IP address of the packet with the IP address of the WAN interface. If NAT was not enabled in this scenario, the packet will be dropped.