
Port address translation lets many private hosts share one public address. The router rewrites each flow so that the outside sees the public address, and it tells the flows apart by the port number it assigned.
The rewrite is a form of Network Address Translation (NAT). Address translation can map one private host to one public address. Port translation maps many private hosts to a single public address by using a different port for each flow.
How the Router Keeps Flows Apart
- Outbound. The router replaces the private source address with the public address and records the port it used.
- The table. The private host, the private port, the public port, and the destination are stored together.
- The reply. A packet that returns to that public port is rewritten back to the private host that opened the flow.
Many Hosts on One Address and One Host per Address
| Compared | Many Hosts, One Address | One Host per Address |
| Public addresses used | One, shared | One for each private host |
| How replies find the host | By the public port recorded for the flow | By the public address alone |
| A new flow | Needs a free public port | Needs a free public address |