三三世界-百宝箱

文章 分类 标签
130 9 247

公告

暂无站点公告

LInux Centos操作系统开启或关闭ICMP协议

三三 2022-06-18 1559 0条评论 Linux使用 CentOS7开启关闭icmp

首页 / 正文

ICMP的全称是 Internet Control Message Protocol ,从技术的角度来看,ICMP就是一个“错误侦测与回报机制”,这个协议在网络安全和网络连接健康状态的判断有着非常重要意义。今天我们的主要内容是说下,在在Centos 6和Centos 7 中,ICMP协议的开启与关闭的方法。对于ICMP安全方面的知识,例如ICMP网络攻击方面,本文不做讨论。

说明
影响ping的主要有两方面因素:一个是内核参数,一个是防火墙规则配置。只有两个参数同时允许,才可以ping通,任意一个因素配置不被允许则不允许ping通。在centos 6 或者7中修改其实是没有什么差异的。

内核参数开启方法

# cat /proc/sys/net/ipv4/icmp_echo_ignore_all

回显两种结果,0表示允许,1代表禁止。此处为1,继续执行下一步

1.临时开启ping,则执行如下命令

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

2.永久开启,执行命令:

# vim /etc/sysctl.conf 
 net.ipv4.icmp_echo_ignore_all=0 //增加这一行内容(如果此行已经存在,则确认后面参数为0)
:wq 保存退出配置文件
# sysctl -p //执行此命令使配置生效

内核参数关闭ping方法
临时关闭执行:

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

永久关闭:

# vim /etc/sysctl.conf 
 net.ipv4.icmp_echo_ignore_all=1
# sysctl -p

允许ping:

# iptables -I INPUT -i eth0 -p icmp -s 0/0 -d 0/0 -j ACCEPT

可以通过iptables -nvL查看防火墙规则

禁止ping

# iptables -I INPUT -i eth0 -p icmp -s 0/0 -d 0/0 -j DROP

最后测试,就可以ping通目标主机了

评论(0)

当前没有评论,还不快来留下第一个脚印吧


Copyright 2021 三三世界-百宝箱. All Rights Reserved.

最新评论

  • 三三

    @Doug Shume it's ok for me , you can post here.

  • refugiaguenther

    Saved as a favorite, I like your website!

  • josefa

    If some one wishes to be updated with hottest technologies after that he must be visit this site and be up to date daily.

  • Penzu

    Heello would you mind sharing which blog platform you're using? I'm planning to start my own blog in the near future but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then moost blogs and I'm looking for something completely unique. P.S Apologies forr being off-topic butt I had to ask!

  • Yupoo Fendi

    Thanks to my father who shared with me regarding this webpage, this website is genuinely amazing.

  • Doug Shume

    Hi, I have an overflow of customers that I'd like to send to you but I want to make sure you can handle more leads, let me know if you'd like me to send you more info.

  • SuperWind

    zh.us.to 有效
    kms.03k.org 有效
    kms.chinancce.com
    kms.shuax.com 有效
    kms.dwhd.org 有效
    kms.luody.info 有效
    kms.digiboy.ir 有效
    kms.lotro.cc 有效
    www.zgbs.cc 有效
    cy2617.jios.org 有效

  • 三三

    @         权限问题,试试sudo 再加命令。

  •         

    你好提示Permission denied 怎么办啊

日历

2024年05月

   1234
567891011
12131415161718
19202122232425
262728293031 

文章目录

上一张 下一张