两种方法教你如何设置LINUX VPS禁止PING IP

itlao6 工具&方法评论749字数 338阅读1分7秒阅读模式

我们在管理linux vps主机产品的时候,处于安全考虑,可能会有禁止ping IP的需求,这里给出两种方法禁用PING IP。

方法一:通过修改文件

/proc/sys/net/ipv4/icmp_echo_ignore_all

在主机中招到以上文件,然后编辑这个文件,默认应该是 0,我们修改成 1就是禁止 PING。如果需要恢复则修改成 0,然后重启主机就可以。文章源自IT老刘-https://itlao6.com/11190.html

注意,这种方法需要重启主机。文章源自IT老刘-https://itlao6.com/11190.html

 文章源自IT老刘-https://itlao6.com/11190.html

方法二:通过命令

sysctl -w net.ipv4.icmp_echo_ignore_all=1
sysctl -p

以上是禁止PING的命令文章源自IT老刘-https://itlao6.com/11190.html

sysctl -w net.ipv4.icmp_echo_ignore_all=0
sysctl -p

以上是恢复PING的命令
用命令设置的好处是不需要重启主机就能直接会生效文章源自IT老刘-https://itlao6.com/11190.html

文章源自IT老刘-https://itlao6.com/11190.html文章源自IT老刘-https://itlao6.com/11190.html
weinxin
我的微信公众号
微信扫一扫关注公众号,不定时更新
itlao6
  • 本文由 发表于 2023年 9月 22日 14:37:08
  • 转载请务必保留本文链接:https://itlao6.com/11190.html
评论  0  访客  0
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定