Can't access VM's from inside WSL2 on Windows
Describe the bug I'm trying to create some VM's with mutlipass and access them from inside WSL2 on my Windows 10. What I want to achieve is to setup SWARM nodes using multipass and manage those from my WSL2 Ubuntu I can't ping any of created VM's
To Reproduce How, and what happened?
PS C:\Users\fdrzewiecki_wa> multipass set local.bridged-network=ExternalSwitch
PS C:\Users\fdrzewiecki_wa> multipass launch --bridged
Launched: endless-sow
PS C:\Users\fdrzewiecki_wa> multipass networks
Name Type Description
Default Switch switch Virtual Switch with internal networking
Ethernet ethernet Intel(R) Ethernet Connection (14) I219-V
Ethernet 6 ethernet Dell Giga Ethernet
ExternalSwitch switch Virtual Switch with external networking via "Ethernet"
WSL switch Virtual Switch with internal networking
WiFi wifi Intel(R) Wi-Fi 6E AX210 160MHz
PS C:\Users\fdrzewiecki_wa> multipass list
Name State IPv4 Image
endless-sow Running 172.19.63.199 Ubuntu 20.04 LTS
node Running 172.19.56.201 Ubuntu 20.04 LTS
node1 Running 172.19.49.155 Ubuntu 20.04 LTS
quality-jerboa Running 172.19.55.124 Ubuntu 20.04 LTS
172.19.52.250
PS C:\Users\fdrzewiecki_wa>
fdrzewiecki@9BG9HG3:~$ ping 172.19.48.1
PING 172.19.48.1 (172.19.48.1) 56(84) bytes of data.
^C
--- 172.19.48.1 ping statistics ---
18 packets transmitted, 0 received, 100% packet loss, time 17656ms
Expected behavior I would like to be able to ping and access VM's from inside WSL2
Additional info
- OS: Windows 10 Enterprise 19044.1586
- `C:\Users\fdrzewiecki>multipass version
multipass 1.9.0+win`
- `PS C:\Users\fdrzewiecki_wa> multipass info --all
Name: endless-sow
State: Running
IPv4: 172.19.63.199
Release: Ubuntu 20.04.4 LTS
Image hash: 9a0f10025864 (Ubuntu 20.04 LTS)
Load: 0.00 0.00 0.00
Disk usage: 1.3G out of 4.7G
Memory usage: 433.8M out of 912.5M
Mounts: --
Name: node
State: Running
IPv4: 172.19.56.201
Release: Ubuntu 20.04.4 LTS
Image hash: 9a0f10025864 (Ubuntu 20.04 LTS)
Load: 0.00 0.00 0.00
Disk usage: 1.3G out of 4.7G
Memory usage: 417.1M out of 912.5M
Mounts: --
Name: node1
State: Running
IPv4: 172.19.49.155
Release: Ubuntu 20.04.4 LTS
Image hash: 9a0f10025864 (Ubuntu 20.04 LTS)
Load: 0.88 0.18 0.06
Disk usage: 1.3G out of 4.7G
Memory usage: 395.7M out of 912.5M
Mounts: --
Name: quality-jerboa
State: Running
IPv4: 172.19.55.124
172.19.52.250
Release: Ubuntu 20.04.4 LTS
Image hash: 9a0f10025864 (Ubuntu 20.04 LTS)
Load: 0.00 0.00 0.00
Disk usage: 1.3G out of 4.7G
Memory usage: 415.6M out of 912.5M
Mounts: --l`
Additional context Add any other context about the problem here.
Hi @h00jraq,
That's an interesting use case you are trying to set up :slightly_smiling_face:
So I think what's happening here is that you need to make Windows be able to route traffic between the WSL switch (which is what WSL uses for networking) and either the Default Switch (which is what Hyper-V uses for networking) or the ExternalSwitch you created. I don't see an IP address for ExternalSwitch connection, so I think you also need to have DHCP running for that switch.
I'll leave this open for a little while if you have some more general question that we can try to help with. We aren't experts on Windows networking, so I don't know how much we can help, but we can try. Otherwise, this isn't a Multipass issue.
Soo I was able to solve that problem with help of that post: https://github.com/microsoft/WSL/issues/4288#issuecomment-656991493
but there is another problem :).
DNS does not work. I could not ping any domain from ubuntu.
I've fixed that by manually editing /etc/resolv.conf but it is being overwritten every few minutes so DNS resolution does not work.
I guess this is because of DHCP lease time and maybe DHCP overwrite it:
Default resolf.conf looks like that:
nameserver 127.0.0.53 options edns0 trust-ad search mshome.net
I can ping using IP but dns resolution does not work. If I will change server to 8.8.8.8, it works for short time.
I was able to resolv that by installing resolvconf and adding new dns server in
/etc/resolvconf/resolv.conf.d/tail
but I'm pretty sure there has to be an easier solution.
I guess all of this would not be a problem If I could run Multipass inside WSL2 but it looks like I can't create any VM inside WSL2:
fdrzewiecki@9BG9HG3:~$ multipass launch
launch failed: KVM support is not enabled on this machine.
Please ensure the following:
1. The system's CPU supports virtualization.
2. Virtualization is enabled in the system BIOS.
3. The KVM kernel modules are loaded.
I think I can live with using Multipass in Windows but I would need to use cloud-init to automate some stuff like update dns, install updates and docker.
Enabling Virtualization in VirtualBox and VMware Ubuntu 22.04 guest OS installed on vmware or virtualbox running on Windows 10 cannot start because the multipass CPU does not support virtualization during installations in kubernetes tutorial.
By running Powershell or CMD.exe with Administrator rights in Windows 10; systeminfo For Windows 10, the host's information about virtualization is displayed with the command. Hyper-V Requirements: Virtualization Enabled In Firmware: Yes In the field of virtualization; If Yes or Enabled; in the cd C:\Program Files\Oracle\VirtualBox directory; VBoxManage modifyvm "VirtualMachineName" --nested-hw-virt on It is solved by running the command, it was already solved when Hyper-V was turned off in vmware.
If No or Disabled, it is enabled from BIOS or UEFI and Hyper-V is disabled; bcdedit /set hypervisorlaunchtype off HyperV is turned off with the command, after this command restart is required.
To remove HyperV feature in Windows 10; DISM /Online /Disable-Feature /All /FeatureName:Microsoft-Hyper-V Or Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor
bcdedit in the command output; It should be "hypervisorlaunchtype Off".
This is a Windows/WSL2/Hyper-V limitation and is unfortunately not something we can overcome in Multipass itself.