现网排障实录:误配 PBR 与 VRF 汇聚路由引发的 30 跳环路定位

故障现象:经 FCIX 访问内网绕道 Hurricane Electric

故障起始:客户发邮件报障,表示通过我们接入 FCIX(Fremont Cabal Internet Exchange)的 IXP 对等接口访问我方内网目标 IP 时,流量异常绕行了 Hurricane Electric(AS 6939)端口后再回到我方内网,导致延迟上升与性能下降。客户附上的实测 traceroute 如下:

#Greetings,

#I happened to do a traceroute to [ our destination IP ], and saw some rather odd behavior... Just thought you might want to look into why you're correctly advertising a prefix into FCIX, but your peering router seems to be hairpinning the traffic through Hurricane's port back to your transit port?

kenneth@shell:~$ traceroute [ our destination IP ]
traceroute to [ our destination IP ], 30 hops max, 60 byte packets
 1  [ Client GW ] 0.425 ms  0.455 ms  0.507 ms
 2  [ our IXP IP ]  0.140 ms  0.125 ms  0.151 ms
 3  AS6939.ixp.fcix.net (206.80.238.9)  0.268 ms  0.193 ms  0.193 ms
 4  [ our Transit IP ]  0.180 ms  0.183 ms  0.181 ms
 5  [ our Internal Port ]  0.787 ms  0.780 ms  0.787 ms
 6  [ our destination IP ]  0.220 ms  0.198 ms  0.183 ms

定位结论:这是一起典型的人为配置失误(Human Error)引发的复合故障——(1)在 FCIX 入向接口误挂了策略路由(PBR),导致报文绕过路由表直接被送往 HE;(2)清除 PBR 后又暴露出 VRF 内部缺少精细直连路由、仅存在指向 Null0 的 BGP 汇聚路由这一隐藏缺陷。

排查过程:从 VRF 路由表、MTR 环路到 CEF 查表

首先检查隔离 FCIX 流量的 ixp-fcix VRF 路由表,发现目标网段只存在一条指向 Null0 的 BGP 汇聚路由,没有来自内部 IGP 或直连接口的明细路由;不过单凭这条静态/汇聚现象尚不足以把包踢给 HE,先记录在案继续往下追查:

#show ip route vrf ixp-fcix [ our /32 ip ]

Routing Table: ixp-fcix
Routing entry for [ our subnet /24 ]
  Known via "bgp xxxxx", distance 20, metric 0 (connected), type external
  Routing Descriptor Blocks:
  * directly connected, via Null0
      Route metric is 0, traffic share count is 1
      AS Hops 0
      MPLS label: none

紧接着从接入 FCIX 的测试节点 pve-fcix1 对我方路由器 FCIX 端口执行 mtr,结果赫然出现了连续 30 跳全部卡死在 as6939.ixp.fcix.net 的路由环路:

pve-fcix1 对路由器 FCIX 接口执行 MTR v0.92 的终端截图,显示第 1 跳至第 30 跳全部在 as6939.ixp.fcix.net 形成路由环路
图 1:在 pve-fcix1 上对 FCIX 端口发起 MTR 实测,出现连续 30 跳 as6939.ixp.fcix.net 环路

怀疑硬件或软件转发表异常,随即检查 Cisco CEF Table(对应原始排查命令输出整理如下):

#show ip cef vrf ixp-fcix [ our fcix port ip ]
[ our fcix port ip ]/32
  attached to TenGigabitEthernet1/1/0

(config)#do show ip cef vrf ixp-fcix [ our dst ip address ]
[ our dst subnet ]/24
  nexthop         TenGigabitEthernet0/2/0.100

可以看到 CEF 表项本身指向的是正确的接口(第二条虽然只查到 /24 而非 /32,但同样不会导致把包转去 AS6939 形成 30 跳环路)。

真相浮出水面:PBR 策略表绕过 RIB/CEF 强行改写转发

既然 RIB 与 CEF 转发表都没有把流量指向 HE,根据排障经验就必须立刻排查优先级凌驾于路由表和转发表之上的策略路由(PBR / Policy Table)——PBR 会直接拦截入向报文执行转发,根本不走正常 FIB 判断:

#show ip policy
Interface      Route map
Te1/1/0    [ our routing policy ]

果不其然!负责接入 FCIX 的 Te1/1/0 接口上被误配置了一条面向客户流量的 PBR route-map,点开策略内容正是强制将流量引导向 Hurricane Electric!确认业务影响后立即清理该接口上的错误 PBR。

FCIX 路由环路根因与修复前后对比图:修复前 Te1/1/0 误挂 PBR 绕过 RIB/CEF 发往 AS6939 形成 30 跳环路且 VRF 缺少明细直连路由;修复后清除 PBR 并在 Te0/2/0.100 配置 ip vrf select source 与 ip vrf receive ixp-fcix
图 2:误配 PBR 绕行 HE 与 VRF 缺少直连明细路由的复合故障机理及修复后直连路径对比

修复步骤二:暴露出的 VRF 缺失直连路由与彻底解决

删除 Te1/1/0 的错误 PBR 后,30 跳环路与 HE 绕行现象立即消失,但测试机 ping 变为了 Destination Host Unreachable——这正好印证了前面排查时注意到的第二个隐患(VRF ixp-fcix 内只有 Null0 汇聚路由,缺少 Te0/2/0.100 的直连明细):

root@fcix1 ~ # ping [ our destination IP ]
PING [ our destination IP ] ([ our destination IP ]) 56(84) bytes of data.
From [ our destination IP ] icmp_seq=1 Destination Host Unreachable
From [ our destination IP ] icmp_seq=2 Destination Host Unreachable
From [ our destination IP ] icmp_seq=3 Destination Host Unreachable
From [ our destination IP ] icmp_seq=6 Destination Host Unreachable
^C
--- [ our destination IP ] ping statistics ---
7 packets transmitted, 0 received, +4 errors, 100% packet loss, time 123ms

使用 Cisco IOS-XE 的 ip vrf select source 与 ip vrf receive ixp-fcix 将全局子接口 TenGigabitEthernet0/2/0.100 的直连路由信息导入至 ixp-fcix VRF,并验证 VRF 路由表与 CEF 表均已出现精确的 /32 直连表项:

interface TenGigabitEthernet0/2/0.100
 encapsulation dot1Q 100
 ip vrf select source
 ip vrf receive ixp-fcix

#show ip route vrf ixp-fcix [ our destination IP ] 

Routing Table: ixp-fcix
Routing entry for [ our destination IP ]/32
  Known via "connected", distance 0, metric 0 (connected)
  Routing Descriptor Blocks:
  * directly connected, via TenGigabitEthernet0/2/0.100
      Route metric is 0, traffic share count is 1

#show ip cef vrf ixp-fcix [ our destination IP ]  
[ our destination IP ]/32
  receive for TenGigabitEthernet0/2/0.100

验证恢复与运维教训

再次从 fcix-test 执行 mtr 与 ping,直达目标仅需 1 跳、丢包率 0%、平均延迟仅 0.146 ms:

root@fcix-test ~ # mtr -4 [ our destination IP ] --report
Start: 2020-03-08T08:55:18-0700
HOST: fcix-test                   Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- [ our destination IP ]               0.0%    10    0.2   0.2   0.1   0.3   0.1

root@fcix-test ~ # ping -4 [ our destination IP ] -c 3
PING [ our destination IP ] ([ our destination IP ]) 56(84) bytes of data.
64 bytes from [ our destination IP ]: icmp_seq=1 ttl=255 time=0.124 ms
64 bytes from [ our destination IP ]: icmp_seq=2 ttl=255 time=0.160 ms
64 bytes from [ our destination IP ]: icmp_seq=3 ttl=255 time=0.155 ms

--- [ our destination IP ] ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 36ms
rtt min/avg/max/mdev = 0.124/0.146/0.160/0.018 ms

现网运维教训

  • 严禁在非客户侧业务接口误挂 PBR:PBR 优先级高于 RIB/CEF,一旦残留在 IXP 或上联口,会令所有常规路由排障表象失真;
  • 警惕 VRF 仅存 Null0 汇聚路由的陷阱:跨 VRF 导入路由或配置 prefix-list 时,如果只导入了指向 Null0 的汇聚路由而遗漏了直连/IGP 明细路由(或未配置 ip vrf receive),数据面必然静默丢包。

Leave a Comment

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理。