Search code examples
network-programmingip-addressrouterlannat

Addressing among private ip-addresses in networking


So, i was reading networking in depth. One concept i failed to understand was how different machines in LAN manage to access internet through one public IP address provided to company by ISP.

For eg. let's say the public address provided is 244.13.5.89. And all the machines when get to internet, they all are recognized as 244.13.5.89 despite their private address being 192.168.3.x, which is fine. But now when the router sends the request for each of these machines, how does it maps each response to respective machine?

If the answer is NAT, what entries does NAT has? Is there port no. or something else?


Solution

  • I will give you the idea about the complex case scenario :-

    If all datagrams arriving at the NAT router from the WAN have the same desti- nation IP address (specifically, that of the WAN-side interface of the NAT router), then how does the router know the internal host to which it should forward a given datagram?

    The trick is to use a NAT translation table at the NAT router, and to include port numbers as well as IP addresses in the table entries.

    See more details about NAT Table here.

    SORRY, don't know why it took me minutes to post an answer, it was not allowing me to add the answer...