Hi,
I found some solutions which may be helpful for you.
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.
For further information, you can check the following link:
https://superuser.com/questions/1096918/ubuntu-16-04-vm-on-windows-10-hyper-v-no-network-connectivity
Please note: Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.
Thanks for your time!
Best Regards,
Mico Mi
-----------------------------
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.