Let's say I have a private network connected to the internet with default gateway 192.168.1.1 on Router1. Now a host(Host#1, 192.168.1.10) on this network wants to send a packet over the public internet to a host(Host#2,192.168.2.10) on another private network 192.168.2.0/24 with RouterB as its default gateway. The packets from 192.168.1.0/24 network gets NATed to, say, 100.100.100.100, and for network 192.168.2.0/24 it is 220.127.116.11.
Here is what I feel how the packet will flow
- Host#1 creates a packet with source and destination IP as 192.168.1.10 and 192.168.2.10. (I'm not sure about this. Will the destination IP be the public or private IP of Host#2?).
- Packet reaches Router1 and gets NATed to the public IP addresses 100.100.100.100 and 18.104.22.168.
- Packet reaches Router2.
- Now Router2 sees a packet coming from 100.100.100.100 directed to 22.214.171.124. How does it know which host it has to route the packet to.
I'll also add that I'm talking about PAT here specifically.