vagrant-vsphere icon indicating copy to clipboard operation
vagrant-vsphere copied to clipboard

Private Network IP Assignment Should Ignore DHCP interfaces

Open ozdanborne opened this issue 9 years ago • 1 comments

I'm following the steps to configure a private IP by creating a configuration spec with a static IP address, then specifiying host.vm.network :private_network. Everything is more or less "working".

However, my desired outcome looks like this: eth0 - dhcp - public (accessible from anywhere) - Can SSH from host. eth1 - static - private vlan (not accessible from anywhere except another vagrant-vsphere provisioned VM) - cannot SSH from host.

The problem stems from the fact that due to my network's configuration, I cannot SSH to the box via eth1, only eth0. vagrant-vsphere uses get_ssh_info which always returns the IP of the first interface, in this case, eth0. So my DHCP interface MUST be eth0.

Unfortunately, the static IP provisioner also starts with the first interface, and assumes that it is a static interface. Furthermore, it errors out trying to assign a static IP address if it is a DHCP interface, as in this scenario:

undefined method `ipAddress=' for #<RbVmomi::VIM::CustomizationDhcpIpGenerator:0x00000003dee3d0>

Essentially, It assumes that the FIRST interface is the static interface which it should be configuring. Therefore, I propose that the script be improved to skip over DHCP interfaces, or any interface that does not have a ipAddress setter method.

I will draft up a PR if I can, just wanted to publicize the issue here first

ozdanborne avatar Jan 25 '16 23:01 ozdanborne

having the same issue, any fix for this?

mlrtime avatar Nov 06 '19 12:11 mlrtime