Iptables, Enable and Disable ICMP

Enable ICMP:

iptables -A INPUT -p icmp --icmp-type 8 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type 8 -m state --state ESTABLISHED,RELATED -j ACCEPT

Enable for single IP:

iptables -A INPUT -s IPAddress -p icmp --icmp-type 8 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT-s IPAddress -p icmp --icmp-type 8 -m state --state ESTABLISHED,RELATED -j ACCEPT

Disable ICMP:

iptables -A INPUT -p icmp --icmp-type 8 -m state --state NEW,ESTABLISHED,RELATED -j DROP
iptables -A OUTPUT -p icmp --icmp-type 8 -m state --state ESTABLISHED,RELATED -j DROP 

Save the iptables rules:

iptables-save > /etc/sysconfig/iptables

Be the first to comment

Leave a Reply

Your email address will not be published.


*