Connecting internet to WSL2 and Hyper-V

Please excuse my laymen question. I have never had to do this before but I am wanting to have my ethernet internet connection to work within both of these programs.

Could someone please point in the direction of how to do this?

Can you specify a bit about what exactly you want? You get internet access from your hosts physical connection by default.

If you want WSL2 and a HyperV VM to have IP addresses on your Hosts network that requires more configuration.

HyperV vms should allow you to change the virtual network adapter to host which would allow your VM to have an IP address on your host network.

image

See Accessing network applications with WSL | Microsoft Docs for more WSL info.

For me it is more that I cant get hyper v and WSL2 to recognize my internet connection.

Ubuntu on WSL2 for example says it is not connected yet my PC is always connected via my gigabit Ethernet connection.

@WilliamPayne, what version of Ubuntu are you running in WSL2? If it is 17.04 or higher, you might need to configure your ethernet connection manually. Search how to configure Netplan.

Cool ill have a look. I figured it would be something like that.

@WilliamPayne If you have any more questions or trouble setting up Netplan, please feel free to reach out.

I didn’t change anything but the internet seems to now be working in wsl2 as it allowed me to update all the packages. I wish I had had to have done something so that I could have learned what was going on but it is nice that it is working.

1 Like

I decided to do @wendell udemy course just to learn for the sake of learning. VirtualBox is far more easier to work with than Hyper V I am finding. Stuff is just working in VirtualBox that is not working in Hyper V