I was reading about NAT. It has 3 types.

  1. Static - one-to-one mapping between private and public addresses.
  2. Dynamic - one public address is selected from a pool of public addresses and mapped to one private address. This is also a one-to-one mapping.
  3. Overloading/PAT - in this case port numbers are going to play a role to map a set of private addresses to a public address or a much smaller set of public addresses.

In the first two case the NAT table is going to have IP address pairs, but in the last case the NAT table is going to have IP+port number pairs.

Also I read that when communicating different applications can be differentiated by port numbers.

My problem is: Lets consider a static NAT, where a local host is mapped to a global IP address. If this host runs multiple applications, and each application uses different port numbers in that case does the NAT table have port number mappings as well? In other words how requests from different applications from a particular host are handled/differentiated without port numbers in static NAT?

1 Answer 1


NAT implementation varies. Even the 3 types of NAT are not always the way you described. Static NAT can have IP + Port static. i.e. Private IP/Port maps to Public IP/Port. And you can have different Private IP/Port mapped to the same Public IP but different port. (There are, in fact, way more than 3 types of NAT, but that's a different discussion)

That said, let's continue with your example. Say Static NAT of =>

NAT implementation usually has a NAT translation table to look up the incoming packet, which has a source IP of the internet host and destination IP of one of the NAT'd public IP. This translation table is updated whenever a new translation occurred and also aged out from time to time.

If there is a full tuple match (meaning source IP/port, dest IP/port, IP protocol), NAT will use the match to translate. It could also be a partial match (you can think the static NAT entry has a half entry using a wildcard for port). Say, the packet received is TCP ->

If there is a match (, it will use the static translation to map the incoming destination IP ( to the private IP ( in your static NAT. In the case of static NAT entry, NAT only needs to translate the dest IP and the ports pass through unmodified. And the host will distribute the packet to application base on the destination port. i.e. the application on port TCP 80 will receive the packet.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .