github.com/osrg/gobgp@v2.0.0+incompatible/docs/sources/evpn.md (about) 1 # Ethernet VPN (EVPN) 2 3 This page explains an configuration for EVPN. Note that the feature is 4 still very experimental. 5 6 ## Contents 7 8 - [CLI Syntax](#cli-syntax) 9 - [Ethernet Segment Identifier](#ethernet-segment-identifier) 10 - [Ethernet Auto-discovery Route](#ethernet-auto-discovery-route) 11 - [MAC/IP Advertisement Route](#macip-advertisement-route) 12 - [Inclusive Multicast Ethernet Tag Route](#inclusive-multicast-ethernet-tag-route) 13 - [Ethernet Segment Route](#ethernet-segment-route) 14 - [IP Prefix Route](#ip-prefix-route) 15 - [Reference](#reference) 16 - [Router's MAC Option](#routers-mac-option) 17 - [BaGPipe](#bagpipe) 18 - [Configuration](#configuration) 19 - [Advertising EVPN route](#advertising-evpn-route) 20 - [YABGP](#yabgp) 21 - [Configuration](#configuration-1) 22 - [Advertising EVPN route](#advertising-evpn-route-1) 23 24 ## CLI Syntax 25 26 ### Ethernet Segment Identifier 27 28 Some route types requires to specify Ethernet Segment Identifier (ESI) for its 29 argument. The supported ESI types and their formats are the following. 30 31 | Type | Format | Description | 32 | ---- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------- | 33 | 0 | single-homed | Reserved keyword for arbitrary ESI type to denote a single-homed site. | 34 | 0 | 0 | The same with "single-homed". | 35 | 0 | ARBITRARY \<Value> | Arbitrary ESI type with arbitrary value. Value should be colon separated hex values (similar to MAC address). | 36 | 1 | LACP \<MAC> \<Port Key> | Type for LACP configured segment. | 37 | 2 | MSTP \<MAC> \<Priority> | Type for L2 bridge protocol (e.g., Multiple Spanning Tree Protocol) configured segment. | 38 | 3 | MAC \<MAC> \<Discriminator> | Type for ESI based on MAC address. | 39 | 4 | ROUTERID \<Router ID> \<Discriminator> | Type for ESI based on Router ID. | 40 | 5 | AS \<AS> \<Discriminator> | Type for ESI based on AS number. | 41 42 ### Example - Ethernet Segment Identifier 43 44 ```bash 45 # single-homed 46 $ gobgp global rib -a evpn add a-d esi single-homed etag 100 label 200 rd 1.1.1.1:100 47 $ gobgp global rib -a evpn 48 Network Labels Next Hop AS_PATH Age Attrs 49 *> [type:A-D][rd:1.1.1.1:100][esi:single-homed][etag:100] [200] 0.0.0.0 00:00:00 [{Origin: ?}] 50 51 # ARBITRARY <Value> 52 $ gobgp global rib -a evpn add a-d esi ARBITRARY 11:22:33:44:55:66:77:88:99 etag 100 label 200 rd 1.1.1.1:100 53 $ gobgp global rib -a evpn 54 Network Labels Next Hop AS_PATH Age Attrs 55 *> [type:A-D][rd:1.1.1.1:100][esi:ESI_ARBITRARY | 11:22:33:44:55:66:77:88:99][etag:100] [200] 0.0.0.0 00:00:00 [{Origin: ?}] 56 57 # LACP <MAC> <Port Key> 58 $ gobgp global rib -a evpn add a-d esi LACP aa:bb:cc:dd:ee:ff 10 etag 100 label 200 rd 1.1.1.1:100 59 $ gobgp global rib -a evpn 60 Network Labels Next Hop AS_PATH Age Attrs 61 *> [type:A-D][rd:1.1.1.1:100][esi:ESI_LACP | system mac aa:bb:cc:dd:ee:ff, port key 10][etag:100] [200] 0.0.0.0 00:00:00 [{Origin: ?}] 62 63 # MSTP <MAC> <Priority> 64 $ gobgp global rib -a evpn add a-d esi MSTP aa:bb:cc:dd:ee:ff 10 etag 100 label 200 rd 1.1.1.1:100 65 $ gobgp global rib -a evpn 66 Network Labels Next Hop AS_PATH Age Attrs 67 *> [type:A-D][rd:1.1.1.1:100][esi:ESI_MSTP | bridge mac aa:bb:cc:dd:ee:ff, priority 10][etag:100] [200] 0.0.0.0 00:00:00 [{Origin: ?}] 68 69 # MAC <MAC> <Discriminator> 70 $ gobgp global rib -a evpn add a-d esi MAC aa:bb:cc:dd:ee:ff 10 etag 100 label 200 rd 1.1.1.1:100 71 $ gobgp global rib -a evpn 72 Network Labels Next Hop AS_PATH Age Attrs 73 *> [type:A-D][rd:1.1.1.1:100][esi:ESI_MAC | system mac aa:bb:cc:dd:ee:ff, local discriminator 10][etag:100] [200] 0.0.0.0 00:00:00 [{Origin: ?}] 74 75 # ROUTERID <Router ID> <Discriminator> 76 $ gobgp global rib -a evpn add a-d esi ROUTERID 1.1.1.1 10 etag 100 label 200 rd 1.1.1.1:100 77 $ gobgp global rib -a evpn 78 Network Labels Next Hop AS_PATH Age Attrs 79 *> [type:A-D][rd:1.1.1.1:100][esi:ESI_ROUTERID | router id 1.1.1.1, local discriminator 10][etag:100] [200] 0.0.0.0 00:00:00 [{Origin: ?}] 80 81 # AS <AS> <Discriminator> 82 $ gobgp global rib -a evpn add a-d esi AS 65000 10 etag 100 label 200 rd 1.1.1.1:100 83 $ gobgp global rib -a evpn 84 Network Labels Next Hop AS_PATH Age Attrs 85 *> [type:A-D][rd:1.1.1.1:100][esi:ESI_AS | as 65000, local discriminator 10][etag:100] [200] 0.0.0.0 00:00:00 [{Origin: ?}] 86 ``` 87 88 ### Ethernet Auto-discovery Route 89 90 ```bash 91 # Add a route 92 $ gobgp global rib -a evpn add a-d esi <esi> etag <etag> label <label> rd <rd> [rt <rt>...] [encap <encap type>] [esi-label <esi-label> [single-active | all-active]] 93 94 # Show routes 95 $ gobgp global rib -a evpn [a-d] 96 97 # Delete route 98 $ gobgp global rib -a evpn del a-d esi <esi> etag <etag> label <label> rd <rd> 99 ``` 100 101 #### Example - Ethernet Auto-discovery Route 102 103 ```bash 104 # Simple case 105 $ gobgp global rib -a evpn add a-d esi 0 etag 100 label 200 rd 1.1.1.1:65000 106 $ gobgp global rib -a evpn 107 Network Labels Next Hop AS_PATH Age Attrs 108 *> [type:A-D][rd:1.1.1.1:65000][esi:single-homed][etag:100] [200] 0.0.0.0 00:00:00 [{Origin: ?}] 109 $ gobgp global rib -a evpn del a-d esi 0 etag 100 label 200 rd 1.1.1.1:65000 110 111 # With optionals 112 $ gobgp global rib -a evpn add a-d esi LACP aa:bb:cc:dd:ee:ff 100 etag 200 label 300 rd 1.1.1.1:65000 rt 65000:200 encap vxlan esi-label 400 single-active 113 $ gobgp global rib -a evpn a-d 114 Network Labels Next Hop AS_PATH Age Attrs 115 *> [type:A-D][rd:1.1.1.1:65000][esi:ESI_LACP | system mac aa:bb:cc:dd:ee:ff, port key 100][etag:200] [300] 0.0.0.0 00:00:00 [{Origin: ?} {Extcomms: [65000:200], [VXLAN], [esi-label: 400, single-active]}] 116 $ gobgp global rib -a evpn del a-d esi LACP aa:bb:cc:dd:ee:ff 100 etag 200 label 300 rd 1.1.1.1:65000 117 ``` 118 119 ### MAC/IP Advertisement Route 120 121 ```bash 122 # Add a route 123 $ gobgp global rib -a evpn add macadv <mac address> <ip address> [esi <esi>] etag <etag> label <label> rd <rd> [rt <rt>...] [encap <encap type>] [default-gateway] 124 125 # Show routes 126 $ gobgp global rib -a evpn [macadv] 127 128 # Delete route 129 $ gobgp global rib -a evpn del macadv <mac address> <ip address> [esi <esi>] etag <etag> label <label> rd <rd> 130 ``` 131 132 #### Example - MAC/IP Advertisement Route 133 134 ```bash 135 # Simple case 136 $ gobgp global rib -a evpn add macadv aa:bb:cc:dd:ee:ff 10.0.0.1 etag 100 label 200,300 rd 1.1.1.1:65000 137 $ gobgp global rib -a evpn 138 Network Labels Next Hop AS_PATH Age Attrs 139 *> [type:macadv][rd:1.1.1.1:65000][etag:100][mac:aa:bb:cc:dd:ee:ff][ip:10.0.0.1] [200,300] 0.0.0.0 00:00:00 [{Origin: ?} [ESI: single-homed]] 140 $ gobgp global rib -a evpn del macadv aa:bb:cc:dd:ee:ff 10.0.0.1 etag 100 label 200,300 rd 1.1.1.1:65000 141 142 # With optionals 143 $ gobgp global rib -a evpn add macadv aa:bb:cc:dd:ee:ff 10.0.0.1 esi AS 65000 100 etag 200 label 300 rd 1.1.1.1:65000 rt 65000:400 encap vxlan default-gateway 144 $ gobgp global rib -a evpn macadv 145 Network Labels Next Hop AS_PATH Age Attrs 146 *> [type:macadv][rd:1.1.1.1:65000][etag:200][mac:aa:bb:cc:dd:ee:ff][ip:10.0.0.1] [300] 0.0.0.0 00:00:00 [{Origin: ?} {Extcomms: [65000:400], [VXLAN], [default-gateway]} [ESI: ESI_AS | as 65000, local discriminator 100]] 147 $ gobgp global rib -a evpn del macadv aa:bb:cc:dd:ee:ff 10.0.0.1 esi AS 65000 100 etag 200 label 300 rd 1.1.1.1:65000 148 ``` 149 150 ### Inclusive Multicast Ethernet Tag Route 151 152 ```bash 153 # Add a route 154 $ gobgp global rib -a evpn add multicast <ip address> etag <etag> rd <rd> [rt <rt>...] [encap <encap type>] [pmsi <type> [leaf-info-required] <label> <tunnel-id>] 155 156 # Show routes 157 $ gobgp global rib -a evpn [multicast] 158 159 # Delete route 160 $ gobgp global rib -a evpn del multicast <ip address> etag <etag> rd <rd> 161 ``` 162 163 #### Example - Inclusive Multicast Ethernet Tag Route 164 165 ```bash 166 # Simple case 167 $ gobgp global rib -a evpn add multicast 10.0.0.1 etag 100 rd 1.1.1.1:65000 168 $ gobgp global rib -a evpn 169 Network Labels Next Hop AS_PATH Age Attrs 170 *> [type:multicast][rd:1.1.1.1:65000][etag:100][ip:10.0.0.1] 0.0.0.0 00:00:00 [{Origin: ?}] 171 $ gobgp global rib -a evpn del multicast 10.0.0.1 etag 100 rd 1.1.1.1:65000 172 173 # With optionals 174 $ gobgp global rib -a evpn add multicast 10.0.0.1 etag 100 rd 1.1.1.1:65000 rt 65000:200 encap vxlan pmsi ingress-repl 100 1.1.1.1 175 $ gobgp global rib -a evpn multicast 176 Network Labels Next Hop AS_PATH Age Attrs 177 *> [type:multicast][rd:1.1.1.1:65000][etag:100][ip:10.0.0.1] 0.0.0.0 00:00:00 [{Origin: ?} {Pmsi: type: ingress-repl, label: 100, tunnel-id: 1.1.1.1} {Extcomms: [65000:200], [VXLAN]}] 178 ``` 179 180 ### Ethernet Segment Route 181 182 ```bash 183 # Add a route 184 $ gobgp global rib -a evpn add esi <ip address> esi <esi> rd <rd> [rt <rt>...] [encap <encap type>] 185 186 # Show routes 187 $ gobgp global rib -a evpn [esi] 188 189 # Delete route 190 $ gobgp global rib -a evpn del esi <ip address> esi <esi> rd <rd> 191 ``` 192 193 #### Example - Ethernet Segment Route 194 195 ```bash 196 # Simple case 197 $ gobgp global rib -a evpn add esi 10.0.0.1 esi 0 rd 1.1.1.1:65000 198 $ gobgp global rib -a evpn 199 Network Labels Next Hop AS_PATH Age Attrs 200 *> [type:esi][rd:1.1.1.1:65000][esi:single-homed][ip:10.0.0.1] 0.0.0.0 00:00:00 [{Origin: ?}] 201 $ gobgp global rib -a evpn del esi 10.0.0.1 esi 0 rd 1.1.1.1:65000 202 203 # With optionals 204 $ gobgp global rib -a evpn add esi 10.0.0.1 esi MAC aa:bb:cc:dd:ee:ff 100 rd 1.1.1.1:65000 rt 65000:200 encap vxlan 205 $ gobgp global rib -a evpn esi 206 Network Labels Next Hop AS_PATH Age Attrs 207 *> [type:esi][rd:1.1.1.1:65000][esi:ESI_MAC | system mac aa:bb:cc:dd:ee:ff, local discriminator 100][ip:10.0.0.1] 0.0.0.0 00:00:00 [{Origin: ?} {Extcomms: [65000:200], [VXLAN], [es-import rt: aa:bb:cc:dd:ee:ff]}] 208 $ gobgp global rib -a evpn del esi 10.0.0.1 esi MAC aa:bb:cc:dd:ee:ff 100 rd 1.1.1.1:65000 209 ``` 210 211 ### IP Prefix Route 212 213 ```bash 214 # Add a route 215 $ gobgp global rib -a evpn add prefix <ip prefix> [gw <gateway>] [esi <esi>] etag <etag> [label <label>] rd <rd> [rt <rt>...] [encap <encap type>] [router-mac <mac address>] 216 217 # Show routes 218 $ gobgp global rib -a evpn [prefix] 219 220 # Delete route 221 $ gobgp global rib -a evpn del prefix <ip prefix> [gw <gateway>] [esi <esi>] etag <etag> [label <label>] rd <rd> 222 ``` 223 224 #### Example - IP Prefix Route 225 226 ```bash 227 # Simple case 228 $ gobgp global rib -a evpn add prefix 10.0.0.0/24 etag 100 rd 1.1.1.1:65000 229 $ gobgp global rib -a evpn 230 Network Labels Next Hop AS_PATH Age Attrs 231 *> [type:Prefix][rd:1.1.1.1:65000][etag:100][prefix:10.0.0.0/24] [0] 0.0.0.0 00:00:00 [{Origin: ?} [ESI: single-homed] [GW: 0.0.0.0]] 232 $ gobgp global rib -a evpn del prefix 10.0.0.0/24 etag 100 rd 1.1.1.1:65000 233 234 # With optionals 235 $ gobgp global rib -a evpn add prefix 10.0.0.0/24 172.16.0.1 esi MSTP aa:aa:aa:aa:aa:aa 100 etag 200 label 300 rd 1.1.1.1:65000 rt 65000:200 encap vxlan router-mac bb:bb:bb:bb:bb:bb 236 $ gobgp global rib -a evpn prefix 237 Network Labels Next Hop AS_PATH Age Attrs 238 *> [type:Prefix][rd:1.1.1.1:65000][etag:200][prefix:10.0.0.0/24] [300] 0.0.0.0 00:00:00 [{Origin: ?} {Extcomms: [65000:200], [VXLAN], [router's mac: bb:bb:bb:bb:bb:bb]} [ESI: ESI_MSTP | bridge mac aa:aa:aa:aa:aa:aa, priority 100] [GW: 0.0.0.0]] 239 $ gobgp global rib -a evpn del prefix 10.0.0.0/24 172.16.0.1 esi MSTP aa:aa:aa:aa:aa:aa 100 etag 200 label 300 rd 1.1.1.1:65000 240 ``` 241 242 ## Reference 243 244 ### Router's MAC Option 245 246 The `router-mac` option in `gobgp` CLI allows sending Router's 247 MAC Extended Community via BGP EVPN Type 2 and Type 5 advertisements. 248 249 As explained in below RFC draft, this community is used to carry the 250 MAC address of the VTEP where MAC-IP pair resides. 251 252 For example, GoBGP router (R1) peers with Cisco router (R2). 253 R1 is used by an orchestraction platform, e.g. OpenStack, Docker Swarm, 254 etc., to advertise container MAC-IP bindings. When R1 advertises the 255 binding it also sets next hop for the route as the host where the MAC-IP 256 binding (i.e. container) resides. When R2 receives the route, it will 257 not install it unless Router's MAC Extended Community is present. R2 258 will use the MAC address in the community to create an entry in MAC 259 address table of R2 pointint to NVE interface. 260 261 ```bash 262 gobgp global rib -a evpn add macadv e9:72:d7:aa:1f:b4 \ 263 172.16.100.100 etag 0 label 34567 rd 10.1.1.1:100 \ 264 rt 65001:100 encap vxlan nexthop 10.10.10.10 \ 265 origin igp router-mac e9:72:d7:aa:1f:b4 266 267 gobgp global rib -a evpn add nexthop 10.10.10.10 origin igp \ 268 prefix 172.16.100.100/32 esi 0 etag 0 rd 10.1.1.1:100 \ 269 rt 65001:100 gw 10.10.10.10 label 34567 encap vxlan \ 270 router-mac e9:72:d7:aa:1f:b4 271 ``` 272 273 In the above example, a host with IP of `10.10.10.10` runs a 274 container connected to an Open vSwitch instance. The container's IP 275 address is `172.16.100.100` and MAC address `e9:72:d7:aa:1f:b4`. 276 The Open vSwitch is VTEP with `tunnel_key=34567`, i.e. VNID `34567`. 277 278 GoBGP (R1) and Cisco (R2) routers are in BGP AS 65001. R1's IP is 279 `10.1.1.1`. R2 used RT of `65001:100` to import routes and place 280 them into appropriate VRF. In this case the VRF is associated with 281 L2VNI from VLAN 300. Upon the receipt of the above BGP EVPN 282 Type 2 and Type 5 routes, R2 will create create a MAC address 283 entry pointing to it's NVE interface with destination IP address 284 of `10.10.10.10`. 285 286 ```bash 287 Legend: 288 * - primary entry, G - Gateway MAC, (R) - Routed MAC, O - Overlay MAC 289 age - seconds since last seen,+ - primary entry using vPC Peer-Link, 290 (T) - True, (F) - False, C - ControlPlane MAC 291 VLAN MAC Address Type age Secure NTFY Ports 292 ---------+-----------------+--------+---------+------+----+------------------ 293 * 300 e972.d7aa.1fb4 static - F F nve1(10.10.10.10) 294 ``` 295 296 The R2 will use the `router-mac e9:72:d7:aa:1f:b4` as the destination MAC 297 address of the inner VXLAN packet. For example, an underlay host `20.20.20.20` 298 ping the container. The inner VXLAN L2 destination address is 299 `e9:72:d7:aa:1f:b4`. The inner VXLAN L2 source address is R2's MAC. The outer 300 VXLAN L3 source address, i.e. `10.2.2.2` is R2' NVE address. 301 302 ```bash 303 OUTER VXLAN L2: 10:20:08:d0:ff:23 > b2:0e:19:6a:8d:51 304 OUTER VXLAN L3: 10.2.2.2.45532 > 10.10.10.10.4789: VXLAN, flags [I] (0x08), vni 34567 305 INNER VXLAN L2: 4e:f4:ca:aa:f6:7b > e9:72:d7:aa:1f:b4 306 INNER VXLAN L3: 20.20.20.20 > 172.16.100.100: ICMP echo reply, id 66, seq 1267, length 64 307 ``` 308 309 See also: [Integrated Routing and Bridging in EVPN](https://tools.ietf.org/html/draft-ietf-bess-evpn-inter-subnet-forwarding-03#section-6.1) 310 311 ## BaGPipe 312 313 This example uses [BaGPipe](https://github.com/openstack/networking-bagpipe). GoBGP receives 314 routes from one BaGPipe peer and advertises it to another BaGPipe peer. 315 316 **NOTE:** The following supposes to use BaGPipe version "7.0.0". 317 318 ### Configuration 319 320 Please note BaGPipe supports only iBGP. 321 So here supposes a topology that GoBGP is configured as Route Reflector. 322 Two BaGPipe peers are Route Reflector clients and not connected to each other. 323 Then the following example shows two OSS BGP implementations can interchange EVPN messages. 324 325 Topology: 326 327 ```text 328 +------------+ 329 | GoBGP (RR) | 330 +-----| AS 65000 |-----+ 331 | | 10.0.0.254 | | 332 | +------------+ | 333 | | 334 (iBGP) (iBGP) 335 | | 336 +----------+ +----------+ 337 | BaGPipe | | BaGPipe | 338 | AS 65000 | | AS 65000 | 339 | 10.0.0.1 | | 10.0.0.2 | 340 +----------+ +----------+ 341 ``` 342 343 The following shows the sample configuration for GoBGP. 344 The point is that "l2vpn-evpn" families to be advertised need to be specified. 345 346 GoBGP on "10.0.0.254": `gobgpd.toml` 347 348 ```toml 349 [global.config] 350 as = 65000 351 router-id = "10.0.0.254" 352 353 [[neighbors]] 354 [neighbors.config] 355 neighbor-address = "10.0.0.1" 356 peer-as = 65000 357 [neighbors.route-reflector.config] 358 route-reflector-client = true 359 route-reflector-cluster-id = "10.0.0.254" 360 [[neighbors.afi-safis]] 361 [neighbors.afi-safis.config] 362 afi-safi-name = "l2vpn-evpn" 363 364 [[neighbors]] 365 [neighbors.config] 366 neighbor-address = "10.0.0.2" 367 peer-as = 65000 368 [neighbors.route-reflector.config] 369 route-reflector-client = true 370 route-reflector-cluster-id = "10.0.0.254" 371 [[neighbors.afi-safis]] 372 [neighbors.afi-safis.config] 373 afi-safi-name = "l2vpn-evpn" 374 ``` 375 376 If you are not familiar with BaGPipe, the following shows our configuration files. 377 378 BaGPipe peer on "10.0.0.1": `/etc/bagpipe-bgp/bgp.conf` 379 380 ```ini 381 [BGP] 382 local_address=10.0.0.1 383 peers=10.0.0.254 384 my_as=65000 385 enable_rtc=True 386 387 [API] 388 host=localhost 389 port=8082 390 391 [DATAPLANE_DRIVER_IPVPN] 392 dataplane_driver = DummyDataplaneDriver 393 394 [DATAPLANE_DRIVER_EVPN] 395 dataplane_driver = DummyDataplaneDriver 396 ``` 397 398 BaGPipe peer on "10.0.0.2": `/etc/bagpipe-bgp/bgp.conf` 399 400 ```ini 401 [BGP] 402 local_address=10.0.0.2 403 peers=10.0.0.254 404 my_as=65000 405 enable_rtc=True 406 407 [API] 408 api_host=localhost 409 api_port=8082 410 411 [DATAPLANE_DRIVER_IPVPN] 412 dataplane_driver = DummyDataplaneDriver 413 414 [DATAPLANE_DRIVER_EVPN] 415 dataplane_driver = DummyDataplaneDriver 416 ``` 417 418 Then, run GoBGP and BaGPipe peers. 419 420 ```bash 421 # GoBGP 422 $ gobgpd -f gobgpd.toml 423 424 # BaGPipe 425 # If bgp.conf does not locate on the default path, please specify the config file as following. 426 $ bagpipe-bgp --config-file /etc/bagpipe-bgp/bgp.conf 427 ``` 428 429 ### Advertising EVPN route 430 431 As you expect, the RIBs at BaGPipe peer on "10.0.0.2" has nothing. 432 433 ```bash 434 # BaGPipe peer on "10.0.0.2" 435 $ bagpipe-looking-glass bgp routes 436 l2vpn/evpn,*: - 437 ipv4/mpls-vpn,*: - 438 ipv4/rtc,*: - 439 ipv4/flow-vpn,*: - 440 ``` 441 442 Let's advertise EVPN routes from BaGPipe peer on "10.0.0.1". 443 444 ```bash 445 # BaGPipe peer on "10.0.0.1" 446 $ bagpipe-rest-attach --attach --network-type evpn --port tap-dummy --mac 00:11:22:33:44:55 --ip 11.11.11.1 --gateway-ip 11.11.11.254 --rt 65000:77 --vni 100 447 request: {"import_rt": ["65000:77"], "lb_consistent_hash_order": 0, "vpn_type": "evpn", "vni": 100, "vpn_instance_id": "evpn-bagpipe-test", "ip_address": "11.11.11.1/24", "export_rt": ["65000:77"], "local_port": {"linuxif": "tap-dummy"}, "advertise_subnet": false, "attract_traffic": {}, "gateway_ip": "11.11.11.254", "mac_address": "00:11:22:33:44:55", "readvertise": null} 448 response: 200 null 449 ``` 450 451 Now the RIBs at GoBGP and BaGPipe peer "10.0.0.2" has the advertised routes. The route was interchanged via GoBGP peer. 452 453 ```bash 454 # GoBGP 455 $ gobgp global rib -a evpn 456 Network Labels Next Hop AS_PATH Age Attrs 457 *> [type:macadv][rd:10.0.0.1:118][etag:0][mac:00:11:22:33:44:55][ip:11.11.11.1] [1601] 10.0.0.1 hh:mm:ss [{Origin: i} {LocalPref: 100} {Extcomms: [VXLAN], [65000:77]} [ESI: single-homed]] 458 *> [type:multicast][rd:10.0.0.1:118][etag:0][ip:10.0.0.1] 10.0.0.1 hh:mm:ss [{Origin: i} {LocalPref: 100} {Extcomms: [VXLAN], [65000:77]} {Pmsi: type: ingress-repl, label: 1600, tunnel-id: 10.0.0.1}] 459 460 # BaGPipe peer on "10.0.0.2" 461 $ bagpipe-looking-glass bgp routes 462 l2vpn/evpn,*: 463 * evpn:macadv::10.0.0.1:118:-:0:00:11:22:33:44:55/48:11.11.11.1: label [ 100 ]: 464 attributes: 465 originator-id: 10.0.0.1 466 cluster-list: [ 10.0.0.254 ] 467 extended-community: [ target:65000:77 encap:VXLAN ] 468 next_hop: 10.0.0.1 469 afi-safi: l2vpn/evpn 470 source: BGP-10.0.0.254 (...) 471 route_targets: 472 * target:65000:77 473 * evpn:multicast::10.0.0.1:118:0:10.0.0.1: 474 attributes: 475 cluster-list: [ 10.0.0.254 ] 476 originator-id: 10.0.0.1 477 pmsi-tunnel: pmsi:ingressreplication:-:100:10.0.0.1 478 extended-community: [ target:65000:77 encap:VXLAN ] 479 next_hop: 10.0.0.1 480 afi-safi: l2vpn/evpn 481 source: BGP-10.0.0.254 (...) 482 route_targets: 483 * target:65000:77 484 ipv4/mpls-vpn,*: - 485 ipv4/rtc,*: - 486 ipv4/flow-vpn,*: - 487 ``` 488 489 ## YABGP 490 491 Just like the example using BaGPipe, this example uses [YABGP](https://github.com/smartbgp/yabgp). 492 GoBGP receives EVPN routes from one YABGP peer and re-advertises it to another YABGP peer. 493 494 **NOTE:** The following supposes to use YABGP version "0.4.0". 495 496 ### Configuration 497 498 YABGP supports eBGP peering. The following example shows GoBGP and two YABGP peers are connected 499 with eBGP and GoBGP interchanges EVPN routes from one YABGP peer to another. 500 501 Topology: 502 503 ```text 504 +------------+ 505 | GoBGP | 506 +-----| AS 65254 |-----+ 507 | | 10.0.0.254 | | 508 | +------------+ | 509 | | 510 (eBGP) (eBGP) 511 | | 512 +----------+ +----------+ 513 | YABGP | | YABGP | 514 | AS 65001 | | AS 65002 | 515 | 10.0.0.1 | | 10.0.0.2 | 516 +----------+ +----------+ 517 ``` 518 519 GoBGP on "10.0.0.254": `gobgpd.toml` 520 521 ```toml 522 [global.config] 523 as = 65254 524 router-id = "10.0.0.254" 525 526 [[neighbors]] 527 [neighbors.config] 528 neighbor-address = "10.0.0.1" 529 peer-as = 65001 530 [[neighbors.afi-safis]] 531 [neighbors.afi-safis.config] 532 afi-safi-name = "l2vpn-evpn" 533 534 [[neighbors]] 535 [neighbors.config] 536 neighbor-address = "10.0.0.2" 537 peer-as = 65002 538 [[neighbors.afi-safis]] 539 [neighbors.afi-safis.config] 540 afi-safi-name = "l2vpn-evpn" 541 ``` 542 543 You can start YABGP with the following CLI options: 544 545 ```bash 546 # YABGP peer on "10.0.0.1" 547 $ yabgpd --bgp-local_as=65001 --bgp-local_addr=10.0.0.1 --bgp-remote_addr=10.0.0.254 --bgp-remote_as=65254 --bgp-afi_safi=evpn 548 549 # YABGP peer on "10.0.0.2" 550 $ yabgpd --bgp-local_as=65002 --bgp-local_addr=10.0.0.2 --bgp-remote_addr=10.0.0.254 --bgp-remote_as=65254 --bgp-afi_safi=evpn 551 ``` 552 553 Then, you can see GoBGP can connect to two YABGP peers by using gobgp command: 554 555 ``` bash 556 # GoBGP 557 $ gobgpd -f gobgpd.toml 558 ...(snip)... 559 560 $ gobgp neighbor 561 Peer AS Up/Down State |#Received Accepted 562 10.0.0.1 65001 hh:mm:ss Establ | 0 0 563 10.0.0.2 65002 hh:mm:ss Establ | 0 0 564 ``` 565 566 ### Advertising EVPN route 567 568 We can advertise EVPN routes from YABGP 10.0.0.1 through its [REST 569 API](http://yabgp.readthedocs.io/en/latest/restapi.html). 570 In the REST request, you need to specify the `Authorization` header is `admin/admin`, and the 571 `Content-Type` is `application/json`. 572 573 Request URL for sending UPDATE messages: 574 575 ```text 576 POST http://10.0.0.1:8801/v1/peer/10.0.0.254/send/update 577 ``` 578 579 We will run this API four times to advertise four EVPN route types. 580 The following example use "curl" command for sending POST request. 581 582 EVPN type 1: 583 584 ```bash 585 curl -X POST -u admin:admin -H 'Content-Type: application/json' http://10.0.0.1:8801/v1/peer/10.0.0.254/send/update -d '{ 586 "attr": { 587 "1": 0, 588 "2": [], 589 "5": 100, 590 "14": { 591 "afi_safi": [ 592 25, 593 70 594 ], 595 "nexthop": "10.75.44.254", 596 "nlri": [ 597 { 598 "type": 1, 599 "value": { 600 "esi": 0, 601 "eth_tag_id": 100, 602 "label": [ 603 10 604 ], 605 "rd": "1.1.1.1:32867" 606 } 607 } 608 ] 609 }, 610 "16": [ 611 "esi-label:0:500" 612 ] 613 } 614 }' 615 ``` 616 617 EVPN type 2: 618 619 ```bash 620 curl -X POST -u admin:admin -H 'Content-Type: application/json' http://10.0.0.1:8801/v1/peer/10.0.0.254/send/update -d '{ 621 "attr": { 622 "1": 0, 623 "2": [], 624 "5": 100, 625 "14": { 626 "afi_safi": [ 627 25, 628 70 629 ], 630 "nexthop": "10.75.44.254", 631 "nlri": [ 632 { 633 "type": 2, 634 "value": { 635 "esi": 0, 636 "eth_tag_id": 108, 637 "ip": "11.11.11.1", 638 "label": [ 639 0 640 ], 641 "mac": "00-11-22-33-44-55", 642 "rd": "172.17.0.3:2" 643 } 644 } 645 ] 646 }, 647 "16": [ 648 "mac-mobility:1:500" 649 ] 650 } 651 }' 652 ``` 653 654 EVPN type 3: 655 656 ```bash 657 curl -X POST -u admin:admin -H 'Content-Type: application/json' http://10.0.0.1:8801/v1/peer/10.0.0.254/send/update -d '{ 658 "attr": { 659 "1": 0, 660 "2": [], 661 "5": 100, 662 "14": { 663 "afi_safi": [ 664 25, 665 70 666 ], 667 "nexthop": "10.75.44.254", 668 "nlri": [ 669 { 670 "type": 3, 671 "value": { 672 "eth_tag_id": 100, 673 "ip": "192.168.0.1", 674 "rd": "172.16.0.1:5904" 675 } 676 } 677 ] 678 } 679 } 680 }' 681 ``` 682 683 EVPN type 4: 684 685 ```bash 686 curl -X POST -u admin:admin -H 'Content-Type: application/json' http://10.0.0.1:8801/v1/peer/10.0.0.254/send/update -d '{ 687 "attr": { 688 "1": 0, 689 "2": [], 690 "5": 100, 691 "14": { 692 "afi_safi": [ 693 25, 694 70 695 ], 696 "nexthop": "10.75.44.254", 697 "nlri": [ 698 { 699 "type": 4, 700 "value": { 701 "esi": 0, 702 "ip": "192.168.0.1", 703 "rd": "172.16.0.1:8888" 704 } 705 } 706 ] 707 }, 708 "16": [ 709 "es-import:00-11-22-33-44-55" 710 ] 711 } 712 }' 713 ``` 714 715 GoBGP will receive these four routes and re-advertise them to YABGP peer on "10.0.0.2" 716 717 ```bash 718 # GoBGP 719 $ gobgp global rib -a evpn 720 Network Labels Next Hop AS_PATH Age Attrs 721 *> [type:A-D][rd:1.1.1.1:32867][esi:single-homed][etag:100] [161] 10.75.44.254 hh:mm:ss [{Extcomms: [esi-label: 8001]} {Origin: i} {LocalPref: 100}] 722 *> [type:esi][rd:172.16.0.1:8888][esi:single-homed][ip:192.168.0.1] 10.75.44.254 hh:mm:ss [{Extcomms: [es-import rt: 00:11:22:33:44:55]} {Origin: i} {LocalPref: 100}] 723 *> [type:macadv][rd:172.17.0.3:2][etag:108][mac:00:11:22:33:44:55][ip:11.11.11.1] [0] 10.75.44.254 hh:mm:ss [{Extcomms: [mac-mobility: 500, sticky]} {Origin: i} {LocalPref: 100} [ESI: single-homed]] 724 *> [type:multicast][rd:172.16.0.1:5904][etag:100][ip:192.168.0.1] 10.75.44.254 hh:mm:ss [{Origin: i} {LocalPref: 100}] 725 ``` 726 727 Then, check statistics of neighbors for confirming the number of re-advertised routes. 728 729 ```bash 730 # GoBGP 731 $ gobgp neighbor 732 Peer AS Up/Down State |#Received Accepted 733 10.0.0.1 65001 hh:mm:ss Establ | 4 4 734 10.0.0.2 65002 hh:mm:ss Establ | 0 0 735 736 $ gobgp neighbor 10.0.0.2 737 BGP neighbor is 10.0.0.2, remote AS 65002 738 BGP version 4, remote router ID 10.0.0.2 739 BGP state = established, up for hh:mm:ss 740 BGP OutQ = 0, Flops = 0 741 Hold time is 90, keepalive interval is 30 seconds 742 Configured hold time is 90, keepalive interval is 30 seconds 743 744 Neighbor capabilities: 745 multiprotocol: 746 l2vpn-evpn: advertised and received 747 route-refresh: advertised and received 748 4-octet-as: advertised and received 749 enhanced-route-refresh: received 750 cisco-route-refresh: received 751 Message statistics: 752 Sent Rcvd 753 Opens: 2 2 754 Notifications: 0 0 755 Updates: 4 0 756 Keepalives: 2 2 757 Route Refresh: 0 0 758 Discarded: 0 0 759 Total: 8 4 760 Route statistics: 761 Advertised: 4 762 Received: 0 763 Accepted: 0 764 ```