Why do we have NAT if we could just assign a public IP address?

Why wouldn't you just skip the private address altogether and assign a public one if the host needs to connect to a network?

Because there are not enough public addresses in IP version 4 to give every possible Internet connected device a unique address. This is why IP version 6 uses more bits for the address range and has more addresses.

Private address blocks are not supposed to be routable over the public Internet (this is what makes them "private"). Since there are only 3 private blocks with a relatively small number of addresses within them, they are guaranteed to be reused by anyone and everyone who has a private network (private addresses ONLY need to be unquie within a private network, but another private network might reuse the same addresses). So you cannot just put the private address blocks "out there" - they will conflict with someone else who is using the same block elsewhere.

So this is why NAT is needed.

To directly answer your last statement, if you have enough public addresses available to you, then you don't need NAT to send and receive traffic. NAT isn't necessary for this reason if you aren't trying to "save" IP addresses. For completeness, I'll say this: some people rely on the following side effects of NAT for security reasons and that could be a reason to elect to use it even if you do have enough public IP addresses:

  • users behind a NAT cannot receive incoming connections unless incoming traffic is explicitly forwarded to the them by the router
  • since outgoing traffic from NAT looks like to external systems that it comes from the router's IP, this hides details of the machines behind the NAT from external systems, i.e. how many machines, their private IPs, etc.

(Personally I wouldn't rely on a NAT for security if I didn't otherwise need it but YMMV)


One reason NAT exists is because, with IPv4, there are a severely limited number of addresses available (a theoretical maximum of about 4.3 billion). For this reason, in most residential circumstances, an Internet Service Provider provides at most one public IP address to a subscriber at a time. If you would like to send and receive packets on multiple machines, it is necessary to have some kind of a local-public conversion, in other words NAT.

IPv6 will change all that as there should be something like thousands or millions of IP addresses per square foot of the Earth's surface.


There is not an infinite amount of IPv4 addresses, which in turn has made ISP:s not wanting to give out multiple addresses to its customers (without extra fees). Thus everyone gets one public IP address (often not even static, to also be able to offer that for a price premium), and when multiple home devices became the norm, NAT routing was the solution that became standard. Hardware manufacturers rejoiced :-) .

That is the economic part of why we "need" NAT translation, and at least on a home user scale, I believe it has been the driving reason.

Once IPv6 hits in a big way, everything should get a publicly routable unique address. This will happen sometime, definitely within 10 years, perhaps within 5. If something is certain, it is that we are notoriously bad at predicting the breakthrough of this :-) .

Tags:

Networking

Nat