port forwarding thru iptables

Luca Ferrari fluca1978 at infinito.it
Tue Dec 23 08:25:38 UTC 2008


Hi all,
I've got a problem doing a port forwarding, in the meantime I've used an ssh 
forwarding but I'd like to solve it thru iptables. The scenario is this: I've 
got a firewall that protects a server that exposes web services, I'd like to 
redirect each connection to the firewall on the port 3663 to the port 80 of 
the web server, so I added the following rules in my iptables configuration:

$IPTABLES -A INPUT   -p tcp -d $FIREWALL            --dport 3663   -j ACCEPT
$IPTABLES -t nat -A PREROUTING  -p tcp -d $FIREWALL --dport 3663   -j DNAT --
to $WEB_SERVER:80

however I cannot connect to the web server (I tested with telnet). There are 
no other rules that block the connection (I guess) since it works out of the 
box with an ssh port forwarding, so what is wrong with the above 
configuration?

Thanks,
Luca






More information about the ubuntu-users mailing list