Question

I'm getting this error:

There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* An IP is required for a private network.

when I follow this documentation: http://docs.vagrantup.com/v2/networking/private_network.html and specify that I want DHCP to assign the IP address like so:

config.vm.network "private_network", type: "dhcp"

Anyone know how to get this working?

EDIT:

I have also just tried:

config.vm.network :private_network, type: :dhcp

which works and assigns an IP address of 10.0.2.15, but I don't understand this as my DHCP server assigns addresses in the 192.168.1.x range? Does this stuff actually ever work for anyone?

Était-ce utile?

La solution

If you want your Vagrant box to pull from the same DHCP your host box does, use this line in your Vagrantfile:

config.vm.network :public_network, :auto_config => true

This corresponds to a VBox bridged network, which it sounds like you want.

edit: added the auto_config bit. It should ask you which adapter you want to use when it boots; you can also specify :bridge => "en1" (or whatever your adapter happens to be named; en1 is my Macbook's USB ethernet) on that line to hard-code a host adapter name.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top