系统学习 学习路径总入口:先选领域,再建立模型,最后用故障演练验证

网络排查分层速查

分层排查

链路层  ip link, ethtool
IP 层   ip addr, ip route, ping
DNS     dig, resolvectl, getent
TCP     ss, nc, traceroute/mtr
TLS     openssl s_client, curl -v
HTTP    curl -v, 网关日志
抓包    tcpdump

常用命令

ip -br addr
ip route
ethtool <iface>
ethtool -S <iface> | grep -i -E 'drop|error|crc'
ping -c 4 <host>
mtr -rwc 50 <host>
ss -lntp
ss -ti
nc -vz -w 5 <host> <port>
dig +short <domain>
dig @<dns-server> <domain>
resolvectl status
curl -v --connect-timeout 5 https://<host>/
openssl s_client -connect <host>:443 -servername <host>
tcpdump -ni any host <host> and port <port>
conntrack -L | head
nft list ruleset

按现象定位

现象 优先检查
Connection refused 端口监听、服务状态、防火墙 REJECT
Connection timeout 路由、安全组 DROP、MTU、backlog
域名解析失败 resolv.conf、上游 DNS、search/ndots
偶发丢包 mtr、网卡错误计数、带宽/QoS
TLS 失败 证书链、SNI、协议/套件、时间
502/504 后端状态、upstream 配置、超时

易错点

相关命令

参考链接

读完自测

合上页面,先回答,再展开对照。

  1. ping 通但端口连不上,说明什么问题?
  2. ss -lntp 显示监听在 127.0.0.1,远程能连上吗?
  3. 云环境中通常有哪几层独立的防火墙/访问控制?
答案
  1. ICMP 可达不代表 TCP 端口开放;目标端口可能未监听、被防火墙拒绝或应用未启动。
  2. 不能。127.0.0.1 只监听回环地址,远程需要监听 0.0.0.0 或具体网卡地址。
  3. 安全组、网络 ACL 和主机防火墙是三处独立配置,需要分别检查。
微信小程序码:扫码打开命令速查小程序

小程序版

微信扫码,随时查命令