Disabling Ping with iptables
ping 127.0.0.1
$ sudo iptables -A INPUT -p icmp --icmp-type echo-request -j REJECT
$ iptables -L
ping 127.0.0.1
Enabling Ping in iptables
$ sudo iptables -D INPUT -p icmp --icmp-type echo-request -j REJECTping 127.0.0.1