linux

怎样用Linux Sniffer诊断网络问题

小樊
35
2025-12-23 04:21:03
栏目: 智能运维

用 Linux Sniffer 诊断网络问题的实用流程

一、准备与总体思路

二、快速定位路径与常用命令

三、典型场景与抓包要点

场景 关键线索 抓包过滤与命令示例
网站访问慢或打不开 DNS 超时、TCP 握手失败、TLS 握手失败、HTTP 5xx 1) DNS:tcpdump -i any -nn port 53 -vv 2) TCP:tcpdump -i any -nn ‘host 目标 and port 80’ 3) TLS:tcpdump -i any -nn ‘tcp port 443 and (tcp[((tcp[12:1]&0xf0)>>2):4]=0x16)’
内网间歇性丢包 重复 ACK、快速重传、ICMP 超时 tcpdump -i any -nn ‘tcp[tcpflags] & tcp-ack != 0 and (tcp[((tcp[12:1]&0xf0)>>2):4]=0x0004 or tcp[((tcp[12:1]&0xf0)>>2):4]=0x0011)’
服务器端口未监听 目标端口返回 RST 或无响应 tcpdump -i any -nn ‘host 目标 and port 8080’(看到 RST 多为端口未开/被拒绝
疑似被攻击或异常外联 大量 SYN、ICMP 洪泛、未知协议外联 tcpdump -i any -nn ‘tcp[tcpflags] & tcp-syn != 0’ 或 ‘icmp’ 或 ‘not port 22 and not port 80 and not port 443’
DNS 解析异常 SERVFAIL/REFUSED、响应延迟大 tcpdump -i any -nn port 53 -vv(核对域名、返回码、TTL
以上命令中的过滤表达式基于tcpdump 过滤语法(host、port、proto、逻辑运算等),可按需组合。

四、高效过滤与结果判读

五、排错与优化建议

0
看了该问题的人还看了