This tutorial understands how network address translation work. NAT which stands for network address translation is a feature which is commonly found on routers. The feature is predominantly used for translating the internal IP address of a network to external network.
Assuming that the user on the PC initiates a HTTP connection to a server on the outside. When the connection is initiated, the packet constructed contains the source IP address as the PC’s LAN IP address and the destination IP address as the servers IP address. The TCP header in the packet would contain the source port number as a dynamic port number and the destination port number as 80 as the packet is destined to a HTTP server, the port number of which would be 80. The packet has go through the router to reach the server which is residing on the internet. On the router, the source IP address in the packet is re-written with the IP address of the router facing the internet, which is the public IP address. After the process and before the packet exits the router, the source IP address, destination IP address, port number before and after translation is inserted in a table, which is known as the NAT table. The packet exits the router after the above process. When the packet comes back, the destination IP address would be the routers IP address and the source IP address as the servers IP address. The router looks into the routing table for a corresponding entry and obtains a match which was inserted before the packet exited the router. The router would then re-write the destination IP address in the packet before it sends it to the PC on the network. In the above example, the main purpose of NAT is for the PC requests to reach the server on the internet. The PC has a private IP address, which does not work on the internet. The router applies NAT on the packet which would make the source IP address , a public IP address routable on the internet.
Ebook Store – Click here