Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support networks that use type: "dhcp" #45

Open
TronPaul opened this issue Dec 22, 2014 · 3 comments
Open

Support networks that use type: "dhcp" #45

TronPaul opened this issue Dec 22, 2014 · 3 comments

Comments

@TronPaul
Copy link

Setup:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define :thing1 do |box|
    box.vm.box = "ubuntu/trusty64"
    box.vm.hostname = "thing1"
    box.vm.network :private_network, type: "dhcp"
    box.vm.provision :hosts
  end
end

What happens:

The hosts file added to the guests looks like

 thing1

What should happen:

The host file looks like

<DHCP-ADDRESS> thing1

where is the IP address assigned.


I went digging for if the IP of the guest vm could be grabbed from somewhere in vagrant, but I wasn't able to find where that might be. Until someone smarter than me figures out how to do that, I think the best solution is to ignore guest networks that are using DHCP to get their IP addresses for now.

@TronPaul TronPaul changed the title Empty IP addresses when using `type: "dhcp" Empty IP addresses when using type: "dhcp" Dec 22, 2014
@glenux
Copy link

glenux commented May 25, 2015

Some clues here : devopsgroup-io/vagrant-hostmanager#86

Seems to work from ruby with VBoxManage guestproperty get #{vm.id} "/VirtualBox/GuestInfo/Net/1/V4/IP".split()[1]

@brijs
Copy link

brijs commented Oct 25, 2015

DHCP isn't supported. I believe vagrant hosts plugin only supports private_network, and only when ip address is explicitly specified in the Vagrantfile. See vagrant-hosts/address.rb

Sharpie added a commit that referenced this issue Nov 8, 2015
The `vagrant-hosts` plugin currently does not pull information from dynamic
sources such as DHCP network interfaces or provider-specific SSH info.

Ref #45
@Sharpie
Copy link
Member

Sharpie commented Nov 8, 2015

DHCP isn't supported. I believe vagrant hosts plugin only supports private_network

This is correct. vagrant-hosts only pulls from private_network configuration. Added a note to the README that clarifies this and marking this issue as a feature request.

@Sharpie Sharpie changed the title Empty IP addresses when using type: "dhcp" Support networks that use type: "dhcp" Nov 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants