Alex Rivera | Logout

How do two computers connect to same external address through NAT?

Asked 2009-12-30T20:16:51.393
23

If I have two internal computers connecting to the same external IP address through a NAT router, how is the router able to get the traffic to the correct internal computer? It is my understanding that NAT forwards incoming packets to the computer that recently sent outgoing packets to the [incoming packet's] sender's IP address. Since both computers are sending to the same address, does the router forward the packet to both? If that is the case, is it the responsibility of the client software to determine which packets are relevant?

Is it possible if both computers are attempting to connect to the same port?

Edit
Report

1 Answer

3

Already good answers are provided, but here is another example:

    HOST A addr         HOST B addr
    10.1.0.2:4040       10.1.0.3:4040
-----------------------------------------
NAT 200.50.50.28:4040   200.50.50.28:4041 (what external host sees)

200.50.50.28 is router's global (internet) IP.

Every port number is unique in the NAT table. And of course the router does all the dirty job of modifying the source and destination addresses transparently.

answered 2009-12-30T20:57:19.953

Your Answer