github.com/osrg/gobgp/v3@v3.30.0/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  ### I-PMSI Route
   243  
   244  ```bash
   245  # Add a route
   246  $ gobgp global rib -a evpn add i-pmsi etag <etag> rd <rd> [rt <rt>...] [encap <encap type>]
   247  
   248  # Show routes
   249  $ gobgp global rib -a evpn [i-pmsi]
   250  
   251  # Delete route
   252  $ gobgp global rib -a evpn del i-pmsi etag <etag> rd <rd>
   253  ```
   254  
   255  #### Example - I-PMSI Route
   256  
   257  ```bash
   258  # Simple case
   259  $ gobgp global rib -a evpn add i-pmsi etag 100 rd 1.1.1.1:65000 rt 65000:200
   260  $ gobgp global rib -a evpn i-pmsi
   261     Network                                                       Labels     Next Hop             AS_PATH              Age        Attrs
   262  *> [type:I-PMSI][rd:1.1.1.1:65000][etag:100][EC:65000:0]            0.0.0.0                                   00:00:00   [{Origin: ?}
   263  $ gobgp global rib -a evpn del i-pmsi 10.0.0.0/24 etag 100 rd 1.1.1.1:65000
   264  
   265  # With optionals
   266  $ gobgp global rib -a evpn add i-pmsi etag 100 rd 1.1.1.1:65000 rt 65000:200 encap vxlan pmsi ingress-repl 100 1.1.1.1
   267  $ gobgp global rib -a evpn i-pmsi
   268     Network                                                       Labels     Next Hop             AS_PATH              Age        Attrs
   269  *> [type:I-PMSI][rd:1.1.1.1:65000][etag:100][EC:65000:0]            0.0.0.0                                   00:00:00   [{Origin: ?} {Pmsi: type: ingress-repl, label: 100, tunnel-id: 1.1.1.1} {Extcomms: [65000:200], [VXLAN]}]
   270  $ gobgp global rib -a evpn del i-pmsi etag 200 rd 1.1.1.1:65000
   271  ```
   272  
   273  ## Reference
   274  
   275  ### Router's MAC Option
   276  
   277  The `router-mac` option in `gobgp` CLI allows sending Router's
   278  MAC Extended Community via BGP EVPN Type 2 and Type 5 advertisements.
   279  
   280  As explained in below RFC draft, this community is used to carry the
   281  MAC address of the VTEP where MAC-IP pair resides.
   282  
   283  For example, GoBGP router (R1) peers with Cisco router (R2).
   284  R1 is used by an orchestraction platform, e.g. OpenStack, Docker Swarm,
   285  etc., to advertise container MAC-IP bindings. When R1 advertises the
   286  binding it also sets next hop for the route as the host where the MAC-IP
   287  binding (i.e. container) resides. When R2 receives the route, it will
   288  not install it unless Router's MAC Extended Community is present. R2
   289  will use the MAC address in the community to create an entry in MAC
   290  address table of R2 pointint to NVE interface.
   291  
   292  ```bash
   293  gobgp global rib -a evpn add macadv e9:72:d7:aa:1f:b4 \
   294      172.16.100.100 etag 0 label 34567 rd 10.1.1.1:100 \
   295      rt 65001:100 encap vxlan nexthop 10.10.10.10 \
   296      origin igp router-mac e9:72:d7:aa:1f:b4
   297  
   298  gobgp global rib -a evpn add nexthop 10.10.10.10 origin igp \
   299      prefix 172.16.100.100/32 esi 0 etag 0 rd 10.1.1.1:100 \
   300      rt 65001:100 gw 10.10.10.10 label 34567 encap vxlan \
   301      router-mac e9:72:d7:aa:1f:b4
   302  ```
   303  
   304  In the above example, a host with IP of `10.10.10.10` runs a
   305  container connected to an Open vSwitch instance. The container's IP
   306  address is `172.16.100.100` and MAC address `e9:72:d7:aa:1f:b4`.
   307  The Open vSwitch is VTEP with `tunnel_key=34567`, i.e. VNID `34567`.
   308  
   309  GoBGP (R1) and Cisco (R2) routers are in BGP AS 65001. R1's IP is
   310  `10.1.1.1`. R2 used RT of `65001:100` to import routes and place
   311  them into appropriate VRF. In this case the VRF is associated with
   312  L2VNI from VLAN 300. Upon the receipt of the above BGP EVPN
   313  Type 2 and Type 5 routes, R2 will create create a MAC address
   314  entry pointing to it's NVE interface with destination IP address
   315  of `10.10.10.10`.
   316  
   317  ```bash
   318  Legend:
   319          * - primary entry, G - Gateway MAC, (R) - Routed MAC, O - Overlay MAC
   320          age - seconds since last seen,+ - primary entry using vPC Peer-Link,
   321          (T) - True, (F) - False, C - ControlPlane MAC
   322     VLAN     MAC Address      Type      age     Secure NTFY Ports
   323  ---------+-----------------+--------+---------+------+----+------------------
   324  *  300     e972.d7aa.1fb4   static   -         F      F    nve1(10.10.10.10)
   325  ```
   326  
   327  The R2 will use the `router-mac e9:72:d7:aa:1f:b4` as the destination MAC
   328  address of the inner VXLAN packet. For example, an underlay host `20.20.20.20`
   329  ping the container. The inner VXLAN L2 destination address is
   330  `e9:72:d7:aa:1f:b4`. The inner VXLAN L2 source address is R2's MAC. The outer
   331  VXLAN L3 source address, i.e. `10.2.2.2` is R2' NVE address.
   332  
   333  ```bash
   334  OUTER VXLAN L2: 10:20:08:d0:ff:23 > b2:0e:19:6a:8d:51
   335  OUTER VXLAN L3: 10.2.2.2.45532 > 10.10.10.10.4789: VXLAN, flags [I] (0x08), vni 34567
   336  INNER VXLAN L2: 4e:f4:ca:aa:f6:7b > e9:72:d7:aa:1f:b4
   337  INNER VXLAN L3: 20.20.20.20 > 172.16.100.100: ICMP echo reply, id 66, seq 1267, length 64
   338  ```
   339  
   340  See also: [Integrated Routing and Bridging in EVPN](https://tools.ietf.org/html/draft-ietf-bess-evpn-inter-subnet-forwarding-03#section-6.1)
   341  
   342  ## BaGPipe
   343  
   344  This example uses [BaGPipe](https://github.com/openstack/networking-bagpipe). GoBGP receives
   345  routes from one BaGPipe peer and advertises it to another BaGPipe peer.
   346  
   347  **NOTE:** The following supposes to use BaGPipe version "7.0.0".
   348  
   349  ### Configuration
   350  
   351  Please note BaGPipe supports only iBGP.
   352  So here supposes a topology that GoBGP is configured as Route Reflector.
   353  Two BaGPipe peers are Route Reflector clients and not connected to each other.
   354  Then the following example shows two OSS BGP implementations can interchange EVPN messages.
   355  
   356  Topology:
   357  
   358  ```text
   359             +------------+
   360             | GoBGP (RR) |
   361       +-----| AS 65000   |-----+
   362       |     | 10.0.0.254 |     |
   363       |     +------------+     |
   364       |                        |
   365     (iBGP)                  (iBGP)
   366       |                        |
   367  +----------+            +----------+
   368  | BaGPipe  |            | BaGPipe  |
   369  | AS 65000 |            | AS 65000 |
   370  | 10.0.0.1 |            | 10.0.0.2 |
   371  +----------+            +----------+
   372  ```
   373  
   374  The following shows the sample configuration for GoBGP.
   375  The point is that "l2vpn-evpn" families to be advertised need to be specified.
   376  
   377  GoBGP on "10.0.0.254": `gobgpd.toml`
   378  
   379  ```toml
   380  [global.config]
   381    as = 65000
   382    router-id = "10.0.0.254"
   383  
   384  [[neighbors]]
   385    [neighbors.config]
   386      neighbor-address = "10.0.0.1"
   387      peer-as = 65000
   388    [neighbors.route-reflector.config]
   389      route-reflector-client = true
   390      route-reflector-cluster-id = "10.0.0.254"
   391    [[neighbors.afi-safis]]
   392      [neighbors.afi-safis.config]
   393        afi-safi-name = "l2vpn-evpn"
   394  
   395  [[neighbors]]
   396    [neighbors.config]
   397      neighbor-address = "10.0.0.2"
   398      peer-as = 65000
   399    [neighbors.route-reflector.config]
   400      route-reflector-client = true
   401      route-reflector-cluster-id = "10.0.0.254"
   402    [[neighbors.afi-safis]]
   403      [neighbors.afi-safis.config]
   404        afi-safi-name = "l2vpn-evpn"
   405  ```
   406  
   407  If you are not familiar with BaGPipe, the following shows our configuration files.
   408  
   409  BaGPipe peer on "10.0.0.1": `/etc/bagpipe-bgp/bgp.conf`
   410  
   411  ```ini
   412  [BGP]
   413  local_address=10.0.0.1
   414  peers=10.0.0.254
   415  my_as=65000
   416  enable_rtc=True
   417  
   418  [API]
   419  host=localhost
   420  port=8082
   421  
   422  [DATAPLANE_DRIVER_IPVPN]
   423  dataplane_driver = DummyDataplaneDriver
   424  
   425  [DATAPLANE_DRIVER_EVPN]
   426  dataplane_driver = DummyDataplaneDriver
   427  ```
   428  
   429  BaGPipe peer on "10.0.0.2": `/etc/bagpipe-bgp/bgp.conf`
   430  
   431  ```ini
   432  [BGP]
   433  local_address=10.0.0.2
   434  peers=10.0.0.254
   435  my_as=65000
   436  enable_rtc=True
   437  
   438  [API]
   439  api_host=localhost
   440  api_port=8082
   441  
   442  [DATAPLANE_DRIVER_IPVPN]
   443  dataplane_driver = DummyDataplaneDriver
   444  
   445  [DATAPLANE_DRIVER_EVPN]
   446  dataplane_driver = DummyDataplaneDriver
   447  ```
   448  
   449  Then, run GoBGP and BaGPipe peers.
   450  
   451  ```bash
   452  # GoBGP
   453  $ gobgpd -f gobgpd.toml
   454  
   455  # BaGPipe
   456  # If bgp.conf does not locate on the default path, please specify the config file as following.
   457  $ bagpipe-bgp --config-file /etc/bagpipe-bgp/bgp.conf
   458  ```
   459  
   460  ### Advertising EVPN route
   461  
   462  As you expect, the RIBs at BaGPipe peer on "10.0.0.2" has nothing.
   463  
   464  ```bash
   465  # BaGPipe peer on "10.0.0.2"
   466  $ bagpipe-looking-glass bgp routes
   467  l2vpn/evpn,*: -
   468  ipv4/mpls-vpn,*: -
   469  ipv4/rtc,*: -
   470  ipv4/flow-vpn,*: -
   471  ```
   472  
   473  Let's advertise EVPN routes from BaGPipe peer on "10.0.0.1".
   474  
   475  ```bash
   476  # BaGPipe peer on "10.0.0.1"
   477  $ 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
   478  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}
   479  response: 200 null
   480  ```
   481  
   482  Now the RIBs at GoBGP and BaGPipe peer "10.0.0.2" has the advertised routes. The route was interchanged via GoBGP peer.
   483  
   484  ```bash
   485  # GoBGP
   486  $ gobgp global rib -a evpn
   487     Network                                                                      Labels     Next Hop             AS_PATH              Age        Attrs
   488  *> [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]]
   489  *> [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}]
   490  
   491  # BaGPipe peer on "10.0.0.2"
   492  $ bagpipe-looking-glass bgp routes
   493  l2vpn/evpn,*:
   494    * evpn:macadv::10.0.0.1:118:-:0:00:11:22:33:44:55/48:11.11.11.1: label [ 100 ]:
   495        attributes:
   496          originator-id: 10.0.0.1
   497          cluster-list: [ 10.0.0.254 ]
   498          extended-community: [ target:65000:77 encap:VXLAN ]
   499        next_hop: 10.0.0.1
   500        afi-safi: l2vpn/evpn
   501        source: BGP-10.0.0.254 (...)
   502        route_targets:
   503          * target:65000:77
   504    * evpn:multicast::10.0.0.1:118:0:10.0.0.1:
   505        attributes:
   506          cluster-list: [ 10.0.0.254 ]
   507          originator-id: 10.0.0.1
   508          pmsi-tunnel: pmsi:ingressreplication:-:100:10.0.0.1
   509          extended-community: [ target:65000:77 encap:VXLAN ]
   510        next_hop: 10.0.0.1
   511        afi-safi: l2vpn/evpn
   512        source: BGP-10.0.0.254 (...)
   513        route_targets:
   514          * target:65000:77
   515  ipv4/mpls-vpn,*: -
   516  ipv4/rtc,*: -
   517  ipv4/flow-vpn,*: -
   518  ```
   519  
   520  ## YABGP
   521  
   522  Just like the example using BaGPipe, this example uses [YABGP](https://github.com/smartbgp/yabgp).
   523  GoBGP receives EVPN routes from one YABGP peer and re-advertises it to another YABGP peer.
   524  
   525  **NOTE:** The following supposes to use YABGP version "0.4.0".
   526  
   527  ### Configuration
   528  
   529  YABGP supports eBGP peering. The following example shows GoBGP and two YABGP peers are connected
   530  with eBGP and GoBGP interchanges EVPN routes from one YABGP peer to another.
   531  
   532  Topology:
   533  
   534  ```text
   535             +------------+
   536             | GoBGP      |
   537       +-----| AS 65254   |-----+
   538       |     | 10.0.0.254 |     |
   539       |     +------------+     |
   540       |                        |
   541     (eBGP)                  (eBGP)
   542       |                        |
   543  +----------+            +----------+
   544  | YABGP    |            | YABGP    |
   545  | AS 65001 |            | AS 65002 |
   546  | 10.0.0.1 |            | 10.0.0.2 |
   547  +----------+            +----------+
   548  ```
   549  
   550  GoBGP on "10.0.0.254": `gobgpd.toml`
   551  
   552  ```toml
   553  [global.config]
   554    as = 65254
   555    router-id = "10.0.0.254"
   556  
   557  [[neighbors]]
   558    [neighbors.config]
   559      neighbor-address = "10.0.0.1"
   560      peer-as = 65001
   561    [[neighbors.afi-safis]]
   562      [neighbors.afi-safis.config]
   563        afi-safi-name = "l2vpn-evpn"
   564  
   565  [[neighbors]]
   566    [neighbors.config]
   567      neighbor-address = "10.0.0.2"
   568      peer-as = 65002
   569    [[neighbors.afi-safis]]
   570      [neighbors.afi-safis.config]
   571        afi-safi-name = "l2vpn-evpn"
   572  ```
   573  
   574  You can start YABGP with the following CLI options:
   575  
   576  ```bash
   577  # YABGP peer on "10.0.0.1"
   578  $ 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
   579  
   580  # YABGP peer on "10.0.0.2"
   581  $ 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
   582  ```
   583  
   584  Then, you can see GoBGP can connect to two YABGP peers by using gobgp command:
   585  
   586  ``` bash
   587  # GoBGP
   588  $ gobgpd -f gobgpd.toml
   589  ...(snip)...
   590  
   591  $ gobgp neighbor
   592  Peer        AS  Up/Down State       |#Received  Accepted
   593  10.0.0.1 65001 hh:mm:ss Establ      |        0         0
   594  10.0.0.2 65002 hh:mm:ss Establ      |        0         0
   595  ```
   596  
   597  ### Advertising EVPN route
   598  
   599  We can advertise EVPN routes from YABGP 10.0.0.1 through its [REST
   600  API](http://yabgp.readthedocs.io/en/latest/restapi.html).
   601  In the REST request, you need to specify the `Authorization` header is `admin/admin`, and the
   602  `Content-Type` is `application/json`.
   603  
   604  Request URL for sending UPDATE messages:
   605  
   606  ```text
   607  POST http://10.0.0.1:8801/v1/peer/10.0.0.254/send/update
   608  ```
   609  
   610  We will run this API four times to advertise four EVPN route types.
   611  The following example use "curl" command for sending POST request.
   612  
   613  EVPN type 1:
   614  
   615  ```bash
   616  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 '{
   617      "attr": {
   618          "1": 0,
   619          "2": [],
   620          "5": 100,
   621          "14": {
   622              "afi_safi": [
   623                  25,
   624                  70
   625              ],
   626              "nexthop": "10.75.44.254",
   627              "nlri": [
   628                  {
   629                      "type": 1,
   630                      "value": {
   631                          "esi": 0,
   632                          "eth_tag_id": 100,
   633                          "label": [
   634                              10
   635                          ],
   636                          "rd": "1.1.1.1:32867"
   637                      }
   638                  }
   639              ]
   640          },
   641          "16": [
   642              "esi-label:0:500"
   643          ]
   644      }
   645  }'
   646  ```
   647  
   648  EVPN type 2:
   649  
   650  ```bash
   651  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 '{
   652      "attr": {
   653          "1": 0,
   654          "2": [],
   655          "5": 100,
   656          "14": {
   657              "afi_safi": [
   658                  25,
   659                  70
   660              ],
   661              "nexthop": "10.75.44.254",
   662              "nlri": [
   663                  {
   664                      "type": 2,
   665                      "value": {
   666                          "esi": 0,
   667                          "eth_tag_id": 108,
   668                          "ip": "11.11.11.1",
   669                          "label": [
   670                              0
   671                          ],
   672                          "mac": "00-11-22-33-44-55",
   673                          "rd": "172.17.0.3:2"
   674                      }
   675                  }
   676              ]
   677          },
   678          "16": [
   679              "mac-mobility:1:500"
   680          ]
   681      }
   682  }'
   683  ```
   684  
   685  EVPN type 3:
   686  
   687  ```bash
   688  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 '{
   689      "attr": {
   690          "1": 0,
   691          "2": [],
   692          "5": 100,
   693          "14": {
   694              "afi_safi": [
   695                  25,
   696                  70
   697              ],
   698              "nexthop": "10.75.44.254",
   699              "nlri": [
   700                  {
   701                      "type": 3,
   702                      "value": {
   703                          "eth_tag_id": 100,
   704                          "ip": "192.168.0.1",
   705                          "rd": "172.16.0.1:5904"
   706                      }
   707                  }
   708              ]
   709          }
   710      }
   711  }'
   712  ```
   713  
   714  EVPN type 4:
   715  
   716  ```bash
   717  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 '{
   718      "attr": {
   719          "1": 0,
   720          "2": [],
   721          "5": 100,
   722          "14": {
   723              "afi_safi": [
   724                  25,
   725                  70
   726              ],
   727              "nexthop": "10.75.44.254",
   728              "nlri": [
   729                  {
   730                      "type": 4,
   731                      "value": {
   732                          "esi": 0,
   733                          "ip": "192.168.0.1",
   734                          "rd": "172.16.0.1:8888"
   735                      }
   736                  }
   737              ]
   738          },
   739          "16": [
   740              "es-import:00-11-22-33-44-55"
   741          ]
   742      }
   743  }'
   744  ```
   745  
   746  GoBGP will receive these four routes and re-advertise them to YABGP peer on "10.0.0.2"
   747  
   748  ```bash
   749  # GoBGP
   750  $ gobgp global rib -a evpn
   751     Network                                                  Labels     Next Hop             AS_PATH              Age        Attrs
   752  *> [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}]
   753  *> [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}]
   754  *> [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]]
   755  *> [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}]
   756  ```
   757  
   758  Then, check statistics of neighbors for confirming the number of re-advertised routes.
   759  
   760  ```bash
   761  # GoBGP
   762  $ gobgp neighbor
   763  Peer        AS  Up/Down State       |#Received  Accepted
   764  10.0.0.1 65001 hh:mm:ss Establ      |        4         4
   765  10.0.0.2 65002 hh:mm:ss Establ      |        0         0
   766  
   767  $ gobgp neighbor 10.0.0.2
   768  BGP neighbor is 10.0.0.2, remote AS 65002
   769    BGP version 4, remote router ID 10.0.0.2
   770    BGP state = established, up for hh:mm:ss
   771    BGP OutQ = 0, Flops = 0
   772    Hold time is 90, keepalive interval is 30 seconds
   773    Configured hold time is 90, keepalive interval is 30 seconds
   774  
   775    Neighbor capabilities:
   776      multiprotocol:
   777          l2vpn-evpn:	advertised and received
   778      route-refresh:	advertised and received
   779      4-octet-as:	advertised and received
   780      enhanced-route-refresh:	received
   781      cisco-route-refresh:	received
   782    Message statistics:
   783                           Sent       Rcvd
   784      Opens:                  2          2
   785      Notifications:          0          0
   786      Updates:                4          0
   787      Keepalives:             2          2
   788      Route Refresh:          0          0
   789      Discarded:              0          0
   790      Total:                  8          4
   791    Route statistics:
   792      Advertised:             4
   793      Received:               0
   794      Accepted:               0
   795  ```