nsidc / vagrant-vsphere

VMware vSphere provider for Vagrant
Other
608 stars 166 forks source link

Specifying IPv4 address removes default gateway #290

Closed KaliszAd closed 4 years ago

KaliszAd commented 4 years ago

I have everything working but the final step of changing the IP from the customization specification to a different one. In the process of applying the customization specification, the default gateway setting specified there gets removed. I even tried to use the "Alternative Gateway" option in the customization specification, which doesn't fix the problem.

This is a Debian 10 machine. The new /etc/network/interfaces does everything correctly but specifying the gateway. Instead of a simple statement, there is up route add default gw 192.168.1.1 on two lines. This is a problem, since the route command is part of net-tools and not iproute2, which is the current tool box installed by default.

Everything else, as I have written, would be ok. I imagine a configuration like:

config.vm.network 'private_network', ip: '192.168.1.222', netmask: '255.255.255.0', gateway: '192.168.1.1'

would probably enable more fine grained changes. But the gateway option doesn't seem to exist.

KaliszAd commented 4 years ago

As I predicted, having net-tools (ifconfig, route commands) installed is a viable workaround at least for a working default gateway. You might not be able to change the default gateway to a different one in the Vagrantfile, the one from the customization specification will be taken. Depending on net-tools is probably not the best option but it is workable.