I have created a VM on Hyper-V with 2 Network Adapters.
From my command line I was able to connect to the VM with the Nat Switch IP but from WSL Bash I was not able to connect with IP NatSwitch, but able to connect with ExternalSwitch IP.
Why?
While WSL 2 uses Microsoft's Hyper-V as a hypervisor under the hood to run the utility VM, it does not require you to enable Windows' Hyper-V role or feature; WSL works perfectly fine without it.
Does WSL 2 use Hyper-V? Will it be available on Windows 10 Home and Windows 11 Home? WSL 2 is available on all Desktop SKUs where WSL is available, including Windows 10 Home and Windows 11 Home. The newest version of WSL uses Hyper-V architecture to enable its virtualization.
WSL 2 will work with VMware 15.5. 5+ and VirtualBox 6+. Learn more in our FAQs.
WSL can run Windows tools directly from the WSL command line using [tool-name].exe . For example, notepad.exe . Applications run this way have the following properties: Retain the working directory as the WSL command prompt (for the most part -- exceptions are explained below).
Unfortunately this is the expected behavior. (As of 29/01/2021) WSL2 uses Hyper-V Virtual Switch, vEthernet (WSL) virtual network adapter, that is providing internal type Hyper-V network that is only accessible from the VM and the Host. The Hyper-V machine has a different virtual network adapter e.g. vEthernet (Default Switch).
Getting Started with Ubuntu Core on Hyper-V using WSL Ubuntu Core is a tiny, transactional version of Ubuntu Linux from Canonical. Use WSL to convert a KVM image of Ubuntu Core and boot in Hyper-V on Windows.
VS Code Compatibility - WSL 2 / Hyper-V VM - VS Code has an embedded WSL 2 connection type and you can type code . in a terminal to automatically open the current folder. Hyper-V VM projects can connect to VS Code via an SSH connection. Linux Compatibility - WSL 2 / Hyper-V VM - Hyper-V VM is the clear winner here.
I use Hyper-V on Windows 10 to run an Ubuntu 20.04 VM, which I only need in order to run some models for work. Everything has worked fine over several months of regular use. Today on the VM I had to kill a model process that had been set up wrong and was running too long and filling the virtual hard drive.
Unfortunately this is the expected behavior. (As of 29/01/2021)
WSL2 uses Hyper-V Virtual Switch, vEthernet (WSL) virtual network adapter, that is providing internal type Hyper-V network that is only accessible from the VM and the Host. The Hyper-V machine has a different virtual network adapter e.g. vEthernet (Default Switch). If that is set to internal that is a different NAT-ed network (subnet) not connected to the WSL one. It is like the Host having 3 NICs and one cable (Cable 1) going to WSL on a subnet that only exists on that adapter/cable and another cable (Cable2) going to Hyper-V guest with a very different subnet on that NIC.
On the other scenario the Hyper-V guest shares the subnet with the Host machine ("Same subnet as the 3rd cable/NIC.") so it is routed back to the VM. See red labels.
There is a workaround in this GitHub issue using port forwarding to Guest VM from WSL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With