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

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 (10.0.0.183) but cannot remote desktop to the VM itself (10.0.0.195).

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 10.0.0.195 --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!

share|improve this question
1  
can you... - ping 10.0.0.195 from 10.0.0.183? ping 10.0.0.195 from any remote host? establish a remote desktop connection to 10.0.0.195 from 10.0.0.183? 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 10.0.0.195:5003 to establish a RDP connection? –  the-wabbit Sep 20 '12 at 20:17
    
I wonder if the bridging link goes through iptables. –  anttiR Sep 20 '12 at 20:41
add comment

1 Answer

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 10.0.0.195

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

-A POSTROUTING -d 10.0.0.195 -j SNAT

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

share|improve this answer
    
another way to do it would be to run tcpforward, dual netcats or localhost-ssh to forward the connection to "external" host. –  anttiR Sep 20 '12 at 20:51
    
@HopelessN00b Thanks. My english ain't perfect. –  anttiR Sep 25 '12 at 7:16
add comment

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.