What I have:
Windows 8.1 professional edition

What I want?
To simulate a circumstance: connect a remote Linux system using SSH.

What I do:
Install CentOS 6.4 x64 under the built-in Hyper-v. It works like a charm.

What is the question?
How to connect to this hyper-v CentOS via a terminal by SSH?

5 Answers 5


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.

  • 2
    Finally, I open a SSH in CentOS at Hyper-V, figure out its IP and then using putty in windows to connect to this hyper-v instance via this IP,works like a charm.
    – Albert Gao
    Nov 29, 2013 at 9:42
  • 1
    Is my case, the IP isn't the same as LAN adapter IP, I have to get into CentOS VM to get IP via command ip address
    – John Jang
    Nov 19, 2018 at 8:58
  • 1
    Also, don't forget to actually install the SSH server sudo apt install openssh-server.
    – Monsignor
    Jul 15, 2020 at 12:32

I think the people missed one point so I'm going to elaborate really short. Guest - Virtual Machine, Linux, Host - WIndows 10

  1. Make sure that the guest os (linux) can access the internet (as long as you use default switch in the hyper-v manager that's fine).

  2. in the guest, install net-tools and open ssh server. You need sudo privilidges.
    a. either sudo su, if not possible su root, provide the password. You will get a # instead of a $.
    b. # apt-get install net-tools,
    or, $ sudo apt-get install net-tools if you are not root. Use sudo infront of each command if you are not root from herein.

c. apt-get install -y openssh-server - openssh server will now install.

  1. Edit the configuration file for openssh once it's installed, it's in path /etc/ssh/ssh_config
    nano /etc/ssh/ssh_config

  2. Command text editor opens, key down to the line #Password Authentication yes, make sure that the # is removed (i.e the statement is uncommented, so it looks like):
    Password Authentication yes . All is well? Continue on.

  3. disable and enable ssh - because we just configured it.
    a. # systemctl disable ssh
    b. # systemctl enable ssh you can also try if somehow above commands are not working: -> # systemctl stop ssh
    -> # systemctl start ssh "In the end, make sure that you check that the ssh is running" --> # systemctl status ssh
    Peace of mind, When you are sure ssh is running

  4. Find the ip of your guest os (linux). The ip looks like and comes with a subnet mask ( and default gateway (172.xyz.xyz.xyz. You need the ip, the first one that you find. You will need this ip on your host machine. Also remember your hostname. It is on your terminal, eg: misskiller@debian, here hostname is *misskiller

On the terminal type:
a. ip address (you will most likely find the ip of your computer in the eth0 adapter, for ease to read in the mess, you can also type command as below -> (alternative way, longer command but easy fish)
b. ip address | grep -i eth0 (this is optional just for your ease, you can just go with 6. a)

  1. On your Host Machine, you can either use Putty or directly your PowerShell to connect.

SSH INTO THE GUEST*. For this example: hostname: misskiller, ip:
A. From PowerShell Type this:
ssh misskiller@ (basically hostname@ip)
You will be asked for the password that you setup at your machine. Type your password properly. You should be logged in now. B. From Putty: same, just input the ip address in the hostname and press enter, type password into the terminal and you should be in there too. This works - Tried and tested. :-)

  • 1
    Welcome to SU. Your answer shows one way how to do it, so I don't understand why it got downvoted. However, please edit your answer and put all code in code boxes (instead of writing it as bold text).
    – Binarus
    Nov 5, 2020 at 21:38

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.


Solution that I use to SSH into VMs with default switch (dynamic internal IP) with one command:

  • Enable static Mac address in the VM: In Hyper-V manager go to VM settings -> Network Adapter -> Advanced Features -> Mac address -> Static.
  • In PowerShell add the following to $profile file (e.g. open with notepad $profile):
function GuestVmSsh {
    ssh user@$((arp -a | findstr /i 00-00-00-00-00-00).Split(" ")[2].Trim())

Set-Alias guest-vm GuestVmSsh

change user to your guest system user and 00-00-00-00-00-00 to your static mac address specified in the first step.

  • Additionally, to make sure the above script is executed during shell startup, appropriate execution policy should be set. One way is to execute the following as Administrator:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

After that you should be able to SSH into your guest VM by executing guest-vm in PowerShell.

New contributor
Vitalii Vitrenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

I am not sure if this is a universal answer or not, but after failing to see much success using other recommendations, I did the following and it worked:

My guest machine, which is a CentOS 7 box, is using a "default network" switch.

On the guest, I ran the "ifconfig" command to look at the ip for the box:

eth0: flags=4163 mtu 1500 inet

I then typed in that IP address to Putty, and lo and behold, it connected. Magic networking FTW.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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