BGP
BGP可能是交换机里面最常用,最重要,或者线上使用的最多的功能了。这一节,我们就来深入的看一下BGP相关的工作流。
BGP相关进程
SONiC使用FRRouting作为BGP的实现,用于负责BGP的协议处理。FRRouting是一个开源的路由软件,支持多种路由协议,包括BGP,OSPF,IS-IS,RIP,PIM,LDP等等。当FRR发布新版本后,SONiC会将其同步到SONiC的FRR实现仓库:sonic-frr中,每一个版本都对应这一个分支,比如frr/8.2
。
FRR consists of two main parts, the first part is the implementation of each protocol, these processes are named *d
, and when they receive notification of routing updates, they tell the second part, which is the zebra
process, and then the zebra
process will make the route selection and synchronize the optimal routing information to the kernel, the main structure of which is shown in the following figure The main structure is as follows
+----+ +----+ +-----+ +----+ +----+ +----+ +-----+
|bgpd| |ripd| |ospfd| |ldpd| |pbrd| |pimd| |.....|
+----+ +----+ +-----+ +----+ +----+ +----+ +-----+
| | | | | | |
+----v-------v--------v-------v-------v-------v--------v
| |
| Zebra |
| |
+------------------------------------------------------+
| | |
| | |
+------v------+ +---------v--------+ +------v------+
| | | | | |
| *NIX Kernel | | Remote dataplane | | ........... |
| | | | | |
+-------------+ +------------------+ +-------------+
在SONiC中,这些FRR的进程都跑在bgp
的容器中。另外,为了将FRR和Redis连接起来,SONiC在bgp
容器中还会运行一个叫做fpgsyncd
的进程(Forwarding Plane Manager syncd),它的主要功能是监听kernel的路由更新,然后将其同步到APP_DB中。但是因为这个进程不是FRR的一部分,所以它的实现被放在了sonic-swss仓库中。
参考资料
- SONiC Architecture
- Github repo: sonic-swss
- Github repo: sonic-frr
- RFC 4271: A Border Gateway Protocol 4 (BGP-4)
- FRRouting