Production server:
Os:centos Release 6.8 (Final)
Task: Configure ping with kernel parameters
First, the temporary effective configuration method:
Do not allow local ping
[[email protected] ~]$ Ping 117.40.*.*
PING 117.40.*.* (117.40.*.*) bytes of data.
[[email protected] ~]$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) bytes of data.
Client ping to this server is not allowed
[[email protected] ~]# Ping 117.40.*.*
PING 117.40.*.* (117.40.*.*) bytes of data.
The operation is configured as follows:
[Email protected] ~]$ Cat/proc/sys/net/ipv4/icmp_echo_ignore_all
1
A local ping or client ping to the server is changed to 0 for 1
[Email protected] sky]# echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_all
[Email protected] sky]# Cat/proc/sys/net/ipv4/icmp_echo_ignore_all
0
Test results:
[[email protected] sky]# ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) bytes of data.
Bytes from 127.0.0.1:icmp_seq=1 ttl=64 time=0.057 ms
[[email protected] ~]# Ping 117.40.*.* # Client Testing Ping Server
PING 117.40.*.* (117.40.*.*) bytes of data.
Bytes from 117.40.*.*: icmp_seq=1 ttl=64 time=0.438 ms
Second, the permanent Way of entry into force:
[Email protected] sky]# vi/etc/sysctl.conf
.........
net.ipv4.icmp_echo_ignore_all = 0 # allow Ping, set 1 prohibit ping
[email protected] sky]# sysctl–p # make the new configuration effective
This article is from the "sky9890" blog, make sure to keep this source http://sky9896.blog.51cto.com/2330653/1886609
Configure Linux disable ping and allow ping