Disable and enable ping on Linux servers

Source: Internet
Author: User

Disable and enable ping on Linux servers

Modify/proc/sys/net/ipv4/icmp_echo_ignore_all to 1. Disable ping from 0.

Sysctl-w net. ipv4.icmp _ echo_ignore_all = 1.

Another method is iptables-based ping.

Iptables-a input-p icmp -- icmp-type 8-s 0/0-j DROP

The ping Command sends an ICMP request packet to the destination IP address, and then the destination IP address returns an ICMP packet. The preceding command discards the ICMP packet of the request using iptables to disable ping.

In the preceding three methods, they are all temporary modifications and will expire after the machine is restarted. To take effect permanently, change the/etc/sysctl. conf file.

In the/etc/sysctl. conf file, add

Net. ipv4.icmp _ echo_ignore_all = 1

Then run sysctl-p

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.