Hi,
I thought I'd share the port forwarding script I wrote with the OpenWRT community. It is quite simple, but it makes it very easy to forward a port, just execute:
port_forward tcp 119 192.168.1.2
I'll paste it in below:
#!/bin/sh
WAN=$(nvram get wan_ifname)
# ensure a valid protocol is specified
if [ "$1" != "tcp" -a "$1" != "udp" ]
then
echo "Specify a protocol (tcp or udp)."
echo "Usage: `basename $0` [tcp|udp] [port] [IP]"
exit
fi
# check that the port range is valid
if [ -z "$2" -o "$2" -le 1 -o "$2" -ge 65536 ]
then
echo "Specify a port number."
echo "Usage: `basename $0` [tcp|udp] [port] [IP]"
exit
fi
# check for IP address validity
ipcalc $3 > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "Specify a LAN ip address."
echo "Usage: `basename $0` [tcp|udp] [port] [IP]"
exit
fi
iptables -t nat -A prerouting_rule -i $WAN -p $1 --dport $2 -j DNAT --to $3
iptables -A forwarding_rule -i $WAN -p $1 --dport $2 -d $3 -j ACCEPT