So i found a good example script that i edited to startup and add my rules (/etc/init.d/iptables)
Well.....the error i am getting is this...
Code: Select all
root@clare:/etc/init.d# /etc/init.d/iptables start
bash: /etc/init.d/iptables: /bin/sh^M: bad interpreter: No such file or directory
And here is the script
Code: Select all
#! /bin/sh
IPTABLES=/usr/local/sbin/iptables
case "$1" in
start)
echo -n "Starting IP Firewall and NAT..."
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/tcp_syncookies
# Clear old rules
$IPTABLES -X
$IPTABLES -F
$IPTABLES -Z
$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -j REJECT
echo "done."
;;
stop)
echo -n "Stopping IP Firewall and NAT..."
$IPTABLES -X
$IPTABLES -F
$IPTABLES -Z
# Input Rules
$IPTABLES -A INPUT -j REJECT
$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
echo "done."
;;
restart)
echo -n "Restarting IP Firewall and NAT..."
$0 stop > /dev/null
sleep 1
$0 start > /dev/null
;;
*)
echo "Usage: $0 {start|stop|restart}"
;;
esac