When is port forwarding necessary?

前端 未结 3 1144
滥情空心
滥情空心 2021-01-04 21:11

I\'ve been investigating networking for use in a two-player game I\'m writing, and I\'m still not clear on when a device must have a port forwarded in order to communicate w

3条回答
  •  隐瞒了意图╮
    2021-01-04 21:51

    Port forwarding (occurs) when a NAT, firewall or some other device blocks communication on all or some ports.

    To answer your question as an example, most commercial routers use NAT to allow multiple people to use the same IP(As view from the outside world) provided by ISPs. Most ISP's use NAT to allow multiple customers to use the same IP(As viewed from the outside world). To get this to work, the NAT changes the internal IP and the port number of a communication to THE(there is only one for the entire sub network) external IP and a new port number. By doing this, the router/isp/ect can tell which internal IP and port each external communication goes to.

    Anytime one of the computers communicating over the internet are behind a NAT, port forwarding is required. I'm sure there are way more situations than this, and the solution to each can be quite complicated. But this covers the vast majority.

提交回复
热议问题