24

So I just created the VM and I have no idea why I don't have network connectivity. I've tried a bunch of things to troubleshoot the issues, mostly the following in different combinations:

  • Created internal and external Virtual Switches in Virtual Switch Manager
  • In VM Settings > Network Adapter I've tried selecting both of these virtual switches and have "Enable virtual LAN identification" checked
  • In Windows > Network Connections on my local machine I can see both the internal and external switches. I tried sharing my local ethernet connection with the external but that didn't work
  • In Windows > Network Connections I tried sharing the External Virtual Switch with the Internal but no dice
  • On the Ubuntu side of things I've gone into the Wired connection settings and then IPv4 and set it to automatic, and when that didn't work tried manual. I gave it a known available IP address, netmask, and gateway, but that didn't work either

So where I stand now is I have Ubuntu showing that the wired connection is connected, but I can't access the internet. Any ideas as to how I can troubleshoot this further? I can post screenshots if necessary, but it looks like I can only add 2 per post because I don't have a high enough reputation. Thanks!

2
  • Same issue here. No solution yet. – Kay Dec 20 '16 at 5:09
  • Encountered same issue with Ubuntu 18.04.1 LTS – Dun0523 Oct 3 '18 at 9:13
26

I had the same issue on Ubuntu 17.04 running on Hyper-V/Windows 10.

The solution was quite simple once I found out. It looks like the default install option is to use Internal network, which does not grant internet access.

On the Ubuntu virtual machine in Hyper-V:

  1. right click to get to the settings
  2. navigate to the Network adapter
  3. select the Network adapter and in the Virtual switch drop-down list change from "Layered_wi_fi" to "Not connected"
  4. go to the Virtual Switch Manager (on the right in the Hyper-V manager)
  5. select Layered_Wi-fi in the Virtual Switches section
  6. change Connection type from "Internal network" to "External network"

Back on the Ubuntu virtual machine in Hyper-V:

  1. right click to get to the settings
  2. navigate to the Network adapter
  3. select the Network adapter and in the Virtual switch drop-down list change from "Not connected" to "Layered_wi_fi"

Note: first I tried to simply to change from Internal network to External (steps 4-6) in the Virtual Switch Manager\Layered_Wi-fi section. This generated an error repeatedly. I think it was because the setting was in use, but it was not very clear. Once I did steps 1-3 first it worked like a charm.

1
  • Great, except I had to create new switch and called it "Wi-Fi" – Qwerty Dec 3 '18 at 22:36
5

Steps to troubleshoot no internet connection on Ubuntu virtual machine in Hyper-V:

  • In your VM's Hyper-V settings, connect the network adapter to the Default Switch which gives access to host computer's network.
  • In Ubuntu VM, go to Ethernet settings, then select IPv4 tab. Set IPv4 Method to Automatic (DHCP). In front of DNS turn Automatic to OFF, and enter 1.1.1.1,1.0.0.1 for CloudFlare's DNS. Click Apply. Turn off Ethernet and turn back on. I've found this is necessary for changes to take effect, so make sure to turn the Ethernet off and on every time you change Ethernet settings.

For most cases the above should fix the problem, but if it didn't there are a few more things you can try.

  • In Ubuntu VM, go to Ethernet settings. On Details tab verify that IPv4 Address is in the same network as the host computer on the Default Switch. To verify that, run ipconfig on the host machine, and take a note of the IPv4 Address under Default Switch, for example 172.10.100.15. In Ubuntu VM, if the first 3 parts of the IPv4 Address are the same, for example 172.22.100.75 then they are on the same network. If not, go to IPv4 tab and set IPv4 Method to Manual. Then enter addresses as follows:
    • Address: Set it to some IP that is in the same network as the host machine on Default Switch.
    • Netmask: Set it to Subnet Mask of the host machine on Default Switch.
    • Gateway: Set it to the IP address of the host machine on Default Switch.
  • Apply the changes and turn Ethernet off and on again.

Other things to try:

  • If your router has Access Control enabled, then whitelist the MAC address of the network adapter of the Ubuntu VM.
  • Make sure the network category of the NIC on the switch you are connecting to is "Private".
$Profile = Get-NetConnectionProfile  -InterfaceAlias "vEthernet (Default Switch)"
$Profile.NetworkCategory = "Private"
Set-NetConnectionProfile -InputObject $Profile
  • Try installing a Legacy Network Adapter on the VM. You need to use a Generation 1 VM to have this option.
  • Try creating and connecting to an External Virtual Switch and go through the above troubleshooting steps again, replacing Default Switch with External Switch.
3

try adding a "legacy network adapter" and setting

the normal network adapter is made to work with windows 7+ if not earlier

I hoped that this helped you and many more

I had this problem with reactos and XP and this worked fine

to add a nework switch you can use as a legacy network adapter do the following:

  1. open Virtual Switch Manager
  2. select New virtual network switch
  3. select External
  4. create virtual switch
  5. name it what ever you want

To add the switch to your VM:

  1. open settings for desired VM
  2. Add Hardware
  3. Legacy network adapter
  4. add
  5. open the drop-down for the Virtual Switch
  6. select the virtual switch you made

note: only 1 switch may be used by a VM at a time

0
3
  1. In Hyper-V manager go to "Virtual Switch Manager..."
  2. click "New virtual network switch" and choose "External" from the list then click "Create Virtual Switch"
  3. In new virtual switch pane give it a name and choose "External network" as connection type and choose your NIC that you are currently using in Windows host, plus make sure that you've checked box "Allow management operating system to share this network adapter" then hit "OK" then confirm that you understand your connection will be lost for a while.
  4. Right click on your ubuntu virtual machine in Hyper-V manager and choose "Settings".
  5. Go to Netowk Adapter and choose your new virtual external switch from the dropdown list as "Virtual switch" and confirm "OK"
0
0

Selecting the "Default Switch" during VM creation resulted in the eth0 being assigned an ip from DHCP. Window10 and Ubuntu 18.04

I managed to ssh in from host.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.