So I setup a windows 2008 web server R2 on VirtualBox.

Currently using Bridged Network.

I can remote desktop to the machine hosting the VM ( but cannot remote desktop to the VM itself (

The remote port on the VM set to 5003. VM setup to accept remote connections (windows side).

We also use a proxy for our internet, and I added these rules under NAT. (centOS 5) on our proxy box.

-A INPUT -p tcp --dport 3389 -j ACCEPT
-A REROUTING -i ppp0 -p tcp --dport 3389 -j REDIRECT --to-port 5003
-A FORWARD -d --dport 5003 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

I've been trying for hours and hours and just cannot get it to work.

I also used freedns so that we can use a domain name to connect too this VM over the internet. (the DNS points to our external IP address).

If we don't get this right we will have to purchase a PPoE from an ISP to connect to this VM remotely, but I know that there is an alternative route if I can just get this port forwarding right!

  • 1
    can you... - ping from ping from any remote host? establish a remote desktop connection to from Also - what have you done to set 5003 as the remote desktop port? – the-wabbit Sep 20 '12 at 20:11
  • Alternatively: can you use SSH port forwarding from a connection to your CentOS box to to establish a RDP connection? – the-wabbit Sep 20 '12 at 20:17
  • I wonder if the bridging link goes through iptables. – Antti Rytsölä Sep 20 '12 at 20:41

To clarify the situation, I'll the machine hosting the virtualbox as the router.

The REDIRECT on the second line states all connections going past the router to be redirected to the router itself. This is probably not what you want.

If you put:

-A PREROUTING -i ppp0 -p tcp --dport 5003 -j DNAT --to

then all connections to port 5003 would be forwarded to port 5003. You might also need:


to make sure the reply packets come back to the router. You might also need some FORWARD entries to make it is allowed and possibly net.ipv4.ip_forward=1

  • another way to do it would be to run tcpforward, dual netcats or localhost-ssh to forward the connection to "external" host. – Antti Rytsölä Sep 20 '12 at 20:51
  • @HopelessN00b Thanks. My english ain't perfect. – Antti Rytsölä Sep 25 '12 at 7:16

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.