iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
วิธี Block spam ด้วย Iptables
rm -rf /root/spamhaus.sh
nano /root/spamhaus.sh
chmod 777 /root/spamhaus.sh
./root/spamhaus.sh
crontab -e
0 3 * * * /root/spamhaus.sh
service iptables stop
rm -rf /mnt/iptables
wget –no-check-certificate https://myip.ms/files/blacklist/csf/latest_blacklist.txt -O /mnt/iptables
IPT=/sbin/iptables
SPAMLIST=”spamlist”
SPAMDROPMSG=”SPAM LIST DROP”
BADIPS=$(egrep -v -E “^#|^$” /mnt/iptables)
# create a new iptables list
$IPT -N $SPAMLIST
for ipblock in $BADIPS
do
$IPT -A $SPAMLIST -s $ipblock -j LOG –log-prefix “$SPAMDROPMSG”
$IPT -A $SPAMLIST -s $ipblock -j DROP
done
$IPT -I INPUT -j $SPAMLIST
$IPT -I OUTPUT -j $SPAMLIST
$IPT -I FORWARD -j $SPAMLIST