什么可能阻止客户端连接到服务器?
我的客户端在本地(通过路由器在 LAN 中)很好地连接到我的服务器,但是当我尝试将我的客户端连接到不在我的 LAN 中的 IP 上的服务器时,它不起作用。可能是什么问题?
My client connects to my Server very well locally (in a LAN through a router) but when I try to connect my client to a server on a IP that is not in my LAN, it doesn't work. What could be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
服务器位于 NAT 或防火墙或两者后面。您需要允许服务器网络上的任何防火墙(包括可能在服务器上运行的软件防火墙)中的端口上的入站连接,如果它位于路由器/NAT 之后,您将需要设置该路由器来转发服务器内部 IP 地址的所需端口。另请记住,您服务器的本地 IP 192.168.xx 可能与您需要连接的 IP(您的路由器从 ISP 获取的 IP)不同。
The server is behind a NAT or a firewall or both. You need to allow inbound connections on the port in any firewalls on the server's network (including a software firewall that might be running on the server), and if it is behind a router/NAT you will need to set up that router to forward the desired port to the servers internal IP address. Also remember that your server's local IP 192.168.x.x is probably different than the IP you'll need to connect to (the IP that your router gets from the ISP).