How to connect via RDP to my Hyper-V machine?

9,786

I did try using A to RDP to my VM via it's PC name and that works without issue. So how would I connnect to the VM from B?

The Hyper-V Guest Machine in Machine A defaults to a NAT network, nominally 172.16.x.y. I verified this on my on Hyper-V Guest machine.

You need to change your Hyper-V Guest machine to "Bridged" Networking. Hyper-V calls it External. Same thing.

I am using a Kali Linux Guest machine. You need to set up for your Guest Machine.

Summary:

  1. Add an External Switch (Bridged Mode) to the Hyper-V Manager on Machine A.
  2. Change the network settings in the Guest to External and restart the Guest and make a note of the IP address.
  3. Add RDP Protocol (xrdp) to the Guest if necessary. Windows Guest does not need this - already there.
  4. Log out of the guest machine (but do not shut it down).
  5. From Machine B. open RDP, enter the IP of the Machine A guest, user name and connect.

It works.

1. Add an External Switch to Hyper-V

enter image description here

2. Change the Guest Settings to use the External Switch (Bridged Mode).

enter image description here

If your Guest Machine is Linux, be sure to set up xrdp

Set up xrdp on Linux

sudo apt install xrdp

sudo systemctl enable xrdp

3. On Machine B, connect by RDP. Be sure to log out of the Guest machine A. RDP will log out of a Windows Guest but does not know what to do with a Linux guest.

enter image description here

4. It all works. I am working on Machine B. Here is a screen shot of Kali on Machine A

enter image description here

I have carefully laid out all the steps so you can change Hyper-V as needed and so you can see that it all works assuming you use an External Switch (Bridged Mode). NAT will not allow you to connect.

Share:
9,786

Related videos on Youtube

Haris
Author by

Haris

Updated on September 18, 2022

Comments

  • Haris
    Haris over 1 year

    I am in my home network with two machines set up: A and B. Both are running Win 10 Pro and have been updated regularly (no outstanding updates as of my check today).

    A is the host machine where the VM is set up and stored, B is the machine I am using to actually access the VM. Using Hyper-V Manager, it's possible for me without any issues to access the VM on A from B. Now, I want to go down the RDP route in connecting to my VM. As far as I understand, Hyper-V Manager is already using RDP to connect, it's just packaged a bit differently.

    However if I try to use RDP... I am lost how to actually connect. What I have tried so far:

    • Use the PC name of my VM. RDP gives me an error telling me it can't find the machine
    • Use the IP as displayed in Hyper-V Manager in the Network section (and also the same as ipconfig returns on the VM itself). Here the result is that I am getting a can't connect error.

    I did try using A to RDP to my VM via it's PC name and that works without issue. So how would I connnect to the VM from B?

    • John
      John almost 3 years
      I did try using A to RDP to my VM via it's PC name and that works <-- Your Hyper-V guests is likely a NAT connection (mine is). I think you may need to try a Bridged connection for a different machine to access the guest on machine A.
    • John
      John almost 3 years
      I solved your problem - Any luck?
  • Haris
    Haris almost 3 years
    That's a great suggesstion. Thanks for the detailed explanation. I see now that it has to be a bridged connection and I tried it out getting exactly the expected result! This in itself has led me to a different set of problems (internet connection is now spotty on both the host machine and the VM when using the bridged connection...) but that's a topic for a different question.
  • John
    John almost 3 years
    Yes. Hyper-V setup (NAT, Bridged, other settings) should not affect the host machine. I had no connection issues here on either machine or opening the Guest machine via RDP. Not here at any rate. I will watch for your other question.
  • SeriousTyro
    SeriousTyro over 2 years
    Thanks. This worked for me.