Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a workstation that runs Windows 7 as the host, and Ubuntu Server 12.04 in VMware on a bridged network. Both have their own static public IP address.

However, I only have one hostname to work with, so I'm trying to access them both with a single hostname: example.com. I think it would be best to give the hostname to the Ubuntu VM, since I only need one port open on the Windows machine, which is for RDP.

I've tried setting up iptables to forward connections on port 3389 to the Windows machine, but only with limited success. The connection goes through, but quickly drops and struggles to re-establish. I even have an SSH window open to the Ubuntu machine at the same time, and it severely lags when I attempt to log in over RDP.

Yes, I could simply use the Windows machine's external IP address to access it, but this is more for the coolness factor and learning purposes, as I am not too experienced with iptables yet. Here are my rules: (xxx.xxx.xxx.xxx is the Windows IP address)

iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to-destination xxx.xxx.xxx.xxx:3389
iptables -t nat -A POSTROUTING -j MASQUERADE
sysctl net.ipv4.ip_forward=1

My guess is that I could have incorrectly used NAT, since both have their own public IP and NAT may not be necessary. That, or it could be that I'm overflowing something with a potential infinite loop.

Any help is greatly appreciated!

share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.