Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Security»How to Block Ping (ICMP) Responses in Linux

    How to Block Ping (ICMP) Responses in Linux

    By RahulMarch 19, 20232 Mins Read

    Blocking Ping (ICMP) responses in Linux can be an effective way to improve security and reduce unnecessary network traffic. Ping is a commonly used network diagnostic tool that sends a packet to a network device and waits for a response. By default, Linux systems respond to Ping requests, but you can disable this feature using the following steps.

    Advertisement

    Step 1: Check if ICMP is enabled

    Before you proceed with the steps, you need to check if ICMP is enabled on your system. To do this, open a terminal and type the following command:

    sysctl net.ipv4.icmp_echo_ignore_all 
    

    If the output is net.ipv4.icmp_echo_ignore_all = 0, it means that ICMP is enabled, and you can proceed with the next steps.

    Step 2: Disable ICMP responses

    To disable ICMP responses, you need to edit the sysctl.conf file. This file contains system-wide settings that are loaded during boot time. Open the file in a text editor with root privileges:

    sudo nano /etc/sysctl.conf 
    

    Add the following line at the end of the file:

    1
    net.ipv4.icmp_echo_ignore_all = 1

    Save the file and exit the editor. Then reload the sysctl settings with the following command:

    css

    sudo sysctl -p 
    

    This will apply the new setting immediately. From now on, your Linux system will not respond to Ping requests.

    Step 3: Verify the changes

    To verify that the changes have been applied, try to Ping your Linux system from another device on the network. If the Ping command returns no response, it means that ICMP has been successfully disabled.

    Conclusion

    Disabling ICMP responses in Linux can be a useful security measure to prevent network attacks and reduce unnecessary traffic. By following the steps outlined above, you can easily block Ping requests and improve the security of your system.

    dos icmp iptables ping
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Preventing SQL injection attacks with prepared statements in MySQL

    Firewalld: Common Firewall Rules and Commands

    How to block bad bots using .htaccess

    View 5 Comments

    5 Comments

    1. Shahzad on April 14, 2021 9:50 am

      this will block all the icmp request even if i add my legitimate ip into the truested zone. cloud you please guide how to allow specific ip address using firewalld not iptables.

      Reply
    2. Esmaeil on November 8, 2019 6:17 am

      Nice Bro Thank You Thats Work For ME!

      Reply
    3. abir on March 31, 2019 4:22 am

      i am using centos 7 . i want to disable icmp ping in my centos machine.
      and i already apply those command Disable Ping using iptables..but not works!!

      i want to solution..
      Thanks.

      Reply
    4. Someone on August 23, 2016 8:55 pm

      Change DROP to ACCEPT

      Reply
    5. Muzafar on April 28, 2016 11:00 pm

      Hi, i disabled ping using this command chain “# iptables -A INPUT -p icmp –icmp-type echo-request -j DROP”, how can i enable it back?

      Thanks,

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.