When we use shared hosting, after pinging some hosting providers’ product IPs, we may see the result as “timed out.” For security reasons, some hosting providers disable ping test data, though most still allow ping. When we manage our own Linux
VPS hosting products, we can freely decide whether to disable ping for our VPS product
IP.
The first method is to modify the file:
/proc/sys/net/ipv4/icmp_echo_ignore_all
Edit this file. By default it should be 0; changing it to 1 will disable
PING. If you need to restore it, change it back to 0, then restart the VPS.
The second method is to solve it directly with commands:
sysctl -w net.ipv4.icmp_echo_ignore_all=1 sysctl -p
Command to disable it.
sysctl -w net.ipv4.icmp_echo_ignore_all=0 sysctl -p
Restore it.
Using commands takes effect immediately and does not require restarting the VPS.