8  Network address translation

  • You will have read about NAT when exploring IP packet forwarding [Tip: hold Ctrl and click a link to open it in a new tab. (Hide tip)] , but it is covered in more detail here.
  • If you examine the diagram below, you will see that the home LAN is using IP addresses in IP network 192.168.0.0/24, which will be the case for all the ISP’s customers who are using the same type of home router. This will cause problems, as the source and destination addresses have to be unique in every communication unicast (sending packets between two devices).
Figure 21
  • Why do home routers use the same address on the home LAN if it will cause problems within the Internet? Remember, IPv4 cannot provide sufficient IP addresses for all the devices that want to use IP, so certain ranges of IP address, including 192.168.0.0/16, are set aside as private addresses.
  • Private IP addresses can be used by anyone, at any time, within a private network. This addresses the issue of not having sufficient IP addresses, but creates a problem in that the IP address cannot be used to communicate over the Internet as it is not unique. However, you will have a unique, public IP address assigned to your home router on the interface that connects to the ISP, which in the diagram above is 82.10.250.19.
  • The idea of NAT is to convert the source address from all outgoing LAN packets into the unique public address assigned to the home router, and vice versa for incoming packets from the Internet.

IP addresses in packets

  • The image below shows a packet transmitted from the home PC towards the web server, which needs to be routed towards the Internet by the home router:
Figure 22
  • Note that in the diagram above the source address is 192.168.0.101, which is private.
  • The packet will be received by the home router, which will perform NAT, converting the source address to its own WAN interface IP address (82.10.250.19):
Figure 23
  • The packet can now be forwarded through the Internet to the destination web server, which will return the requested webpage in a series of packets:
Figure 24
  • The IP packet is now addressed with the web server acting as the source, and the public address of the home router WAN interface as the destination. The home router will accept the incoming packet, and translate the destination address back to the private IP address of the home PC:
Figure 25
  • The use of NAT and private IP addresses has extended the life of IPv4 well beyond what would have been possible with the original range of addresses it provided. Private IP addresses and NAT are implemented within most home and business networks.

7.2.5  Home router

9  Using networks securely