Ubuntu 16.04 VM on Windows 10 Hyper-V - No Network Connectivity
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!
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:
- right click to get to the settings
- navigate to the Network adapter
- select the Network adapter and in the Virtual switch drop-down list change from "Layered_wi_fi" to "Not connected"
- go to the Virtual Switch Manager (on the right in the Hyper-V manager)
- select Layered_Wi-fi in the Virtual Switches section
- change Connection type from "Internal network" to "External network"
Back on the Ubuntu virtual machine in Hyper-V:
- right click to get to the settings
- navigate to the Network adapter
- 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.
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 example172.10.100.15
. In Ubuntu VM, if the first 3 parts of the IPv4 Address are the same, for example172.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.
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:
- open Virtual Switch Manager
- select New virtual network switch
- select External
- create virtual switch
- name it what ever you want
To add the switch to your VM:
- open settings for desired VM
- Add Hardware
- Legacy network adapter
- add
- open the drop-down for the Virtual Switch
- select the virtual switch you made
note: only 1 switch may be used by a VM at a time
- In Hyper-V manager go to "Virtual Switch Manager..."
- click "New virtual network switch" and choose "External" from the list then click "Create Virtual Switch"
- 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.
- Right click on your ubuntu virtual machine in Hyper-V manager and choose "Settings".
- Go to Netowk Adapter and choose your new virtual external switch from the dropdown list as "Virtual switch" and confirm "OK"