主持人:

主持人:

我在 Win7 中安装了 VirtualBox 4.3.26(目前是最新版本),还有一个客户 CentOS7。我启用了 SSH 和 HTTP 的端口转发

我可以使用 putty 从主机 ssh 进入客户机ssh 127.0.0.1:2222,但无法通过以下方式从主机访问客户机 Web 服务器http://127.0.0.1:3000

主持人:

NIC 1:           MAC: 08002764D472, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 1 Rule(0):   name = Rule 1, protocol = tcp, host ip = 0.0.0.0, host port = 2222, guest ip = 0.0.0.0, guest port = 22
NIC 1 Rule(1):   name = Rule 2, protocol = tcp, host ip = 0.0.0.0, host port = 3000, guest ip = 0.0.0.0, guest port = 3000

网络状态

TCP    0.0.0.0:3000           0.0.0.0:0              LISTENING

curl(cygwin)

$ curl -vv http://127.0.0.1:3000
* Rebuilt URL to: http://127.0.0.1:3000/
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 3000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.41.0
> Host: 127.0.0.1:3000
> Accept: */*
>
* Recv failure: Connection was reset
* Closing connection 0
curl: (56) Recv failure: Connection was reset

客人

网络状态

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN                                                             -
tcp        0      0 0.0.0.0:3000            0.0.0.0:*               LISTEN                                                             2743/node

卷曲度没问题

答案1

我在 Centos 7 客户机和 Windows 10 主机上遇到了同样的问题。结果发现问题出在客户机上的防火墙上。

问题解决后:

sudo systemctl stop firewalld

相关内容