Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to use vagrant with Windows as guest.
When I use config.vm.network to configure a host only network with static ip, the setting won't work.
Here is my Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "win08r2"
  config.vm.guest = :windows
  config.ssh.max_tries = 1
  config.ssh.timeout = 10
  config.vm.provider :virtualbox do |vb|
    vb.gui = true
  end
  config.vm.network :private_network, ip :"192.168.56.10"
  config.vm.network :public_network
end

The ip of vm is something like 196.254.xx.xx or other, just not same with 192.168.56.10.

Is there any problems with my vagrantfile?

Thanks,

share|improve this question

migrated from stackoverflow.com May 28 '13 at 12:14

This question came from our site for professional and enthusiast programmers.

    
According to the vagrant doc everything seems write - may be a problem with windows guests in general... may be you should open an issue at vagrant and ask there. –  cmur2 May 28 '13 at 6:24

2 Answers 2

I could not get my CentOS vm to take an ip using vagrant's private network. It made a new interface with that ip, but wasn't using it. I ended up doing

config.vm.provider :virtualbox do |vb|
  vb.customize ["modifyvm", :id, "--memory", "3072", "--cpus", "2", "--natnet1", "10.252/16"]
end

Along with allocating some resources, this line will force virtualbox to use nat with 10.252.xx.yy. The default ip for the first interface is 10.252.0.15. Each interface after increases xx by two. yy stays at 15. That is the behavior of virtualbox, not vagrant. Hopefully that helps somewhat.

share|improve this answer

This setup works for me:

config.vm.network "hostonly", "192.168.56.10"

If you want to access your host machine, you host machine ip address would be 192.168.56.1

share|improve this answer
1  
Thanks, but this syntax works with previous version of Vagrantfile. github.com/mitchellh/vagrant/issues/1628 –  Toste Jun 13 '13 at 2:10
    
I second that, this does not work with Vagrant version 1.5.1. –  blong Apr 8 at 2:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.