1

I’m wondering if it is possible to connect to a HyperV Guest from the Host. The guest is a Linux machine and the Host is a Win 10 Pro.

Specifically, I cannot ssh to the Linux Guest from the Host. I can ssh locally from the Guest to itself, so I know that the ssh server is correctly setup on the Guest. There are a few other servers I have setup on the Guest, but I cannot access any of them from the Host, but only locally from the Guest. (I have also tied these other servers to 0.0.0.0)

All Firewalls on the Host have been turned off, so this is not an issue. (Does Linux esp. Ubuntu have a Firewall by default. I don’t recall setting anything up.) On the Guest, I can access the internet. I can also ping the Guest from the Host. Other than that nothing else works i.e. no ssh or telnet.

ssh 192.168.0.5
ssh: connect to host 192.168.0.5 port 22: Connection refused

telnet 192.168.0.5 22
Connecting To 192.168.0.5...Could not open connection to the host, on port 22: Connect failed

For the Guest, I have setup a Virtual Switch exactly as it is mentioned in Create a virtual switch by using Hyper-V Manager i.e. the top half that that page. The settings on the virtual switch look like:

Settings on VM Virtual Switch

The settings on the network adapter on the Guest look like:

Settings on Network Adapter on Guest

I have not set the VLAN ID anywhere. I have installed XRDP on the Linux Guest and can connect to it via RDP without any issues. Other than these things I don't think I have anything unusual i.e. I have chosen the default setup for everything i.e. Host OS, Guest OS etc.


Possible Solution:

Since, I could not connect from the host, I solved this by adding a Network Adapter on the VM and connected it to the Default Switch as mentioned in What’s new in Hyper-V for Windows 10 Fall Creators Update? - Default Switch So now I have two Network Adapters on the VM, and connections from the Host to the VM go through this switch. I'm not sure if this is the best solution, but at least it works.

migrated from serverfault.com Nov 18 '18 at 2:08

This question came from our site for system and network administrators.

1

For your need, we could try another method that called PowerShell Direct new introduced in Win10 and windows server 2016. PowerShell Direct lets you remote connect to a Windows Virtual Machine running on a Hyper-V host, without any network connection inside the VM. PowerShell Direct uses the Hyper-V VMBus to connect inside the Virtual Machine. HVC SSH is basically SSH Direct of Linux VMs. It allows to connect to a Linux VM using SSH over the Hyper-V VMBus. You are also able to copy file inside a virtual machines using scp. Please refer to the following link for details. https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/

  • Thank you Mick. I just didn't want to connect to the VM using Power Shell, but also access Servers I had on the VM. This does not solve my problem, I think this may help other's who need PowerShell or SSH. – O.O. Dec 8 '18 at 18:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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