This is the script, put it in /etc/init.d/iptables and ln -s /etc/init.d/iptables /etc/rcS.d/S39iptables

#!/bin/bash
case “$1″ in
start)
echo -n “Staring to write your Iptbales:…”
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -p icmp -m icmp –icmp-type any -j DROP
/sbin/iptables -A INPUT -p all -m state –state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -p all -m state –state INVALID,NEW -j DROP
echo “Ok”
;;
stop)
echo -n “Cleaning your Iptables:…”
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -Z
echo “Ok”
;;
restart)
echo -n “Cleaning your Iptables:…”
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -Z
echo “Ok”
echo -n “Staring to write your Iptbales:…”
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -p icmp -m icmp –icmp-type any -j DROP
/sbin/iptables -A INPUT -p all -m state –state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -p all -m state –state INVALID,NEW -j DROP
echo “Ok”
;;
*)
echo “Usage: $0          {start|stop|restart}”
esac
exit 0