NAT ~ when two computers with same IP talk?

What happens when I'm at home behind my router at 192.168.0.1 and I talk to my friend who's at home behind his router also using the IP address 192.168.0.1. I'm rusty on NAT, how does my router know its sending outwards instead of to itself?

Could anyone briefly describe the process NAT uses in this situation?

Reply to
Dennis
Loading thread data ...

First, you are using your friends 'external' address as the destination, as your box would not send any traffic off your segment unless that is the case. Second, your router basically changes the source of the packets to its own public interface, and then sends to the destination. His router is forwarding ports or whatever to get the unrequested traffic forwarded to his box, but the replies from his side will use the same NAT technology to manipulate the source of the packets. Nothing more complicated than that.....

Reply to
Trendkill

Network

192.168.0.1 Your PC | 192.168.0.254 Your Router LAN interface 123.45.67.89 Your Router WAN interface | Internet | 67.89.123.45 Friend's Router WAN interface 192.168.0.254 Friend's router LAN interface | 192.168.0.1 Friend's PC

When you PC contacts your friends PC, the packet looks like this

Source Destination

192.168.0.1 67.89.123.45

Since the Destination IP address is not on your LAN, the PC uses it's "default gateway" and despatches the Ethernet packet to the Ethernet MAC address of your router's LAN interface.

The router receives your packet and Translates the Network Address (NAT) of the source:

Source Destination

123.45.67.89 67.89.123.45

It then emits this packet on the WAN interface. Through the magic of the internet this packet arrives at the WAN interface of your friend's router (67.89.123.45).

Your friend's router is configured with some rule that lets it know that certain types of incoming traffic should be forwarded to a specific computer in her LAN. This might be a Port Address Translation (PAT) rule that says inbound traffic to TCP port 80 should be forwarded to

192.168.0.1 via the LAN interface of her router.

Your friend's router also does NAT on the inbound traffic to fix the destination address:

Source Destination

123.45.67.89 192.168.0.1

Her PC receives the packet and sends a reply to 123.45.67.89. This packet, since it's destination is off-LAN, gets sent to her router (default gateway). The reverse journey is much the same except your router doesn't need a PAT type rule to allow this traffic back in since your router knows it initiated the conection (it's a stateful router) and hence that it should allow in replies to that outgoing traffic.

Thats the way I understand it.

Reply to
Ian Wilson

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.