computer network - NAT (Network Address Translation )

The original intention for NAT was to reduce available IP address space by allowing many private IP addresses to be represented by some smaller number of public IP addresses.

NAT really decreases the overwhelming amount of public IP addresses required in your networking environment. And NAT comes in very handy when two companies that have duplicate internal addressing schemes merge. NAT is also great to have around when an organization changes its ISP and the networking manager doesn't want the hassle of changing the internal address scheme.

Here's a list of situations when it's best to have NAT on your side:

  • You need to connect to the Internet and your hosts don't have globally unique IP addresses.
  • You change to a new ISP that requires you to renumber your network.
  • You need to merge two intranets with duplicate addresses.

Advantages and Disadvantages of NAT:

Table of Advantages and Disadvantages of NAT

Where to configure NAT:

configure NAT

Types of Network Address Translation:

Static NAT (SNAT) This type of NAT is designed to allow one-to-one mapping between local and global addresses. Keep in mind that the static version requires you to have one real Internet IP address for every host on your network.

Dynamic NAT (DNAT):

This version gives you the ability to map an unregistered IP address to a registered IP address from a pool of registered IP addresses. You don't have to statically configure your router to map an inside-to-an-outside-address as you would using static NAT, but you do have to have enough real, bona-fide IP addresses for everyone who, is going to be sending packets to and receiving them from the Internet.

Overloading:

This is the most popular type of NAT configuration. Understand that overloading really is a form of dynamic NAT that maps multiple unregistered IP addresses to a single registered IP address many to one by using different ports. It's also known as Port Address Translation (PAT). And by using PAT (NAT Overload), you get to have thousands of users connect to the Internet using only one real global IP address.

NAT Overload is the real reason we haven't run out of valid IP address on the Internet.

The addresses used after NAT translations are called global addresses. These are usually the public addresses used on the Internet.

Local addresses are the ones we use before NAT translation. So, the inside local address is actually the private address of the sending host that's trying to get to the Internet, while the outside local address is the address of the destination host. The latter is usually a public address.

After translation, the inside local address is then called the inside global address, and the outside global address then becomes the name of the destination host.

Terms in NAT

The packet is sent to the outside interface with the new translated source address. The external host returns the packet to the destination host, and the NAT router translates the inside global IP address back to the inside local IP address using the NAT table.

Basic NAT Translation

In overloading all inside hosts get translated to one single IP address, hence the term Overloading. This overloading method is also called(PAT).

Take a look at the NAT table in below image. In addition to the inside local IP address and outside global IP address, we now have port numbers. These port numbers help the router identify which host should receive the return traffic.

NAT Overloading (PAT)