Skip to main content

Posts

Showing posts with the label iptables

How to Block Ping ICMP Requests using UFW

Some system administrators often block   ICMP   messages to their servers in order to hide the Linux boxes to outside world on rough networks or to prevent some kind of IP flooding and denial of service attacks. The most simple method to block   ping command   on Linux systems is by adding an   iptables   rule, as shown in the below example.   Iptables   is a part of Linux kernel   netfilter   and, usually, is installed by default in most Linux environments. # iptables -A INPUT --proto icmp -j DROP # iptables -L -n -v [List Iptables Rules] Another general method of blocking ICMP messages in your Linux system is to add the below kernel variable that will drop all ping packets. # echo “1” > /proc/sys/net/ipv4/icmp_echo_ignore_all In order to make the above rule permanent, append following line to   /etc/sysctl.conf   file and, subsequently, apply the rule with   sysctl   command. # echo “net.ipv...