How to connect to a local hyper-v virtual machine via SSH?

The simplest solution is to enable a bridged connection, you can find here how to do that. Once you have done this, and started your VM, it will appear on your LAN with an IP just like your host. Then you can ssh into it by means of

 ssh me@IP_of_my_VM 

or whatever you use on Windows, Putty I presume.


I'm going to chime in because the given answer only covers the use case where you want your VM to also be exposed to the internet, and is also more work than necessary. If you want to get this working on a virtual internal network:

  1. Set up the virtual switch as Internal network and apply it to the VM
  2. In the Hyper-V manager, under the networking tab, you should see the IPv6 addresses associated with the VM.
  3. Adjust the width of the columns if necessary or mouse over to reveal the far right IPv6 address (probably starts with fe80). Connect to this IP address using your software of choice.

In the case of the External network, you should see the IPv4 address it is using on the network tab and should be able to connect to that.