首页/网络/网络排障速查/抓包缓冲区与内核丢包(-B / dropped by kernel)
本包目录(235 条)

抓包缓冲区与内核丢包(-B / dropped by kernel)

高流量下抓包自身会丢包:tcpdump 退出时打印 packets dropped by kernel,说明缓冲或处理能力不足;调大 -B、精简过滤、只抓必需字段是标准解法。

网络排障速查网络更新于 2026-10-12

丢包确认与缓解

丢包确认与缓解
tcpdump -nn -i eth0 -B 32768 -w /tmp/big.pcap 'host 10.0.0.5'   # 32MB 缓冲
# 退出时会打印:
# 12345 packets captured
# 67 packets dropped by kernel
tcpdump -nn -i eth0 -q -s 128 -c 100000 'tcp port 443'
# 内核侧丢包统计(抓包外的视角):
ip -s link show eth0 | grep -A2 RX
nstat -az | grep -iE 'UdpInErrors|TcpExtTCPBacklogDrop'
判据「packets dropped by kernel」非 0 = 抓包丢了,不是网络丢了
缓解-B 加大缓冲、-s 减小 snaplen、过滤条件尽量靠前、-q 减少格式化开销
对照用 ip -s link / nstat 判断丢包是否也发生在内核统计层
把抓包丢包当成网络丢包是经典误判:两者要分别取证,前者只能说明抓包能力不足。

易错点

  • 看到 dropped by kernel 就下网络丢包的结论,方向错误
  • 在万兆口用默认缓冲长时间全量抓包,抓到的样本失真

数据来源与参考

  • man 8 tcpdump(-B 与丢包统计说明)
  • man 8 ip-link(-s 统计)

相关工具

​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌