Edit: resolved using info I found here iptables port forwarding on debian
I'm trying to set up svn on my existing web server, and for some reason the same technique I use for forwarding to web servers through my router isn't working for the different port for svn. I wrote the following simple shell script to add a server
#!/bin/bash
#!/bin/sh
ROOT_UID=0
if [ $UID -ne $ROOT_UID ]
then
echo "You must be root."
exit 87
else
echo "Adding FORWARD entry..."
iptables -I FORWARD 5 -p tcp -i eth1 -d $1 --dport $3 -j ACCEPT
echo "Adding PREROUTING entries..."
iptables -t nat -I PREROUTING 1 -p tcp -i eth1 --dport $3 -j DNAT --to $1:$3
iptables -t nat -I PREROUTING 2 -p tcp -i ath0 -d $2 -j DNAT --to $1:$3
iptables -t nat -I PREROUTING 3 -p tcp -i eth2 -d $2 -j DNAT --to $1:$3
echo "Adding POSTROUTING entry..."
iptables -t nat -A POSTROUTING -p tcp -o eth2 -d $1 --dport $3 -j MASQUERADE
echo "Done"
exit 0
fi
Where $1 is the internal IP of the server, $2 is the external host name, and $3 is the port. I've also tried opening the port on INPUT as a port scan reveals that the port I'm trying to used is closed after running the above script.
Any help would be appreciated.