hashicorp/vagrant-vmware-desktop

VM bound to non-existing NIC

mexmirror opened this issue · 0 comments

When creating a VM with Vagrant with certain images (see Vagrantfile for an example), an interface is chosen which does not exist. The command then stops at "Waiting for the VM to receive an address...".

When configuring the interface manually, using the API in the Vagrantfile(see below), it does work fine.

Vagrant version

$ vagrant -v
Vagrant 2.3.7

Vagrant VMware plugin version

$ vagrant plugin list
vagrant-vmware-desktop (3.0.3, global)

Vagrant VMware utility version

$ /opt/vagrant-vmware-desktop/bin/vagrant-vmware-utility -v
1.0.22

Host operating system

I am currently running macos Ventura 13.6 (22G120).

Guest operating system

GuestOS is Ubuntu 22.04

Vagrantfile

This is the non-working Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = 'fasmat/ubuntu2204-desktop'
  config.vm.box_version = '22.0509.1'
  config.vm.hostname = 'test'

  config.vm.provider "vmware_desktop" do |vmware, override|
  end
end

This produces a VMX file which contains a wrong Ethernet configuration:

ethernet0.addresstype = "generated"
ethernet0.connectiontype = "nat"
ethernet0.present = "TRUE"
ethernet0.virtualdev = "e1000e"

When comparing this section with a VMX file for a VM created manually with VMWare

ethernet0.connectionType = 'nat'
ethernet0.addressType = 'generated'
ethernet0.virtualDev= 'e1000'

This can be fixed by translating the correct settings into the Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = 'fasmat/ubuntu2204-desktop'
  config.vm.box_version = '22.0509.1'
  config.vm.hostname = 'test'

  config.vm.provider "vmware_desktop" do |vmware, override|
      vmware.vmx["ethernet0.connectionType"] = 'nat'
      vmware.vmx["ethernet0.addressType"] = 'generated'
      vmware.vmx["ethernet0.virtualDev"] = 'e1000'
  end
end

Debug output

Here is the log using the --debug flag when creating and starting the VM.

Here is the log using the same command, but with the working Vagrantfile.

Expected behavior

VM should be created with a working network interface.

Actual behavior

VM is created with a non working network interface

Steps to reproduce

  1. Use provided Vagrantfile
  2. vagrant up
  3. Wait until the VM booted