I have a problem with VMware Fusion 7.1.3, Vagrant 1.7.4 and vagrant-vmware-fusion 4.0.2 plugin talking to a Windows Server 2016 TP4 VM through WinRM.
It seems that the vagrant-vmware-fusion plugin catches the wrong IP address 172.16.0.1
from the VM which is only a virtual switch.
This is how it looks like spinning up the Windows VM:
$ vagrant up
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Starting the VMware VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: WinRM address: 172.16.0.1:5985
default: WinRM username: vagrant
default: WinRM transport: plaintext
^C==> default: Waiting for cleanup before exiting...
Inside the VM I have the following network cards:
PS C:\Users\vagrant> ipconfig
Windows IP Configuration
Ethernet adapter vEthernet (Virtual Switch):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::851b:ed4b:1436:4710%11
IPv4 Address. . . . . . . . . . . : 172.16.0.1
Subnet Mask . . . . . . . . . . . : 255.240.0.0
Default Gateway . . . . . . . . . :
Ethernet adapter Ethernet 2:
Connection-specific DNS Suffix . : localdomain
Link-local IPv6 Address . . . . . : fe80::91d4:5359:785b:e075%8
IPv4 Address. . . . . . . . . . . : 192.168.254.134
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.254.2
Tunnel adapter isatap.{F8AB9E14-C9C4-4A78-A4F9-966B59BD5D9E}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Tunnel adapter isatap.localdomain:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : localdomain
This is a Windows 2016 TP4 VM with Windows Docker installed and Hyper-V. The installation of Windows docker creates this virtual switch. And somehow the "primary" VMware network card is called "Ethernet 2" and not the first one in the list.
Running the same vagrant up
with debug log shows that the correct IP address 192.168.254.134
is catched in the first place, but after running the vmrun getGuestIPAddress
which returns the virtual switch IP address Vagrant then uses this wrong IP address for WinRM.
$ "/Applications/VMware Fusion.app/Contents/Library/vmrun" "getGuestIPAddress" "/Users/stefan/code/docker-windows-box/.vagrant/machines/default/vmware_fusion/e04a32bc-9b7a-4cbf-9abb-dc5e7f299af7/packer-vmware-iso.vmx"
172.16.0.1
So as the vmrun
seems to retrieve wrong values in some situations would it be a better idea to just use the IP address of the first MAC address match?
Somewhere in the middle of the debug log I found the correct IP address: https://gist.github.com/sethvargo/9a84345f4fafd1490f7e
Hi @StefanScherer - we introduced a configuration option to try and address situations like this one... can you try this in your Vagrantfile?
config.vm.provider "vmware_fusion" do |v|
v.enable_vmrun_ip_lookup = false
end
@phinze Thank you very much! Yes this did it!
$ vagrant up
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Starting the VMware VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: WinRM address: 192.168.254.134:5985
default: WinRM username: vagrant
default: WinRM transport: plaintext
==> default: Machine booted and ready!
==> default: Forwarding ports...
default: -- 3389 => 3389
default: -- 22 => 2222
default: -- 5985 => 55985
default: -- 5986 => 55986
==> default: Configuring network adapters within the VM...
==> default: Configuring secondary network adapters through VMware
==> default: on Windows is not yet supported. You will need to manually
==> default: configure the network adapter.
==> default: Enabling and configuring shared folders...
default: -- /Users/stefan/code/docker-windows-box: /vagrant
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
Although I have a look at the plugin release notes from time to time I didn't catch this one.
Just for the records, this is my Vagrantfile used for Windows Server 2016 TP4 to run it fullscreen in retina mode on a MBP.
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.0"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "windows_2016_tp4"
config.vm.communicator = "winrm"
["vmware_fusion", "vmware_workstation"].each do |provider|
config.vm.provider provider do |v, override|
v.gui = true
v.vmx["memsize"] = "4096"
v.vmx["numvcpus"] = "2"
v.vmx["vhv.enable"] = "TRUE"
v.vmx["hypervisor.cpuid.v0"] = "FALSE"
v.enable_vmrun_ip_lookup = false
end
end
config.vm.provider "vmware_fusion" do |v|
v.vmx["gui.fitguestusingnativedisplayresolution"] = "TRUE"
v.vmx["mks.enable3d"] = "TRUE"
v.vmx["mks.forceDiscreteGPU"] = "TRUE"
v.vmx["gui.fullscreenatpoweron"] = "TRUE"
v.vmx["gui.viewmodeatpoweron"] = "fullscreen"
v.vmx["gui.lastPoweredViewMode"] = "fullscreen"
v.vmx["sound.startconnected"] = "TRUE"
v.vmx["sound.present"] = "TRUE"
v.vmx["sound.autodetect"] = "TRUE"
end
config.vm.provision "shell", path: "scripts/provision.ps1", privileged: false
end
Most helpful comment
Hi @StefanScherer - we introduced a configuration option to try and address situations like this one... can you try this in your Vagrantfile?