Block ping using iptables in Ubuntu

nano /etc/sysctl.conf
net.ipv4.icmp_echo_ignore_all=1
sysctl -p
sudo iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
sudo iptables -A OUTPUT -p icmp --icmp-type echo-reply -j DROP

then Make iptables rules persistent after reboot on Ubuntu 18.04

References
https://vitux.com/how-to-block-allow-ping-using-iptables-in-ubuntu/
http://ubuntuhandbook.org/index.php/2013/07/disable-ping-response-ubuntu-server/