简体   繁体   English

端口转发后仍无法连接

[英]Can't connect despite port forwarding

I have a Ubuntu Server 16.04 running on a machine in my local network. 我在本地网络中的计算机上运行了Ubuntu Server 16.04。 The machine has static assigned IP and running apache2. 该机器具有静态分配的IP,并且正在运行apache2。 There is no problem in connecting to it from my local network. 从我的本地网络连接到它没有问题。 I have port-forwarding for ports 22 and 80 setup on my router to the IP address of the machine. 我在路由器上将端口22和80设置的端口转发到机器的IP地址。 When I check the ports with my public IP address on sites like http://www.canyouseeme.org/ the result is that the ports are open. 当我在http://www.canyouseeme.org/等站点上使用公共IP地址检查端口时,结果是端口已打开。 When I try to connect using my public IP address and using those ports the connections are refused. 当我尝试使用公共IP地址和这些端口进行连接时,连接被拒绝。 I tried disabling firewall in the router and also on the machine, no result. 我尝试禁用路由器以及计算机上的防火墙,没有结果。

What else should I try? 我还应该尝试什么? It seems that the server is getting no incoming connection when I check with netstat. 当我使用netstat检查时,似乎服务器没有传入连接。

Just for troubleshooting purposes: 仅用于故障排除目的:

  • Setup port forwarding on port 22 and try to ssh into your server using the public IP? 在端口22上设置端口转发,并尝试使用公共IP SSH进入服务器? If it works, it means apache is refusing the connections and not your router or ISP 如果有效,则表示apache正在拒绝连接,而不是您的路由器或ISP

  • On your router, setup the server on the DMZ temporarily and check if it works 在路由器上,临时在DMZ上设置服务器,并检查其是否正常运行

  • Add another port forwarding rule on your router to redirect all http requests on port 8000,for example, to port 80 internally, then try to access your server with http://[public_ip]:8000 在路由器上添加另一个端口转发规则,以将端口8000上的所有http请求重定向到内部,例如,内部重定向到端口80,然后尝试使用http:// [public_ip]:8000访问服务器

Have you changed anything on the apache2.conf file? 您是否更改了apache2.conf文件中的任何内容? Also, explain how you are testing the connection, internally using the public IP or from the Internet? 另外,请说明您如何在内部使用公用IP或从Internet测试连接?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM