凌晨三点,数据中心告警铃声刺破夜空——核心业务流量突然跌零。作为值班工程师,你面前的Juniper SRX防火墙状态灯正常闪烁,但业务部门电话已经打爆。这不是背诵命令的时候,而是考验系统性排错思维的战场。本文将带你还原一次真实的网络故障排查历程,用逻辑链条串联关键诊断命令,培养"外科手术式"精准定位能力。
当网络中断发生时,90%的问题都出在物理层或接口配置。SRX的show interfaces terse命令就像急诊室的CT扫描,30秒内给出全局接口健康画像:
bash复制> show interfaces terse
Interface Admin Link Proto Local Remote
ge-0/0/0 up down
ge-0/0/1 up up
xe-0/0/0.0 up up inet 192.168.1.1/24
注意ge-0/0/0的Link状态为down,而Admin状态为up——典型的物理层故障特征。 此时需要深入该接口的详细诊断:
bash复制> show interfaces extensive ge-0/0/0
Physical interface: ge-0/0/0, Enabled, Physical link is Down
Interface index: 148, SNMP ifIndex: 526
Link-level type: Ethernet, MTU: 1514, Speed: 1000mbps
Current address: 00:19:e2:50:5e:10
Last flapped: 2023-07-20 02:34:56 UTC (00:28:01 ago)
Input errors: 0, Output errors: 0, Carrier transitions: 3
Error counts:
Input: 0, Output: 0
关键指标解读:
提示:对于光口,务必追加
show interfaces diagnostics optics查看光功率是否在正常范围(-3dBm到-12dBm)
当接口状态正常但流量仍不通时,路由表成为下一个排查重点。SRX的路由查询命令具有极强的过滤能力:
bash复制> show route 192.168.1.0/24 exact
inet.0: 35 destinations, 35 routes (35 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
192.168.1.0/24 *[Static/5] 1w2d 10:23:15
> to 10.0.0.1 via ge-0/0/1.0
常见异常场景处理:
| 现象 | 可能原因 | 验证命令 |
|---|---|---|
| 路由缺失 | 路由协议未收敛 | show ospf neighbor |
| 下一跳不可达 | ARP失败 | show arp no-resolve |
| 路由震荡 | BGP对端问题 | show bgp summary |
对于静态路由配置,特别注意SRX的qualified-next-hop特性:
bash复制set routing-options static route 192.168.47.0/24 qualified-next-hop 10.0.0.2 preference 5
这种多下一跳配置容易因优先级设置不当导致路由失效,建议通过show route forwarding-table验证实际生效路由。
当物理层和路由层都正常时,SRX作为防火墙的核心功能——安全策略就成为关键排查点。会话五元组追踪法是最有效的诊断手段:
bash复制> show security flow session destination-port 443
Session ID: 12345, Policy name: web-access/3
Source: 10.1.1.100/54321, Destination: 203.0.113.5/443
Protocol: TCP, Application: HTTPS
State: Active, Timeout: 1800s
In: 25.1 Mbps, Out: 3.2 Mbps
关键信息解读:
如果会话不存在,说明流量被策略拒绝。此时需要检查:
bash复制> show security policies hit-count | match 10.1.1.100
web-access from untrust to dmz 10.1.1.100/32 https Permit 287
bash复制> show security policies detail | find "Policy order"
Processing order: top-down, first-match
警告:SRX默认策略是"deny-all",务必确认存在明确的permit规则
当所有常规检查都正常时,需要转向系统级诊断。SRX的分层日志体系是最后的破案线索:
bash复制> show log messages | match "denied"
Jul 20 03:01:23 SRX1 RT_FLOW: session denied 10.1.1.100/54321->203.0.113.5/443;
> show log chassisd | last 50
Jul 20 02:34:50 SRX1 chassisd[1234]: FPC 0 PIC 0 port 0 link down
系统资源监控同样关键:
bash复制> show system processes extensive | match "cpu"
jsrpd 15% cpu # 会话管理进程
flowd 62% cpu # 流量处理进程
CPU使用率异常高时,需要检查会话洪水攻击:
bash复制> show security monitoring fpc 0
CPU: 85% (threshold 90%)
Memory: 45% used
Sessions: 98234/100000
New conn/sec: 1250
对于部署了高可用的SRX集群,故障排查需额外关注集群状态同步:
bash复制> show chassis cluster status
Cluster ID: 1
Node Priority Status Preempt Manual failover
0 100 primary no no
1 95 secondary no no
> show chassis cluster interfaces
Control link status: Up
Fab link status: Up
常见集群故障模式处理:
show chassis cluster control-plane的heartbeat状态show configuration | compare rollback 1对比节点差异show security flow session cluster验证会话表同步真正的专家不是救火队员,而是通过自动化实现预防性维护。SRX的Op脚本和事件策略能主动发现问题:
bash复制event-options {
policy link-monitor {
events LINK_DOWN;
then {
execute-commands {
commands {
"show interfaces extensive $interface-name";
"show chassis hardware";
}
output-filename "link-failure";
destination flash;
}
raise-trap;
}
}
}
推荐部署的日常监控命令:
bash复制set system scripts op file health-check.slax
bash复制show | compare rollback 1
bash复制show security policies hit-count | except 0
在完成故障修复后,记得使用commit confirmed命令——这个10分钟自动回滚的安全网,能避免误操作导致二次故障。毕竟,最好的排错策略永远是给自己留条退路。