github.com/osrg/gobgp/v3@v3.30.0/docs/sources/zebra-multipath.md (about) 1 # Equal Cost Multipath Routing with Zebra 2 3 This page explains how GoBGP handles Equal Cost Multipath (ECMP) routes with 4 Zebra daemon included in [Quagga](http://www.nongnu.org/quagga/) or 5 [FRRouting](https://frrouting.org/). 6 7 ## Prerequisites 8 9 Assume you finished [Getting Started](getting-started.md) and 10 [FIB manipulation](zebra.md). 11 12 ## Contents 13 14 - [Configuration](#configuration) 15 - [Verification](#verification) 16 17 ## Configuration 18 19 **Note:** Before constructing your environment, please confirm your Zebra is 20 built with "--enable-multipath=ARG" configure option. The APT packaged Quagga 21 on Ubuntu 16.04 is configured with this option as following. 22 23 ```bash 24 $ /usr/lib/quagga/zebra --version 25 zebra version 0.99.24.1 26 Copyright 1996-2005 Kunihiro Ishiguro, et al. 27 configured with: 28 --build=x86_64-linux-gnu ...(snip)... --enable-multipath=64 ...(snip)... 29 ``` 30 31 Here supposes the following topology and demonstrates two ECMP routes which 32 advertised from R2 and R3 are installed to R1's Kernel routing table via Zebra. 33 34 ```text 35 R1: GoBGP + Zebra 36 R2: GoBGP 37 R3: GoBGP 38 39 +-------------+ +-------------+ 40 | R1 | .1/24 .2/24 | R2 | 41 | ID: 1.1.1.1 |---------------------| ID: 2.2.2.2 | 42 | AS: 65000 | 192.168.12.0/24 | AS: 65000 | 43 +-------------+ +-------------+ 44 | .1/24 45 | 46 | 192.168.13.0/24 47 | 48 | .3/24 49 +-------------+ 50 | R3 | 51 | ID: 3.3.3.3 | 52 | AS: 65000 | 53 +-------------+ 54 ``` 55 56 To enables ECMP features at GoBGP on R1, please confirm "use-multiple-paths" 57 option is configured as following. With this option, GoBGP will redistribute BGP 58 multipath routes to Zebra and Zebra will install them into Kernel routing table. 59 60 ```toml 61 # gobgpd.toml on R1 62 63 [global.config] 64 as = 65000 65 router-id = "1.1.1.1" 66 67 [global.use-multiple-paths.config] 68 enabled = true 69 70 [[neighbors]] 71 [neighbors.config] 72 neighbor-address = "192.168.12.2" 73 peer-as = 65000 74 [[neighbors.afi-safis]] 75 [neighbors.afi-safis.config] 76 afi-safi-name = "ipv4-unicast" 77 [[neighbors.afi-safis]] 78 [neighbors.afi-safis.config] 79 afi-safi-name = "ipv6-unicast" 80 81 [[neighbors]] 82 [neighbors.config] 83 neighbor-address = "192.168.13.3" 84 peer-as = 65000 85 [[neighbors.afi-safis]] 86 [neighbors.afi-safis.config] 87 afi-safi-name = "ipv4-unicast" 88 [[neighbors.afi-safis]] 89 [neighbors.afi-safis.config] 90 afi-safi-name = "ipv6-unicast" 91 92 [zebra.config] 93 enabled = true 94 url = "unix:/var/run/quagga/zserv.api" 95 redistribute-route-type-list = ["connect"] 96 version = 2 97 ``` 98 99 ```toml 100 # gobgpd.toml on R2 101 102 [global.config] 103 as = 65000 104 router-id = "2.2.2.2" 105 106 [[neighbors]] 107 [neighbors.config] 108 neighbor-address = "192.168.12.1" 109 peer-as = 65000 110 [[neighbors.afi-safis]] 111 [neighbors.afi-safis.config] 112 afi-safi-name = "ipv4-unicast" 113 [[neighbors.afi-safis]] 114 [neighbors.afi-safis.config] 115 afi-safi-name = "ipv6-unicast" 116 ``` 117 118 ```toml 119 # gobgpd.toml on R3 120 121 [global.config] 122 as = 65000 123 router-id = "3.3.3.3" 124 125 [[neighbors]] 126 [neighbors.config] 127 neighbor-address = "192.168.13.1" 128 peer-as = 65000 129 [[neighbors.afi-safis]] 130 [neighbors.afi-safis.config] 131 afi-safi-name = "ipv4-unicast" 132 [[neighbors.afi-safis]] 133 [neighbors.afi-safis.config] 134 afi-safi-name = "ipv6-unicast" 135 ``` 136 137 ## Verification 138 139 When connections established between each routers, all routers have only 140 "connected" routes from Zebra on R1. 141 142 ```bash 143 R1> gobgp global rib -a ipv4 144 Network Next Hop AS_PATH Age Attrs 145 *> 1.1.1.1/32 0.0.0.0 00:00:00 [{Origin: i} {Med: 0}] 146 *> 192.168.12.0/24 0.0.0.0 00:00:00 [{Origin: i} {Med: 0}] 147 *> 192.168.13.0/24 0.0.0.0 00:00:00 [{Origin: i} {Med: 0}] 148 149 R2> gobgp global rib -a ipv4 150 Network Next Hop AS_PATH Age Attrs 151 *> 1.1.1.1/32 192.168.12.1 00:00:00 [{Origin: i} {Med: 0} {LocalPref: 100}] 152 *> 192.168.12.0/24 192.168.12.1 00:00:00 [{Origin: i} {Med: 0} {LocalPref: 100}] 153 *> 192.168.13.0/24 192.168.12.1 00:00:00 [{Origin: i} {Med: 0} {LocalPref: 100}] 154 ``` 155 156 And only these routes are installed on R1's Kernel routing table. 157 158 ```bash 159 R1> ip route 160 192.168.12.0/24 dev r1-eth1 proto kernel scope link src 192.168.12.1 161 192.168.13.0/24 dev r1-eth2 proto kernel scope link src 192.168.13.1 162 ``` 163 164 Then, let's add new routes destinated to "10.23.1.0/24" on R2 and R3 routes. 165 These routes should be treated as Multipath routes which have the same cost. 166 167 ```bash 168 R2> gobgp global rib -a ipv4 add 10.23.1.0/24 169 R2> gobgp global rib -a ipv4 170 Network Next Hop AS_PATH Age Attrs 171 *> 1.1.1.1/32 192.168.12.1 00:10:00 [{Origin: i} {Med: 0} {LocalPref: 100}] 172 *> 10.23.1.0/24 0.0.0.0 00:00:00 [{Origin: ?}] 173 *> 192.168.12.0/24 192.168.12.1 00:10:00 [{Origin: i} {Med: 0} {LocalPref: 100}] 174 *> 192.168.13.0/24 192.168.12.1 00:10:00 [{Origin: i} {Med: 0} {LocalPref: 100}] 175 176 R3> gobgp global rib -a ipv4 add 10.23.1.0/24 177 R3> gobgp global rib -a ipv4 178 Network Next Hop AS_PATH Age Attrs 179 *> 1.1.1.1/32 192.168.13.1 00:10:00 [{Origin: i} {Med: 0} {LocalPref: 100}] 180 *> 10.23.1.0/24 0.0.0.0 00:00:00 [{Origin: ?}] 181 *> 192.168.12.0/24 192.168.13.1 00:10:00 [{Origin: i} {Med: 0} {LocalPref: 100}] 182 *> 192.168.13.0/24 192.168.13.1 00:10:00 [{Origin: i} {Med: 0} {LocalPref: 100}] 183 ``` 184 185 GoBGP on R1 will receive these routes and install them into R1's Kernel routing 186 table via Zebra. The following shows that traffic to "10.23.1.0/24" will be 187 forwarded through the interface r1-eth1 (nexthop is R2) or the interface r1-eth2 188 (nexthop is R3) with the same weight. 189 190 ```bash 191 R1> gobgp global rib -a ipv4 192 Network Next Hop AS_PATH Age Attrs 193 *> 1.1.1.1/32 0.0.0.0 00:15:00 [{Origin: i} {Med: 0}] 194 *> 10.23.1.0/24 192.168.12.2 00:05:00 [{Origin: ?} {LocalPref: 100}] 195 * 10.23.1.0/24 192.168.13.3 00:05:00 [{Origin: ?} {LocalPref: 100}] 196 *> 192.168.12.0/24 0.0.0.0 00:15:00 [{Origin: i} {Med: 0}] 197 *> 192.168.13.0/24 0.0.0.0 00:15:00 [{Origin: i} {Med: 0}] 198 199 R1> ip route 200 10.23.1.0/24 proto zebra 201 nexthop via 192.168.12.2 dev r1-eth1 weight 1 202 nexthop via 192.168.13.3 dev r1-eth2 weight 1 203 192.168.12.0/24 dev r1-eth1 proto kernel scope link src 192.168.12.1 204 192.168.13.0/24 dev r1-eth2 proto kernel scope link src 192.168.13.1 205 ```