Focus on cloud service provider activities
Notes on website operation and maintenance

One click fast implementation of the Linux server disable ping and enable ping method

When we netizens use Linux servers, the general host vendors enable PING. For example, we can ping the delay speed of the server. Of course, there are special cases. For example, Alibaba Cloud prohibits PING through security group settings. We can delete the items corresponding to the security group and enable PING. In fact, most of our hosts do not have security groups. If you need to disable and enable PING, you can use the following methods.

 One click fast implementation of the Linux server disable ping and enable ping method

First, the PING method is prohibited

1. Temporary prohibition of PING

echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all

Temporary method. If we restart the server, it will be restored to its original state, because we have not set it to the startup item.

2. PERMANENTLY PROHIBITED PING

Edit the "/etc/sysctl. conf" file, and then find the parameter after "net.ipv4.icmp_echo_ignore_all" and change it to 1. If not, let's add a line.

net.ipv4.icmp_echo_ignore_all=1

Then execute "sysctl - p" to take effect.

Second, PING method is allowed

1. Allow PING temporarily

echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_all

2. PERMANENTLY PERMITTED PING

echo net.ipv4.icmp_echo_ignore_all=0 >> /etc/sysctl.conf

Or we can learn to find the file above, change it to 0 parameter, and then execute "sysctl - p" to take effect.

It should be noted here that some ECS vendors can set them directly in the security group, and we do not need to set them in the server configuration file.

Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » One click fast implementation of the Linux server disable ping and enable ping method


Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge