Home  >  Article  >  System Tutorial  >  Linux's love-hate relationship with ping packages

Linux's love-hate relationship with ping packages

WBOY
WBOYOriginal
2024-09-02 14:01:10939browse

Linux systems allow ping by default, but in some cases for security reasons, we set the server to disable ping. To temporarily allow the ping command, use the command:

echo 0 >/proc/sys/net/ipv4/icmp_ignore_all  :0,代表允许;1,代表禁止
View current settings:

Linuxs love-hate relationship with ping packages

is 0, for this we can try pinging

Use the ping command

Linuxs love-hate relationship with ping packages

Use -t to ping continuously

Permanently allow or disable ping, modify the configuration file /etc/sysctl.conf

Linuxs love-hate relationship with ping packages

Add a line as shown above, net.ipv4.icmp_echo_ignore_all=1

1 means prohibited, 0 means allowed. Save and exit after modification is completed

Execute sysctl -p to make the new configuration take effect

Linuxs love-hate relationship with ping packages

Test the ping again

Linuxs love-hate relationship with ping packages

As shown in the figure, after the configuration takes effect, the ping command cannot ping the same IP again. If you want to permanently allow the ping command, you only need to change the configuration file 1 to 0.

The above is the detailed content of Linux's love-hate relationship with ping packages. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn