1) Add the following line to your /etc/sysctl.conf
net.ipv4.icmp_echo_ignore_all=1
Then :
sysctl -p
2) Using iptables:
iptables -I INPUT -p icmp --icmp-type echo-request -j DROP
3) The cron job way , run crontab -e
, then add the following line:
@reboot echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
Start and enable the service:
systemctl start cron.service
systemctl enable cron.service