LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   port forwarding (https://www.linuxquestions.org/questions/linux-newbie-8/port-forwarding-452398/)

Braynid 06-07-2006 08:39 AM

port forwarding
 
Hello again,
I now have the following problem. First my configuration is: Ubuntu RC 6.06 server with:
eth0 the 'internet' connection
eth1 the lan with the ip 192.168.0.1
On my Windows computer i have the ip 192.168.0.10, the linux is setup to be a 'router' with
Code:

iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

Due to the fact that i'm away most of the time i need to be able to connect to both my computers, on the linux machine i use ssh, and for the windown i what to use a popular program Remote Administrator (radmin) that uses port 4899 (this can be changed). So what i want to do is to be able to access on port 4899 the windows PC trough my linux. I tried port forwarding with some commands found on this forum:
Code:

iptables -t nat -A PREROUTING -p tcp -d 192.168.0.1 --dport 4899 -j DNAT --to 192.168.0.10:4899
that did now worked so i tried
Code:

iptables -t nat -A PREROUTING -p tcp -d 82.76.84.224 --dport 4899 -j DNAT --to 192.168.0.10:4899
So what am i doing wrong?
Thanks!

MasterC 06-08-2006 03:19 AM

You may need to specify the device "-i eth1".

Oh, just found the article I was hunting for, check this out for more info on port fowarding in linux:
http://www.hackorama.com/network/portfwd.shtml

Cool

Braynid 06-08-2006 10:21 AM

Ok so this did the trick:
Code:

iptables -t nat -A PREROUTING -p tcp -i eth0 -d 82.76.84.224 --dport 4899 -j DNAT --to 192.168.0.10:4899


All times are GMT -5. The time now is 03:39 AM.