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

后端 未结 6 1324
梦毁少年i
梦毁少年i 2020-12-23 22:39

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?

6条回答
  •  抹茶落季
    2020-12-23 23:19

    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.

提交回复
热议问题