#!/bin/sh
#
# rc.firewall - Initial SIMPLE IP Masquerade test for 2.1.x and 2.2.x kernels $
#
# Load all required IP MASQ modules
#
# NOTE: Only load the IP MASQ modules you need. All current IP MASQ modules
# are shown below but are commented out from loading.
EXTERNAL_INTERFACE="eth0"
EXT_IP=xx.xxx.xx.xx
WEB_SERVER=192.168.0.22
#because you are going to forward the request later with ipmasqadm
ANYWHERE="any/0"
UNPRIVPORTS="1024:65535"
#Make sure all port forwarding is denied, then allow incoming requests to be forwarded to your NAT
#via your external connection interface (i.e. eth0)
/sbin/ipchains -P forward DENY
/sbin/ipchains -A forward -i eth0 -j MASQ
#Flush ipmasqadm
/usr/sbin/ipmasqadm portfw -f
#Acessing remote websites
ipchains -A output -i $EXTERNAL_INTERFACE -p tcp -s $EXT_IP $UNPRIVPORTS -d $ANYWHERE 80 -j ACCEPT
ipchains -A input -i $EXTERNAL_INTERFACE -p tcp ! -y -s $ANYWHERE 80 -d $EXT_IP $UNPRIVPORTS -j ACCEPT
#Allowing incoming requests to your LAN (for port 3450 in your case)
ipchains -A input -i $EXTERNAL_INTERFACE -p tcp -s $WEB_SERVER $UNPRIVPORTS -d $ANYWHERE 3450 -j ACCEPT
ipchains -A output -i $EXTERNAL_INTERFACE ! -y -p tcp -s $ANYWHERE 3450 -d $WEB_SERVER $UNPRIVPORTS -j ACCEPT
ipchains -A forward -i $EXTERNAL_INTERFACE -p tcp -s $WEB_SERVER $UNPRIVPORTS -d $ANYWHERE 3450 -j MASQ
#we are allowing NAT forwarding of this request with ipchains
What I'm trying to do is get port forwarding to work .... this is basically a very slimmed down version of my rc.firewall.old right now because I'm trying to troubleshoot what is going wrong. I suck at this stuff so please bear with me. I'm trying to forward port 3450 to my web box which is internal .. what am I doing wrong? Please .. thanks.
