Network Address Translation
As mentioned in the discussion of subnetting, there are a limited number of IP addresses available, and with the proliferation of public networks there is fierce competition to obtain valid IP address space. During the initial rush for public address space, several things became very clear:
There is not enough public address space to go around.
Not every individual workstation needs a publicly routable IP address.
More public networks mean larger routing tables.
To solve issues like these, an Internet protocol called Network Address Translation (NAT) was developed. NAT is used to translate private IP addresses (non-routable) into public IP addresses (routable).
The section on subnetting mentioned that several IP address ranges are reserved for private networks and are not routed on public networks. Many companies have large, internal networks built using those private IP addresses (such as 10.10.10.XXX) but would still like those networks to be able to exchange traffic with the openly routable public networks. To accomplish this, a device (typically a firewall or router) will translate the many private IP addresses into a single or several publicly routable IP addresses.
For example, Acme.com has more than 2,000 workstations and servers using private IP addresses that need connectivity to the Internet. Instead of spending a large amount of time converting all of those IP addresses to publicly routable addresses (which would also be very costly), Acme.com leases a dedicated connection and a few public IP addresses from a local provider and purchases a NAT-capable firewall. Acme.com configures the firewall with one internal and one external interface (the internal interface has an IP address on the 10.10.10.XXX subnet and the external interface has one of the public IP addresses being leased from the service provider).
The firewall is then configured to perform NAT on all internal traffic with a destination outside the Acme.com private network, or Internet-bound traffic. When Internet-bound traffic is pointed at the internal address of the firewall, the firewall stamps the outbound packets with its public, routable address and sends them on their way. When response packets are received from outside sources, the firewall performs NAT in reverse, stripping off its own external, public IP address and stamping the packet with the correct internal, private IP address before sending it on into the private Acme.com network.
Figure 3.7 illustrates an example of NAT being performed. An internal workstation (10.1.1.123) wants to visit the CNN Web site at http://www.cnn.com. When the packet reaches the firewall, the firewall translates the 10.1.1.123 source address to the globally routable 220.127.116.11 address, the IP address of the firewall's externally visible interface. When the CNN Web site responds, it will respond to the firewall's address just as if the firewall had originally requested the information. The firewall must then remember which internal workstation requested the information and route the packet to the appropriate destination.
Figure 3.7 Network Address Translation for Acme.com.
In addition to translating outbound traffic, NAT can be used to provide limited external connectivity to internal resources. For example, your company maintains an intranet server with a private IP address of 10.1.1.12, but you'd like your traveling employees to be able to access that Web server from any external IP address (ISP connection, remote location, and so on) and you don't want to place that Web server outside your NAT-capable firewall. Depending on the firewall's capabilities, you can tell the firewall to take any traffic destined for a specific public IP address (18.104.22.168) and automatically translate that to the internal, private IP address (10.1.1.12).