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?

  • Could you please specify the NAT of Virtual Machine and NAT of machine from which you want to access the virtual machine? – Abhijeet Kasurde Jun 29 '12 at 11:04

A. Top post

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

C. You can access KVM machine with VNC

| improve this answer | |

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:


| improve this answer | |
  • I've tried and it told me the network stack is unavailable. I also noticed that from the Host i am unable to PING the VM (vice versa works though). Any other ideas? – user6 Jun 27 '12 at 7:41
  • 1
    I got this error message: user mode network stack not in use – Jay Cummins Sep 1 '17 at 11:52

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

| improve this answer | |

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.