主机中的浏览器无法看到流浪盒,端口无法正常工作

nod*_*ubt 2 http portforwarding vagrant

我在我的Window XP中安装了Vagrant,在我的Vagrantfile中我有:

Vagrant::Config.run do |config|
  # Setup the box
  config.vm.box = "lucid32"
  config.vm.forward_port 80, 8080
  config.vm.network :hostonly, "192.168.10.200"
end
Run Code Online (Sandbox Code Playgroud)

但是当我在浏览器中输入" http://192.168.10.200:8080 " 时,我看不到我的流浪盒的迹象.

虚拟盒的IP地址是正确的,因为在vbox中,我有:

vagrant@lucid32:~$ ifconfig
....
eth1      Link encap:Ethernet  HWaddr 08:00:27:79:c5:4b
          inet addr:192.168.10.200  Bcast:192.168.10.255  Mask:255.255.255.0
Run Code Online (Sandbox Code Playgroud)

似乎没有防火墙问题,因为如果我键入

vagrant@lucid32:~$ curl 'http://google.com'
Run Code Online (Sandbox Code Playgroud)

它工作正常.

我已阅读Vagrant的端口转发无法正常工作 并尝试:

vagrant@lucid32:~$ curl 'http://localhost:80'
curl: (7) couldn't connect to host
Run Code Online (Sandbox Code Playgroud)

并且

vagrant@lucid32:~$ curl 'http://localhost:8080'
curl: (7) couldn't connect to host
Run Code Online (Sandbox Code Playgroud)

所以,看起来像港口前进不起作用......

如果你知道我能做什么,我可以从主机浏览器访问我的vbox,你能帮帮我吗?

提前致谢

rch*_*ier 5

如果你刚刚用这个开始一个Vagrant盒子Vagrantfile,那么只有一个空的Ubuntu Lucid,它还没有运行任何服务.因此端口上没有任何服务80,这就是为什么从端口80或主机上的盒子里面看不到任何东西8080.

为您提供Vagrant机器提供的一些服务(如端口上的Web服务器80),您必须进行一些配置.您可以手动执行,也可以使用与Vagrant up进程挂钩的Chef或Puppet .