Allow or Block ICMP Ping Request via IPTABLES

ICMP adalah sebuah protokol yang digunakan jika anda melakukan ping request dan ping reply.
ICMP mengenal 2 type yaitu :
0 => echo reply
8 => echo request

Berikut ini adalah script IPTables nya :
Enable or Allow ICMP ping incoming client request

SERVER_IP="192.168.0.1"
iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -d $SERVER_IP -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT


iptables -A OUTPUT -p icmp --icmp-type 0 -s $SERVER_IP -d 0/0 -m state --state ESTABLISHED,RELATED -j ACCEPT

Allow or Enable Outgoing Ping Request

SERVER_IP="192.168.0.1"
iptables -A OUTPUT -p icmp --icmp-type 8 -s $SERVER_IP -d 0/0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT


iptables -A INPUT -p icmp --icmp-type 0 -s 0/0 -d $SERVER_IP -m state --state ESTABLISHED,RELATED -j ACCEPT

Disable Outgoing ICMP Request
iptables -A OUTPUT -p icmp --icmp-type echo-request -j DROP
atau
iptables -A OUTPUT -p icmp --icmp-type 8 -j DROP

Selamat mencoba :)

Referensi :
http://www.cyberciti.biz/tips/linux-iptables-9-allow-icmp-ping.html

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer