SSH to Hyper-V Guest without IP Address

PR Code - Christopher Pateman
2 min readMar 3, 2021

--

I have uses the Dotnet Core Nuget package SSH.NET to SSH into machines a few times, is a very simple, slick and handy tool to have. However, you cannot SSH into a Virtual Machine(VM) in Hyper-V that easy without some extra fiddling to get an exposed IP Address.

With your standard SSH command you can run the simple:

This can have many other attributes, but lets keep it simple.

If your VM has an IP Address assigned to the Network Adapter then this can still be very simple, with using the user for the machine and the IP Address as the host.

However, not every VM in some situation will have an IP Address and therefore you cannot connect to it like this.

You can though if you use the Hyper-V Console CLI(HVC). If installed it can be located in ‘ C:\Windows\System32\hvc.exe ' and it is normally install when enabling the Hyper-V Feature in Windows. This tool enables your to communicate to your VM via the Hyper-V Bus in-between your local machine and the VM.

To use this tool you can run the same SSH command but with the HVC prefix.

Read more on the original post here > https://prcode.co.uk/2021/03/03/ssh-to-hyper-v-virtual-machine-using-ssh-net-without-ip-address/

--

--

PR Code - Christopher Pateman
PR Code - Christopher Pateman

Written by PR Code - Christopher Pateman

I’m a Azure DevOps Engineer with a wide knowledge of the digital landscape. I enjoy sharing hard to find fixes and solutions for the wider community to use.

No responses yet