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

后端 未结 6 1304
梦毁少年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:15

    It uses different ports for incoming external traffic, and the NAT then routes the packets on one port to one internal IP address, and the packets from the other port to the other internal IP address... The iniital request from each internal computer, when it goes through the NAT on the way out, establishes which port will be used for the incoming traffic from the external ip address, and it tells the external server what port to send it's traffic back on for that connection.

提交回复
热议问题