Vagrant CentOS6.3盒转发端口故障

时间:2014-02-04 03:09:34

标签: virtualbox vagrant

sh-3.2#vagrant -v     流浪者1.4.3     sh-3.2#VBoxManage -v     4.3.6r91406     sh-3.2#

iptables已被删除......

在流浪汉机器上,我看到了端口,它会响应。

[vagrant@localhost ~]$ nmap localhost

Starting Nmap 5.51 ( http://nmap.org ) at 2014-02-04 04:00 CET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00028s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 998 closed ports
PORT     STATE SERVICE
111/tcp  open  rpcbind
8000/tcp open  http-alt

Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds

[vagrant@localhost ~]$ curl localhost:8000
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html>
<title>Directory listing for /</title>
<body>
<h2>Directory listing for /</h2>
<hr>
<ul>
<li><a href=".bash_history">.bash_history</a>
<li><a href=".bash_logout">.bash_logout</a>
<li><a href=".bash_profile">.bash_profile</a>
<li><a href=".bashrc">.bashrc</a>
<li><a href=".ssh/">.ssh/</a>
<li><a href=".vbox_version">.vbox_version</a>
<li><a href="postinstall.sh">postinstall.sh</a>
</ul>
<hr>
</body>
</html>
[vagrant@localhost ~]$ 

我的端口被转发......

[web1] -- 22 => 2222 (adapter 1)
[web1] -- 80 => 8080 (adapter 1)
[web1] -- 8000 => 8081 (adapter 1)

现在......主机上的端口看起来很开放......

Starting Nmap 6.40 ( http://nmap.org ) at 2014-02-03 19:02 PST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000014s latency).
Not shown: 811 closed ports, 183 filtered ports
PORT     STATE SERVICE
22/tcp   open  ssh
631/tcp  open  ipp
2222/tcp open  EtherNet/IP-1
7778/tcp open  interwise
8080/tcp open  http-proxy
8081/tcp open  blackice-icecap

Nmap done: 1 IP address (1 host up) scanned in 5.23 seconds

但卷曲永远不会回来......

sh-3.2# curl localhost:8081

1 个答案:

答案 0 :(得分:0)

Vagrant / VirtualBox将端口转发到第一个(NAT)适配器,因此您需要将Web服务器绑定到它的IP或0.0.0.0。也许更容易添加 private_network 地址并完全跳过端口转发。