Hyper-V VMs (and WSL 2) Unable to Bridge Internet

Greetings All,

This has been killing me for a few weeks now.

Windows 10 Pro, everything working well from Windows.

However, after installing the Hyper-V toolchain and cremating a new VM, I’m unable to access outgoing internet in the guest VM (internet from the host remains fully functional).

The same thing happens with WSL 2 installs. I’ll download Ubuntu 20.04 LTS, from the MS Store, for instance. Ubuntu loads fine, but no outbound traffic. I can’t sudo apt update or even ping google.com (100% packet loss).

I’m sure I’ve muffed up the Virtual Switches or the NAT or whatever that Hyper-V is using but I don’t know how to tell nor can I figure out how to fix it (either I’m finding the wrong tutorials or I’m effing them up when following them).

Anyone have links to some good resources to get this all up and running.

I have tried uninstalling / reinstalling Hyper-V with Windows Add or Remove Features. I have also tried the network reset. But I’m not 100% sure I did it right.

Thanks in advance for your time!

Conversation 9 comments

  • wright_is

    Premium Member
    21 October, 2020 - 3:52 am

    <p>Habe your created a bridge or Nat switch and attached it to the VM? If you are bridging, is the VM getting an IP address (DHCP) , or have you entered it manually? Is it in the correct sub net? </p><p><br></p><p>Is the standard gateway correctly set in the IP settings? (ipconfig /all on Windows or ifconfig on Linux). </p><p><br></p><p>I've not experienced any problems with WSL2.</p><p><br></p><p>Do you have AV or firewall running on the Windows PC? Try turning off the firewall and test again. </p>

    • curtisspendlove

      21 October, 2020 - 11:36 pm

      <blockquote><em><a href="#587601">In reply to wright_is:</a></em></blockquote><p>I tried to manually create a NAT switch in Hyper-V but I don’t think I did it right. </p><p><br></p><p>And this reminded me that I do have Docker s for Windows installed and it works correctly. It seems that it setup a Hyper-V Switch with NAT. </p><p><br></p><p>It seems that Hyper-V can only have one switch with a NAT so if I want Docker and other VMs to be able to route out I think I need to remove it and create one myself that can work for all VMs. </p><p><br></p><p>I’ll also try your ideas of configuring manually instead of via DHCP, etc. </p><p><br></p><p>I am running a couple of UniFi network devices (EdgeRouter as my gateway and DHCP) and an 8 Port PoE switch. I will double check the IP / Submet as well. I’m running pretty standard on 192.168.1.x. But I’m a novice in networking so I wouldn’t be surprised if I had something configured incorrectly. </p><p><br></p><p>Part of my problem is that I’m pretty new to “bridging” and NAT and the differences and such. </p><p><br></p><p>Learning though. And even though this is a bit frustrating it is also kinda fun. </p><p><br></p><p>;)</p><p><br></p><p>Thanks for the Ideas!</p>

      • wright_is

        Premium Member
        22 October, 2020 - 1:06 am

        <blockquote><em><a href="#587786">In reply to curtisspendlove:</a></em></blockquote><p>Bridging means that the VMs can see your network and get an IP address from your DHCP server (Unifi Edge?).</p><p>NAT has its own subnet and needs to assign a network access on that subnet to the VMs and all external traffic must be handled by the PC. That means that the devices should have a different subnet to the main network. </p>

      • infloop

        Premium Member
        23 October, 2020 - 3:11 am

        <blockquote><em><a href="#587786">In reply to curtisspendlove:</a></em></blockquote><p><br></p><p>It could be the case that you got tripped up by the terminology Microsoft uses for their virtual switches, though. The virtual switch types are External, Internal, and Private. Microsoft does not have one that has NAT capabilities like VirtualBox, for example.</p><p><br></p><p>External means the virtual switch binds to a physical network adapter, and any VMs that use the switch will be visible to the physical network that the network adapter is connected to. Internal means it will create a network that is for the virtual machines on the host and the host itself. It will not have access to a physical network. And Private means the virtual switch will create a network that only the virtual machines on the host will be able to see. So more restrictive than Internal as it leaves out the host.</p>

  • markwibaux

    Premium Member
    21 October, 2020 - 9:04 pm

    <p>What type of network are you bridging to, is it wired or wireless?</p><p>If wireless, you could be hitting an issue with broadcast filtering in the configuration of your SSID. Different AP vendors call it different things in the config, it could be "broadcast filtering" or "ARP filtering" in the settings.</p><p>Basically having that enabled will stop the VM being able to get an IP address/communicate over the shared wireless link</p>

    • curtisspendlove

      21 October, 2020 - 11:29 pm

      <blockquote><em><a href="#587775">In reply to MarkWibaux:</a></em></blockquote><p>I appreciate the feedback. I was not aware of this…exactly why I figured this community would have some great ideas. </p><p><br></p><p>I have tried both wired and wireless with the same results. But honestly, I’ve done so many things to try to fix it that it’s tricky to remember specifics. </p><p><br></p><p>:/</p><p><br></p><p>I’m thinking at this point I’m going to do another uninstall of everything potentially using Hyper-V, reset my network, and reinstall in a very specific (but yet-to-be-determined) order. </p>

      • wright_is

        Premium Member
        22 October, 2020 - 1:08 am

        <blockquote><em><a href="#587785">In reply to curtisspendlove:</a></em></blockquote><p>I think also, that the switch uses a fixed adapter. If you set it up for wired, the virtual switch won't work when wired and vice versa. </p><p>I need to get back to my pc to double check that. I'll post again later. </p>

  • curtisspendlove

    25 October, 2020 - 10:38 pm

    <p>Thanks for the input everyone. It all helped and I’m making progress. </p><p><br></p><p>part of the problem is that I’m just used to things working with simpler solutions like VirtualBox. But I see that Hyper-V is more powerful (and therefore more complex). </p><p><br></p><p>It also appears that Docker does some magic voodoo or something and takes over NAT. :: shrug ::</p><p><br></p><p>I’m ripping down and resetting things again tomorrow and will try a few experiments to see what happens. (If it comes down to it I don’t need Docker desktop for Windows, I can just install WSL 2 and call it good. I was just trying to get a nice experience with Docker running since it has some really cool integrations with VS Code.)</p>

  • crboehm

    Premium Member
    28 October, 2020 - 11:16 am

    <p>I've had a couple instances where WSL2 can't reach the internet and in my case it was a bad entry in the /etc/resolv.conf file.</p><p>After some online searches I added the /etc/wsl.conf file with the following in it:</p><p>[network]</p><p>generateResolvConf = false</p><p>nameserver 1.1.1.1</p><p><br></p><p>I also changed the entry in resolv.conf to </p><p>nameserver 1.1.1.1</p><p><br></p><p>And that did the trick for me.</p>

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Thurrott © 2024 Thurrott LLC