Network address translation (NAT)

Network address translation is a technique wherein IP addresses are mapped from one address realm to another. A typical use of NATs is at the edge of a local network where the addresses within the network are private, unregistered addresses. This flexibility makes networking easier. NAT allows devices on the local network to communicate with end systems on the Internet by transparently routing the packets so that they appear to come from one IP address. A more global benefit of NAT is that it helps stem depletion of IP addresses. Because the addresses inside the home are not advertised, multiple networks could use the same set of addresses without causing any problems. A simple NAT operation would be to map, usually via a table, a private network IP plus port number to a router port number so that outbound packets appear to be sourced from the router’s IP with a port that the router has selected. In this way, the router can map reply packets to that port back to the private-side IP and port.

NATs have evolved to support various flavors such as Bidirectional, Twice NAT, and Realm Specific IP that a real NAT implementation would have to support. These are beyond the scope of this example.

Get Intel Threading Building Blocks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.