Nat – How does NAT work for large private networks

nat;

NAT works by maintaining a mapping table between (internal IP, internal port) and (external IP, external port). But both UDP and TCP has 16-bit port numbers, which means that the table can have at most 65536*2 entries (suppose there is only one public IP assigned to this private network). Since that each computer makes a lot of connections, a not-very-large private network will soon fill this table, right? How to handle the lack of ports on the external IP then?

Best Answer

As a rule of thumb, I size my firewalls for 250 tcp sessions per user. That's on the high side right now, but as people start to use more and more cloud services (dropbox, Office365, etc, etc) the number of sessions per user is only going up in the near future, so I prefer to be on the safe side. This means a single public IP is enough to NAT for only 250 users.

If you have more users, you would need to use more public IP addresses for NAT. This is called a NAT Pool. Your firewall will use IPs from the pool to assign IP/port combinations as needed.

In Cisco IOS, you configure a NAT pool thus:

ip nat pool <name> <start-ip> <end-ip> 
 {netmask <netmask> | prefix-length <prefix-length>}
 [type {rotary}]

If you want to know everything about NAT, check out the Cisco documentation. It's an excellent read.

Related Topic