来自 BGP 和 OSPF 的路由未安装在路由表中

问题

BGP 和 OSPF 路由的路由表条目在路由表中丢失。例如

frr# show ip bgp
BGP table version is 0, local router ID is 10.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.0.1.0/24      10.1.1.2                 1             0 65511 ?
*> 10.1.1.0/24      10.1.1.2                 1             0 65511 ?
*> 10.3.3.3/32      10.1.1.2                 1             0 65511 ?

Total number of prefixes 3
frr# show ip route
frr# exit

cumulus@switch:~$ ip route show
default via 10.0.1.2 dev eth0 
10.0.1.0/24 dev eth0  proto kernel  scope link  src 10.0.1.208 
10.1.1.0/24 dev swp3  proto kernel  scope link  src 10.1.1.1 
10.2.2.0/24 dev swp4  proto kernel  scope link  src 10.2.2.2

环境

  • Cumulus Linux,所有版本

原因

Zebra 守护进程未运行。Zebra 守护进程不会将从路由协议学习到的路由安装到路由表中。

解决方案

  1. 编辑 /etc/frr/daemons 并将 zebra 关键字设置为 yes

    cumulus@switch:~$ sudo vi /etc/frr/daemons
    ----------------
    zebra=no [change to yes]
    bgpd=yes
    ospfd=yes
    ----------------
    
  2. 重启 FRRouting。

    cumulus@switch:~$ sudo systemctl restart frr
    ...
    .....
    frr# show ip route
    Codes: K - kernel route, C - connected, S - static, R - RIP,
           O - OSPF, I - IS-IS, B - BGP, A - Babel,
           > - selected route, * - FIB route
    
    K>* 0.0.0.0/0 via 10.0.1.2, eth0
    C>* 10.0.1.0/24 is directly connected, eth0
    C>* 10.1.1.0/24 is directly connected, swp3
    B>* 10.3.3.3/32 [20/1] via 10.1.1.2, swp3, 00:00:08 
    C>* 10.4.4.4/32 is directly connected, lo
    C>* 127.0.0.0/8 is directly connected, lo
    
  3. 退出 FRR,然后在 Cumulus Linux 中使用 ip route show 进行验证。

    frr# exit
    
    cumulus@switch:~$ ip route show
    default via 10.0.1.2 dev eth0 
    10.0.1.0/24 dev eth0  proto kernel  scope link  src 10.0.1.208 
    10.1.1.0/24 dev swp3  proto kernel  scope link  src 10.1.1.1 
    10.2.2.0/24 dev swp4  proto kernel  scope link  src 10.2.2.2 
    10.3.3.3 via 10.1.1.2 dev swp3  proto zebra  metric 20