Comments on: HVC – SSH Direct for Linux VMs on Hyper-V https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/ Cloud and Datacenter Blog focusing on Microsoft Azure Thu, 21 Apr 2022 01:05:38 +0000 hourly 1 https://wordpress.org/?v=6.4.1 By: Brian https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/#comment-874928 Thu, 21 Apr 2022 01:05:38 +0000 https://www.thomasmaurer.ch/?p=9271#comment-874928 @Paul, I finally figured this out. In answer to your question “Do you have to do anything specific on either guest or host in order to get the Ubuntu VM to ‘listen’ for incoming SSH connections on the VMBus (as opposed to the TCP/IP stack).” the answer is yes! The SSH service needs to know to listen on the VMBus as well as the TCP/IP stack. On my Ubuntu system I edited, /usr/lib/systemd/system/ssh.socket and added

ListenStream=vsock::22

after the existing line that said,

ListenStream=22

You then need to restart the ssh.socket service for the change to take effect.

]]>
By: Clayms https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/#comment-738062 Mon, 23 Sep 2019 13:37:41 +0000 https://www.thomasmaurer.ch/?p=9271#comment-738062 Hi Thomas,

Version info below:

Major Minor Build Revision
—– —– —– ——–
10 0 17763 0

However, I suspect `hvc` is calling `ssh` from the the install of [OpenSSH](https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse) which is installed in ‘C:\Program Files\OpenSSH\’ and that is what is causing the problem.

I don’t know why it only has a problem when I actually specify a username@vmname to ssh into.

How would I tell hvc to quote the path to the ssh executable?

]]>
By: Thomas Maurer https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/#comment-737965 Sun, 22 Sep 2019 15:49:59 +0000 https://www.thomasmaurer.ch/?p=9271#comment-737965 In reply to Clayms.

Hi Clayms

This is strange, which version of Windows 10 are you running?

]]>
By: Clayms https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/#comment-737569 Wed, 18 Sep 2019 18:20:21 +0000 https://www.thomasmaurer.ch/?p=9271#comment-737569 From PowerShell, `hvc id test_vm` correctly returns the VM’s ID and `hvc list` shows that the ‘test_vm’ `STATUS` is `running`.

Also, `hvc ssh` returns the ‘hvc ssh’ command usage options.

However, `hvc ssh root@test_vm` returns:
‘C:\Program’ is not recognized as an internal or external command, operable program or batch file.

Obviously, hvc is in the PATH variable, so what is going on here?

]]>
By: Alfredo https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/#comment-724412 Tue, 19 Mar 2019 13:58:49 +0000 https://www.thomasmaurer.ch/?p=9271#comment-724412 Hi Thomas,
thanks for the reply.
Yes, ssh over tcp/ip working properly.
Any other suggestions?

]]>
By: Thomas Maurer https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/#comment-723938 Tue, 12 Mar 2019 08:38:21 +0000 https://www.thomasmaurer.ch/?p=9271#comment-723938 In reply to Alfredo.

Did you configure SSH Server within the Linux machine?

]]>
By: Alfredo https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/#comment-723936 Tue, 12 Mar 2019 08:32:37 +0000 https://www.thomasmaurer.ch/?p=9271#comment-723936 Hi,
I created a linux vm on a hyper-v host (Windows 2019).
On the Linux vm (CentOS) I have installed and configured the integration services and I have
tried to connect via SSH Direct (HVC nc vm-name -t vsock port(??)) but I got the following error:

“No connection could be made because the target machine actively refused it.”

Any suggestions?

Thx

]]>
By: ben https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/#comment-721468 Fri, 01 Feb 2019 09:49:37 +0000 https://www.thomasmaurer.ch/?p=9271#comment-721468 As this is the 1st result in Google et al., I’ll put my understanding here, hoping it helps.
I had the same issue and digging into it, hvc.exe does not connect to ssh through VMBus: if you add ‘-v’ to see what’s going on under the hood, you can see that hvc.exe will try vsock (VMBus) 1st but will fallback to ip (TCP/IP) in case it does not work. As OpenSSH does not support vsock and only listen on TCP/IP, hvc.exe ends up using regular TCP/IP. If you do not have IP connectivity between HyperV and you VM, you are screwed.
I ended up writing a quick&dirty VMBus-to-TCP proxy to be able to connect to my Linux VM through VMBus using socat: https://github.com/bganne/hvnc
HTH

]]>
By: István Nagy https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/#comment-715203 Thu, 06 Dec 2018 15:38:27 +0000 https://www.thomasmaurer.ch/?p=9271#comment-715203 @Paul I wouldn’t be surprised if this only works with Red Hat Enterprise Linux or CentOS as a guest. Vmbus Sockets is only supported on those according to Microsoft. I haven’t yet tried though.

]]>
By: Paul https://www.thomasmaurer.ch/2018/04/hvc-ssh-direct-for-linux-vms-on-hyper-v/#comment-715176 Wed, 05 Dec 2018 22:58:31 +0000 https://www.thomasmaurer.ch/?p=9271#comment-715176 Thx for the reply @István.

@Thomas mentions in this blog post that “to make this work, the SSH server inside the VM needs to be configured”.

Other than ensuring that SSH is installed within the guest OS, I’m wondering whether there is some additional configuration of SSH that is required to allow it to ‘bind to’ or ‘listen’ on the VMBus, as opposed to a normal TCP socket.

]]>