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

相关推荐
用户0328472220708 小时前
如何搭建本地yum源(上)
运维
A小辣椒1 天前
TShark:Wireshark CLI 功能
linux
A小辣椒2 天前
TShark:基础知识
linux
AlfredZhao2 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci
AlfredZhao2 天前
vi 删除指定范围的行,不用再反复按 dd
linux·vi
用户9718356334663 天前
银河麒麟 KY10 申威(SW64) 安装 nginx-1.16.1-2.p01.ky10.sw_64.rpm 详细步骤
linux
猪脚踏浪3 天前
linux 拷贝文件或目录到指定的位置
linux
大树883 天前
金刚石散热越强,管路越先见顶
大数据·运维·服务器·人工智能·ai
摇滚侠3 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
霸道流氓气质3 天前
领域驱动设计(DDD)在 Spring Boot 微服务中的实践指南
运维·spring boot·微服务