linux主机ping不通问题排查

问题现象:

实施同学反馈Linux服务器重启后从其他节点上无法ping通

定位过程

源服务器A进行ping测试

复制代码
[root@reg data]# ping 10.10.16.103
PING 10.10.16.103 (10.10.103) 56(84) bytes of data.

B节点抓包验证

复制代码
[root@localhost ~]# tcpdump -nn -i any icmp and host 10.10.16.102 
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked v1), capture size 262144 bytes
11:35:03.803546 IP 10.10.16.102 > 10.10.16.103: ICMP 10.10.16.102 udp port 6831 unreachable, length 386
11:35:04.804514 IP 10.10.16.102 > 10.10.16.103: ICMP 10.10.16.102 udp port 6831 unreachable, length 556
11:35:05.804369 IP 10.10.16.102 > 10.10.16.103: ICMP 10.10.16.102 udp port 6831 unreachable, length 386
11:35:06.805516 IP 10.10.16.102 > 10.10.16.103: ICMP 10.10.16.102 udp port 6831 unreachable, length 386
11:35:07.804405 IP 10.10.16.102 > 10.10.16.103: ICMP 10.10.16.102 udp port 6831 unreachable, length 556
11:35:08.275270 IP 10.10.16.103 > 10.10.16.102: ICMP echo request, id 20690, seq 1, length 24
11:35:08.275855 IP 10.10.16.102 > 10.10.16.103: ICMP echo reply, id 20690, seq 1, length 24
11:35:08.804404 IP 10.10.16.102 > 10.10.16.103: ICMP 10.10.16.102 udp port 6831 unreachable, length 386
11:35:09.803681 IP 10.10.16.102 > 10.10.16.103: ICMP 10.10.16.102 udp port 6831 unreachable, length 386
11:35:10.804445 IP 10.10.16.102 > 10.10.16.103: ICMP 10.10.16.102 udp port 6831 unreachable, length 388
11:35:11.804145 IP 10.10.16.102 > 10.10.16.103: ICMP 10.10.16.102 udp port 6831 unreachable, length 388

从目标端看到103节点针对icmp没有echo reply回包

排查方向1:iptables策略是否禁ping

部分系统可能回默认禁ping

iptables -L -n -v | grep ICMP

重点关注:

复制代码
DROP       icmp --  0.0.0.0/0  0.0.0.0/0
REJECT     icmp --  0.0.0.0/0  0.0.0.0/0

或者更隐蔽的:

复制代码
-A INPUT -p icmp --icmp-type echo-request -j DROP

经过排查没有发现异常

排查方向2:内核参数

root@localhost \~# sysctl net.ipv4.icmp_echo_ignore_all

net.ipv4.icmp_echo_ignore_all = 1

root@localhost \~#

root@localhost \~# cat /etc/sysctl.conf | grep net.ipv4.icmp_echo_ignore_all

net.ipv4.icmp_echo_ignore_all=1

解决方案:此内核参数修改为0后解决,参数作用-忽略 ICMP Echo Request

相关推荐
梦想的颜色2 小时前
【Docker原理】Docker 容器一文打尽:生命周期、环境管控、迁移备份、日志进程排查、垃圾清理
运维·docker·容器·容器生命周期·容器日志排查·容器迁移备份·容器进程管理
欢呼的太阳3 小时前
数据库设计Step by Step (10)——范式化
服务器·数据库·oracle
夜雪一千4 小时前
Python enumerate() 函数完整详解:遍历同时获取索引,告别手动计数
服务器·windows·python
donoot4 小时前
Linux系统下图书馆级电子书全自动标准化分类整理完整实施方案
大数据·linux·运维·电子书管理
ITKEY_5 小时前
macOS brew 安装的nginx 文件在哪里?
运维·nginx·macos
Felix-lxd5 小时前
Ubuntu 22.04 配置 Nginx
linux·nginx·ubuntu
Elastic 中国社区官方博客5 小时前
如何比较两个 Elasticsearch 索引并找出缺失的文档
大数据·运维·数据库·elasticsearch·搜索引擎
大E帝国子民16 小时前
MacOS 安装Seismic Unix
服务器·macos·unix
Tim_Van6 小时前
在 CentOS 7 中安装 Chromium 的完整步骤
linux·运维·chrome·centos
德福危险6 小时前
富有想象力的XSS盲打:靶机练习之Tempus_fugit5
服务器·网络·xss