Centos 7 Linux节点:Telnet工作但无法使浏览器连接
我在防火墙上打开了一个端口并取得了成功
firewall-cmd --zone=public --add-port=777/udp --permanent
...
然后我使用一个简单的节点createServer
:
http.createServer(function (req, res) {
res.write('Hello World!!!'); //write a response to the client
console.log(req.url);
res.end(); //end the response
}).listen(777); //the server object listens on port 777
...
当我尝试Telnet时,我得到一个连接
telnet <myip> 777 // this shows that there is a connection...
但是当浏览器中的IP浏览器,即<my.ip.address:777>
,我得到连接拒绝...
在我的本地电脑中这可以正常工作......
有谁知道可能是什么问题?
回答如下:您可以在代码中指定IP,否则必须在localhost:777
上连接
如果这是在任何虚拟机上,您只需使用本地端口转发
ssh -L <any port>:localhost:777 root@ip
然后在localhost:anyport
上连接您的浏览器