{"id":2019,"date":"2012-02-18T23:36:53","date_gmt":"2012-02-18T15:36:53","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=2019"},"modified":"2023-04-28T09:49:55","modified_gmt":"2023-04-28T09:49:55","slug":"how-to-deny-icmp-ping-request-on-centos-6-2","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-deny-icmp-ping-request-on-centos-6-2\/","title":{"rendered":"How to Deny ICMP Ping Request on CentOS 6.2"},"content":{"rendered":"<p>Ping is a computer network administration utility used to test the reachability of a host on an Internet Protocol (IP) network. Ping operates by sending Internet Control Message Protocol (ICMP) echo request packets to the target host and waiting for an ICMP response. ICMP protocol is used by ping command to check the connectivity between two computers. By defaults all Linux CentOS servers will response on ICMP request. Hacker can misuse this service. They can generate countless ping requests to your Linux server. This is what called DOS denial of services.<\/p>\n<p>Before changes, i can ping 192.168.1.44 as below :<\/p>\n<pre>\nD:\\>ping 192.168.1.44\n\nPinging 192.168.1.44 with 32 bytes of data:\n\nReply from 192.168.1.44: bytes=32 time=1ms TTL=64\nReply from 192.168.1.44: bytes=32 time=1ms TTL=64\nReply from 192.168.1.44: bytes=32 time=2ms TTL=64\nReply from 192.168.1.44: bytes=32 time=1ms TTL=64\n\nPing statistics for 192.168.1.44:\n    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),\nApproximate round trip times in milli-seconds:\n    Minimum = 1ms, Maximum = 2ms, Average = 1ms\n<\/pre>\n<p>In this post, i will show on how to block ICMP ping request from others.<\/p>\n<p><strong>Method 1 :<\/strong><br \/>\nTo disable ICMP ping immediately, type the following command :<\/p>\n<pre>\n[root@centos62 ~]# echo  1 > \/proc\/sys\/net\/ipv4\/icmp_echo_ignore_all\n<\/pre>\n<p><strong>Method 2 :<\/strong><br \/>\nTo disable ICMP ping after reboot, modify the \/etc\/sysctl.conf as below. This will permanently disable the ICMP ping echo. Kindly append at the end line of the file :<\/p>\n<pre>\n[root@centos62 ~]# vi \/etc\/sysctl.conf\n<\/pre>\n<pre>\n..\n..\n..\n# Controls the maximum size of a message, in bytes\nkernel.msgmnb = 65536\n\n# Controls the default maxmimum size of a mesage queue\nkernel.msgmax = 65536\n\n# Controls the maximum shared segment size, in bytes\nkernel.shmmax = 4294967295\n\n# Controls the maximum number of shared memory segments, in pages\nkernel.shmall = 268435456\n\nnet.ipv4.icmp_echo_ignore_all = 1\n<\/pre>\n<p>Change will take effect after reboot :<\/p>\n<pre>\n[root@centos62 ~]# reboot\n<\/pre>\n<p>Try to ping again. The server will not reply now :<\/p>\n<pre>\nD:\\>ping 192.168.1.44\n\nPinging 192.168.1.44 with 32 bytes of data:\n\nRequest timed out.\nRequest timed out.\nRequest timed out.\nRequest timed out.\n\nPing statistics for 192.168.1.44:\n    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Ping is a computer network administration utility used to test the reachability of a host on an Internet Protocol (IP) network. Ping operates by sending Internet Control Message Protocol (ICMP)&#8230;<\/p>\n","protected":false},"author":6,"featured_media":1554,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055],"tags":[1244,1253,1475,1536,1660,1744],"class_list":["post-2019","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos","tag-centos-6-2","tag-icmp","tag-linux","tag-ping","tag-security"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/2019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=2019"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/2019\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/1554"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=2019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=2019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=2019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}