In the past we used to use IPv4 which has limited number of host that can be given the IP addresses. For that we use NAT to solve the problem.
Let’s see how it works –
- First ISP gives you a valid public IP address and that is being setup in the router.
- The router assign a new private IP address to the new hosts that joins the network.
- The private IP addresses are reserved so no one else can connect to you.
- When you send a Ethernet packet to the outside of the world then you first send the packet to the router then it translate the private IP to public IP then sends the packet.
- When a packet comes from outside world then it first comes to the router then router translate the public IP to private IP then it uni cast the packet to the host in the LAN.
Note – Your neighbor router connected devices could have the same private IP addresses but that won’t effect you network because the IP are all private.