
There are only 2³² = 4,294,967,296 IP possible addresses in version 4 (IPv4) and around 8,000,000,000 people in the world. So it means that only roughly half of the citizens can have one IP address. It’s a big limitation considering at least a few devices per one person. So there are two solutions for this issue:
1. Creating subnetworks with private IP addresses and one public address representin the network
2. Another version of IP – IP version 6. When we switch to IP version 6, then we can accomodate – 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses 🙂
Until we need to use IPv4 there is a need for private and public IP addresses and here is where NAT comes into play – NAT translates private addresses of a network into the public one (or more) representing the network. So basically NAT is a mapping table like:
Internal IP address | Public IP address |
---|---|
10.0.0.0 | 111.2.3.4 |
10.0.0.1 | 111.2.3.4 |
10.0.0.2 | 111.2.3.4 |
it looks fine, but how does NAT know to whom it should send the response back? it uses ports of the public address, so the table is more like:
Internal IP address | Public IP address (with port) |
---|---|
10.0.0.0 | 111.2.3.4:0 |
10.0.0.1 | 111.2.3.4:1 |
10.0.0.2 | 111.2.3.4:2 |