ping丢包问题

ping丢包问题

CPE送样,客户反馈网速满足要求,网络连通性有问题,PING包时丢包率严重。

问题复现

经测试发现,2.4G WiFi、5G WiFi、Lan同时Ping外网就会掉包,Ping网关就不会。而且随着客户端数量的增加掉包率也在增加。

ping

问题分析

确认是否和WiFi有关

方法:关闭WiFi,Lan口接交换机,交换机接五台电脑同时Ping外网和网关
现象:仍然会丢包
结论:和WiFi无关

确认是否和设备连接数有关

方法:关闭WiFi,Lan口接一台电脑,电脑上开5个窗口同时Ping外网
现象:仍然会丢包
结论:和设备连接数无关,和Ping的数量有关

确认是否和5G模组有关

方法:在模组内抓包,检查是否发送和接收
现象:电脑显示找不到的数据包,模组内是有接收到的
结论:和5G模组没有关系

ping包
模组抓包

结论

和WiFi没有关系,和模组没有关系那关系可能出现在内部了,首先想到的是防火墙

看到防火墙有这样一条规则

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
iptables -nvL -t mangle
Chain PREROUTING (policy ACCEPT 1942 packets, 200K bytes)
pkts bytes target prot opt in out source destination
1942 200K IPT_WAN_PIN_MANGLE_CHAIN all -- * * 0.0.0.0/0 0.0.0.0/0

Chain INPUT (policy ACCEPT 1865 packets, 185K bytes)
pkts bytes target prot opt in out source destination
1865 185K IPT_DOS_CHAIN all -- * * 0.0.0.0/0 0.0.0.0/0

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 1867 packets, 157K bytes)
pkts bytes target prot opt in out source destination

Chain POSTROUTING (policy ACCEPT 1867 packets, 157K bytes)
pkts bytes target prot opt in out source destination

Chain IPT_DOS_CHAIN (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate INVALID
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x00
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x03/0x03
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x06/0x06
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x05/0x05
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x11/0x01
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x30/0x20
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x11/0x01
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x18/0x08
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x3F
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x00
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x29
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x2B
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x37
0 0 DROP tcp -- sipa_eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 flags:0x17/0x02 ctstate NEW
0 0 DROP icmp -- sipa_eth0 * 0.0.0.0/0 0.0.0.0/0 icmptype 17
0 0 DROP icmp -- sipa_eth0 * 0.0.0.0/0 0.0.0.0/0 icmptype 13
0 0 DROP tcp -- sipa_eth0 * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x17/0x02 ctstate NEW

Chain IPT_WAN_PIN_MANGLE_CHAIN (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT icmp -- sipa_eth0 * 0.0.0.0/0 0.0.0.0/0 limit: avg 3/sec burst 5
0 0 DROP icmp -- sipa_eth0 * 0.0.0.0/0 0.0.0.0/0

可以看到有个限制icmp 每秒3个包,允许突发5个包的规则limit: avg 3/sec burst 5

删除此规则ping恢复正常,没有丢包。此规则是历史遗留问题,之前测试没有覆盖到,导致bug一直遗留至今。


ping丢包问题
https://carl-5535.github.io/2023/12/06/工作总结/ping丢包问题/
作者
Carl Chen
发布于
2023年12月6日
许可协议