Port preservation

A technique where the source port chosen by a client is the same port used by the router.

Remember that outbound connections choose a source port at random from the ephemeral ports or the ports in the range 49152 through 65535. In the simplest setup, a router set up to NAT outbound traffic will just keep track of what the source is and use that to direct traffic back to the right computer.

Even with how large the set of ephemeral ports is, it’s still possible for tow different computers on a network to both choose the same source port. When this happens, the router normally selects an unused port at random to use instead.

Another important concept about NAT and the transport layer is port forwarding.

Port forwarding

A technique where specific destination ports can be configured to always be delivered to specific nodes.

This technique allows for complete IP masquerading while still having services that can response to incoming traffic.

Response traffic would have the source IP rewritten to look like the external IP of the router. This technique not only allows for IP masquerading. it also simplifies how external users might interact with lots of services all run by the same organization.

Untitled