#!/bin/bashbash
iptables -Ftcp
iptables -Xrest
iptables -P INPUT DROPip
iptables -P FORWARD DROPtable
iptables -P OUTPUT DROPiptables
iptables -A INPUT -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPTservice
iptables -A OUTPUT -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPTudp
iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPTtab
iptables -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPTvi
iptables -A INPUT -p udp --dport 53 -j ACCEPT
iptables -A INPUT -p udp --sport 53 -j ACCEPT
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
iptables -A OUTPUT -p udp --sport 53 -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A OUTPUT -p icmp -j ACCEPT
/sbin/service iptables save
/sbin/service iptables restart