0

I set up an Ubuntu 18.04 vm with Hyper-V on a Windows 10 machine. The vm has internet access via the default virtual network switch, but I'm not able to ping it or ssh from the host using its eth0 IPv4 address that I got from ifconfig.

VM IP: 172.28.141.148

Host IP: 172.25.153.63

I set up the virtual switch with the default virtual switch. I believe it was already configured.

3
  • How did you setup HyperV switch? What's PC's IP and VM IP?
    – Hannel
    Mar 15, 2020 at 17:49
  • @Hannel I updated the post.
    – CSeal
    Mar 15, 2020 at 21:48
  • @Hannel Thanks for the help! I am now trying to ssh to the host with the IP listed in 'lo' instead of 'eth0', and my connection is being refused by vm host. This is an improvement over the 'no route to host'. I'm able to ping the vm now using the lo IP.
    – CSeal
    Mar 18, 2020 at 7:22

1 Answer 1

1

Looking at the information you provide you might have a bad NAT setup because if done right you should be able to SSH. Just create a new NAT on the HyperV, set VM to use new NAT, and see if you get the same issue.

On host using PowerShell run;

$switchName = "InternalNAT"
New-VMSwitch -Name $switchName -SwitchType Internal
New-NetNat –Name $switchName –InternalIPInterfaceAddressPrefix "192.168.0.0/24"
$ifIndex = (Get-NetAdapter | ? {$_.name -like "*$switchName)"}).ifIndex
New-NetIPAddress -IPAddress 192.168.0.1 -InterfaceIndex $ifIndex -PrefixLength 24

If you do no have DHCP on the host you will need to set IP manually on guest VM to an IP in the NAT range.

Then you should be able to SSH into VM from Host on port 22

Reference:

https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .