Hi
I have currently got a script that goes like this
<code>
echo " Clearing any existing rules and setting default policy.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F
echo " FWD: Allow all connections OUT and only existing and related ones IN"
#$IPTABLES -A INPUT -p ICMP -j DROP
#$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -p tcp -m tcp --sport 80 -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -p udp -m udp --sport 80 -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -p tcp -m tcp --sport 53 -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -p udp -m udp --sport 53 -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -p tcp -m tcp --sport 42 -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG
echo " Enabling SNAT (MASQUERADE) functionality on $EXTIF"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
</code>
To my understanding this script sets a policy to drop all packets that need to be routed and then states which protocols should be forwarded. As it stands it doesn't work although everything I've read says it should. If I remove the port specifications then the script works but forwards everything which is obviously not what I need.
Any Ideas what I'm leaving out or where I'm going wrong?
I have currently got a script that goes like this
<code>
echo " Clearing any existing rules and setting default policy.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F
echo " FWD: Allow all connections OUT and only existing and related ones IN"
#$IPTABLES -A INPUT -p ICMP -j DROP
#$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -p tcp -m tcp --sport 80 -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -p udp -m udp --sport 80 -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -p tcp -m tcp --sport 53 -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -p udp -m udp --sport 53 -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -p tcp -m tcp --sport 42 -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG
echo " Enabling SNAT (MASQUERADE) functionality on $EXTIF"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
</code>
To my understanding this script sets a policy to drop all packets that need to be routed and then states which protocols should be forwarded. As it stands it doesn't work although everything I've read says it should. If I remove the port specifications then the script works but forwards everything which is obviously not what I need.
Any Ideas what I'm leaving out or where I'm going wrong?