How do I make a TCP server work behind a router (NAT) without any redirection configuration needed

前端 未结 4 679
孤独总比滥情好
孤独总比滥情好 2020-12-09 11:34

The scenario is the following. I have two machines A and B: A: Client (behind NAT) B: Server (behind NAT)

I want B to be able to listen on any given port, so that A

4条回答
  •  时光取名叫无心
    2020-12-09 12:07

    You will have to either:

    1. Set up port forwarding from the nat gateway in front the server into the machine your server software is running, and have the client connect to the IP address of that gateway.

    2. Create a proxy server sitting inbetween the 2 nat gatewys so both your server and client can connect to that. Both your server and client have to set up a connection to that proxy which will mediate the data between those 2 connections.

提交回复
热议问题