Remote desktop to my KVM virtual machine

I've got a dedicated server running Debian 6. I've set up a windows 7 virtual machine using KVM. Now I'm trying to get Remote desktop working. I'm guessing i have to do some port forwarding.

The virtual machine is in a NAT. Remote desktop is already set up on it (another virtual machine can connect).

I've tried using the iptables and countless of virsh commands of which I'm not even sure what they did.

Anyone knows how to get this working?


Solution 1:

A. Top post

B. Enable ip.forwarding, use standard port forwarding on host with iptables

C. You can access KVM machine with VNC

Solution 2:

What you want to have is port forwarding.

So, if your virtual machine is named 'windows7', you can forward the RDP port by the following command:

virsh qemu-monitor-command --hmp windows7 'hostfwd_add ::13389-:3389'

The first port number is the one which is opened on your hypervisor, and the second one is the one opened by the Windows guest's remote desktop service.

(This was taken from this blog post:

http://blog.adamspiers.org/2012/01/23/port-redirection-from-kvm-host-to-guest)

Solution 3:

I was also unable to get my Windows 7 VM (under KVM) to accept MS Remote Desktop connections despite trying various iptables forwarding rules.

Instead I installed macvtap on the Linux box using the hal package:

sudo apt-get install hal

And restarted virt-manager and was able to select: Host device eth0 (Bridge 'br0') from the list of Source device in the Virtual Network Interface section of the VM's details. This gave my Windows VM a real (non-virtualized) IP from my router and from there (after enabling the Windows Remote Desktop and pass through Windows Firewall) I was able to ping and Remote Desktop in from a machine outside of both the host Linux box and outside my network if desired.

selection in the virt-manager window