vagrant up fails with config.vm.network :hostonly

Created on 19 Apr 2013  Â·  13Comments  Â·  Source: hashicorp/vagrant

When I run vagrant up with config.vm.network :hostonly, "33.33.33.33" I recieve the following error:

C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/plugins/kernel_v2/config/vm.rb:137:in `[]': can't convert Symbol into Integer (TypeError)
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/plugins/kernel_v2/config/vm.rb:137:in `network'
        from C:/Users/dev/Vm/Vagrantfile:18:in `block in <top (required)>'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/config/v2/loader.rb:37:in `call'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/config/v2/loader.rb:37:in `load'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/config/loader.rb:104:in `block (2 levels) in load'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/config/loader.rb:98:in `each'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/config/loader.rb:98:in `block in load'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/config/loader.rb:95:in `each'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/config/loader.rb:95:in `load'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/environment.rb:261:in `config_global'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/environment.rb:495:in `block in action_runner'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/action/runner.rb:28:in `call'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/action/runner.rb:28:in `run'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/environment.rb:274:in `hook'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/environment.rb:135:in `initialize'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/bin/vagrant:62:in `new'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.1/bin/vagrant:62:in `<top (required)>'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/bin/vagrant:23:in `load'
        from C:/Program Files (x86)/HashiCorp/Vagrant/embedded/gems/bin/vagrant:23:in `<main>'

If I go with config.vm.network :public_network everything works fine.

Windows 7 x64
Vagrant 1.2.1
Oracle VirtualBox 4.2.12 r84980

Most helpful comment

The new syntax is

config.vm.network :private_network, ip: "33.33.33.33"

I need to do a better job of catching this sort of misuse.

All 13 comments

The new syntax is

config.vm.network :private_network, ip: "33.33.33.33"

I need to do a better job of catching this sort of misuse.

just went through the same thing, didnt know the syntaxis change
i guess its because many blogs out there are not updated, like this blog shows how to use fluentd with vagrant and still uses old syntaxis "hostonly" http://dev.classmethod.jp/server-side/server/fluentd-clustering/

The Vagrant: Up and Running book uses the old syntax too: http://chimera.labs.oreilly.com/books/1234000001668/ch04.html#_basic_usage_2

Why was the syntax changed in the first place? This is causing people pain, I have to rewrite my Vagrant scripts. What was the benefit.? It seems like using Vagrant has gained the pitfalls of 'works for me' problems that it was supposed to solve by precisely defining VMs. Sorry but I just want to get on and debug my actual website code, not debug the tools that setup my LAMP stack i.e Vagrant.

@therobyouknow If you're unhappy with the new syntax you can stick with the old syntax and it works just fine, just make sure it is in a V1 (Vagrant.configure("1") or Vagrant::Config.run) block. I'm sorry. The syntax was changed so that it would be less confusing in the long run with multiple providers.

@mitchellh - thanks so much for responding, honoured to hear from the creator of Vagrant! Thanks for the V1 tip - that will help, it's appreciated. Though I'd like to move with the times and rework my scripts. I will also update my end-to-end start from scratch setting up Vagrant guide, here: http://stackoverflow.com/a/15067918/227926

Hi, I tried the new synxtax. It worked. But I still need 'host-only' network interface, because I need to connect to host network, not between virtual machines internally. I cannot ping from host to guest's internal IP.
Could someone tell me how to do that in Vagrant, not in Virtualbox GUI. Thanks

config.vm.network :private_network, ip: "192.168.56.10"

that works for me.

On Sat, Apr 19, 2014 at 4:45 PM, chrisd [email protected] wrote:

Hi, I tried the new synxtax. It worked. But I still need 'host-only'
network interface, because I need to connect to host network, not between
virtual machines internally. I cannot ping from host to guest's internal IP.
Could someone tell me how to do that in Vagrant, not in Virtualbox GUI.
Thanks

—
Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/1628#issuecomment-40860688
.

I mean I don't see my host IP for subnet 192.168.56.0/24 as host-only network as usual. For host-only network, I usually get a IP like 192.168.56.100 for my host. So how would I access to private network of guess without a valid IP.

in Virtualbox, you have, nat, bridge, private, and host only.

can past the line you have in your vagrant file and a screesshot how the network look in Virtualbox gui once the vm is created?

Vagrant crashing on:
config.vm.network :private_network, :auto_config => true, :ip => "10.0.0.5", :netmask => "255.255.255.0"

top of the stack:
.vagrant.d/gems/gems/vagrant-windows-1.6.0/lib/vagrant-windows/windows_machine.rb:62:in winrmshell': undefined methodwinrmshell' for #VagrantPlugins::CommunicatorWinRM::Communicator:0x00000002d6d560 (NoMethodError)
from /home/usernamehere/.vagrant.d/gems/gems/vagrant-windows-1.6.0/lib/vagrant-windows/guest/cap/configure_networks.rb:19:in `configure_networks'

I have tried this in different spots of my Vagrantfile. I have tried without the netmask and auto_config false. Always the same. Any clue?

@muk302 You need to uninstall the vagrant-windows plugin

I don't remember installing that plugin. Thank you.

Now that I look at the path, it all makes sense now. I know...noobs.

Was this page helpful?
0 / 5 - 0 ratings