孙轶宁,某局点9850-4C无法向ebgp邻居发布默认路由经验处理案例
组网及说明
如图, AS400 、 AS500 分别发布默认路由,再 AS100 的路由器上开启 balance 2 以及 balance as-path-relax 实现等价路由负载均衡。
问题描述
客户这边希望 AS100 能把 AS200 学到的默认路由发给 AS300 ,同时把 AS300 学到的默认路由发给 AS200 ,作为路由备份(主要目的是想要实现一旦 AS400 或者 AS500 的路径出现问题后快速收敛)
但是现在发现 AS100 要么只把 AS200 学到的默认路由发给 AS300 ,要么只把 AS300 学到的默认路由发给 AS200 ,无法做到同时发布,并且只跟邻居建立的先后顺序有关。
可以看到当 AS300 邻居后建立的情况下, AS100 只把默认路由发给 AS300
[H3C-BGP-default-ipv4]dis bgp routing-table ipv4 peer 192.168.1.2 advertised-routes //AS200邻居,没有发布路由
Total number of routes: 0
[H3C-bgp-default-ipv4]dis bgp routing-table ipv4 peer 192.168.1.6 advertised-routes //AS300邻居,发布默认路由
Total number of routes: 1
BGP local router ID is 192.168.1.5
Status codes: * - valid, > - best, d - dampened, h - history
s - suppressed, S - stale, i - internal, e - external
a - additional-path
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf Path/Ogn
* >e 0.0.0.0 192.168.1.2 100 200 400i
然后重置 AS200 的邻居,发现路由变成发布给 AS200
<H3C>reset bgp 192.168.1.2 ipv4
Reset BGP sessions? [Y/N]:y
<H3C>%Oct 12 00:24:05:220 2022 H3C BGP/5/BGP_STATE_CHANGED: BGP.: 192.168.1.2 state has changed from ESTABLISHED to IDLE for administrative reset.
%Oct 12 00:24:05:220 2022 H3C BGP/5/BGP_STATE_CHANGED_REASON: BGP.: 192.168.1.2 state has changed from ESTABLISHED to IDLE. (Reason: the peer session or all sessions were manually reset, Error code: Send Notificationcode 6/4)
<H3C>dis bgp routing-table ipv4 peer 192.168.1.2 ad //AS200 邻居,发布默认路由
Total number of routes: 1
BGP local router ID is 192.168.1.5
Status codes: * - valid, > - best, d - dampened, h - history
s - suppressed, S - stale, i - internal, e - external
a - additional-path
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf Path/Ogn
* >e 0.0.0.0 192.168.1.6 100 300 500i
<H3C>dis bgp routing-table ipv4 peer 192.168.1.6 ad //AS300 邻居,没有发布路由
Total number of routes: 0
过程分析
从上述现象来看,显然跟BGP的路由发布策略有关,根据官网描述
· 存在多条有效路由时, BGP 发言者只将最优路由发布给对等体 。如果配置了 advertise-rib-active 命令,则 BGP 发布 IP 路由表中的最优路由;否则,发布 BGP 路由表中的最优路由。
因此想要发布多条路由,需要配置Add-Path功能
配置了Add-Path(Additional Paths)功能后,BGP可以向邻居发送本地前缀相同下一跳不同的多条路由。网络出现故障后,次优路由可以成为新的最优路由,这样就缩短了流量中断时间。
Add-Path能力包括接收和发送两种。为了让对等体间的Add-Path能力协商成功,必须一端使能接收能力,另一端使能发送能力。
(1) 配置Add-Path功能。
peer { group-name | ipv4-address [ mask-length ] | ipv6-address [ prefix-length ] } additional-paths { receive | send } *
缺省情况下,未配置Add-Path功能。
(2) 配置向指定对等体/对等体组发送的Add-Path优选路由的最大条数。
peer { group-name | ipv4-address [ mask-length ] | ipv6-address [ prefix-length ] } advertise additional-paths best number
缺省情况下,向指定对等体/对等体组发送的Add-Path优选路由的最大条数为1。
(3) 配置Add-Path优选路由的最大条数。
additional-paths select-best best-number
缺省情况下,Add-Path优选路由的最大条数为1。
解决方法
配置Add-Path功能additional-paths select-best 2 ,并在两侧bgp的 peer 下使能 add-path 的 sent 跟 receive后问题解决