2

I have installed Vagrant in my Window XP, and in my Vagrantfile I have:

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

But I see no sign of my vagrant box when I type "http://192.168.10.200:8080" in browser.

IP address of the virtual box is correct, because from within the vbox, I have:

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

There seem to be no firewall problem because if I type

vagrant@lucid32:~$ curl 'http://google.com'

it works fine.

I have read Vagrant's port forwarding not working and tried:

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

and also

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

So, looks like port forward is not working...

If you know what I can do so I can access my vbox from host browser, can you help me?

Thanks in advance

Community
  • 1
  • 1
nodoubt
  • 23
  • 1
  • 3
  • Can you advise your setup to get vagrant working on xp as there now tutorial to show necessary configeration to get a box to download and work – user2033464 Oct 25 '14 at 19:46

2 Answers2

5

If you just started a Vagrant box with this Vagrantfile, there is nothing more than an empty Ubuntu Lucid, which does not run any service yet. So there is nothing served on port 80, this is why there is nothing to see either from inside the box on port 80 or the host machine on 8080.

For you Vagrant machine to provide some services (such as a web server on port 80), you have to do some provisioning. You can do it manually or using Chef or Puppet which are hooked into Vagrant's up process.

Romain Champourlier
  • 2,360
  • 24
  • 29
0

I had a similar problem. Sometimes using port forwarding for ports below 2000 is a problem. What worked for me is choosing ports that are above 2000. So my vagrantfile now looks like:

config.vm.network :forwarded_port, host: 4500, guest: 9000

Typing localhost:4500 on my host machine now just works fine. It seems like you are on an older version of vagrant than mine, so you can edit your vagrant file to something like

config.vm.forward_port 9000, 4500

Now typing localhost:4500 on your host machine should work fine.

Good luck,

Komu
  • 14,174
  • 2
  • 28
  • 22