Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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

3 Answers 3

up vote 1 down vote accepted
+50

A. Top post

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

C. You can access KVM machine with VNC

share|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:

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

share|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

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.

I don't have the ServerFault rep to post an image, but here is the selection in the virt-manager window: http://vanappdeveloper.com/wp-content/uploads/2013/07/mcatvmm.png

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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