Sending BGP routes using ExaBGP

Sending BGP routes using ExaBGP

Hey all,

Recently i came across a problem statement where i wanted to send some good amount of routes via BGP.

While hunting, i came across ExaBGP.

ExaBGP is an open-source software project designed to enable the integration of BGP (Border Gateway Protocol) into various applications and systems.

so, in this post i will try to explain how i am using it.

Topology

If you have gone through my last post on segment routing with Arista, i used a 3 router topology, here i integrated ExaBGP container in the same topology. ExaBGP is spawned in container-lab as an container.

ExaBGP(eth1)---(eth5) R1----R2-----R3
        

ExaBGP has a docker container format, which u can pull from docker registry, but for me when i was trying to integrate with container-lab it was not working, hence i looked how i can make a container myself which can be used in container-lab.

ExaBGP container :

Create folder named exa-image.

create a file named Dockerfile inside it,with below content

run the docker build command to create the docker image.

dshaw@dshaw-pc:~/exa-image$ ls -lrt
total 4
-rw-rw-r-- 1 dshaw dshaw 203 Feb 14 18:15 Dockerfile
dshaw@dshaw-pc:~/exa-image$ cat Dockerfile 
FROM ubuntu:20.04

# Install dependencies
RUN apt update
RUN apt install python3-pip net-tools wget mrtparse vim nano -y && \
    rm -rf /var/lib/apt/lists/* && apt clean
RUN pip install exabgp==4.2.17
        

verify the docker image here.

dshaw@dshaw-pc:~/exa-image$ docker images | grep exa

exa_new   latest   1b3aec26feef   4 weeks ago     486MB         

Container-lab topology :

dshaw@dshaw-pc:~/arsta-seg$ cat topo.yaml 
name: arsta-seg
topology:
  nodes:
    R1:
      kind: ceos
      image: ceos:4.31.2F
    R2:
      kind: ceos
      image: ceos:4.31.2F
    R3:
      kind: ceos
      image: ceos:4.31.2F
    exa1:      
      kind: linux
      image: exa_new:latest
      binds:
        - exa1:/home
  links:
          - endpoints: ["R1:eth1", "R2:eth1"]
          - endpoints: ["R2:eth2", "R3:eth2"]
          - endpoints: ["R1:eth3", "R3:eth3"]
          - endpoints: ["R1:eth5", "exa1:eth1"]        

the bind command here is basically mounting the content of exa1 folder into the docker, in /home directory. Below are the content of the Exa1 directory.

dshaw@dshaw-pc:~/arsta-seg/exa1$ ls -lrt
-rwxrwxr-x 1 dshaw dshaw  46 Feb 14 23:19 deploy.sh
-rw-rw-r-- 1 dshaw dshaw 370 Feb 15 00:06 ebgp-code.conf
-rw-rw-r-- 1 dshaw dshaw 220 Feb 15 00:10 route_gen.py
        

File1: deploy.sh

its optional, i am using it to configure the interface connected to R1. You can simply run the ifconfig command within the ExaBGP container after spinning up the topology

dshaw@dshaw-pc:~/arsta-seg/exa1$ cat deploy.sh 
ifconfig eth1 191.0.0.2 netmask 255.255.255.0
        

File2 : route_gen.py

its a python program that basically controls route generation, you can change the program to generate more routes. I used range 1 to 20, which will generate 19 routes. 10.0.0.1,10.0.0.2 .... like this.

dshaw@dshaw-pc:~/arsta-seg/exa1$ cat route_gen.py 
#!/usr/bin/env python

import sys
import time

for item in range(1,20):
    sys.stdout.write(f'announce route 10.0.0.{item}/32 next-hop 191.0.0.2\n')
    sys.stdout.flush()
    time.sleep(.01)

while True:
	time.sleep(1)
        

File3 : ebgp-code.conf

This file defines the BGP part, and calls the above python program for route generation.

dshaw@dshaw-pc:~/arsta-seg/exa1$ cat ebgp-code.conf 
process gen_routes {
	run ./usr/bin/python3 /home/route_gen.py;
	encoder text;
}

template {
        neighbor leaf1 {
                local-as 101;
                peer-as 100;
                router-id 191.0.0.2;
                local-address 191.0.0.2;
		api {
			processes [ gen_routes ];
		}
                }
        }

neighbor 191.0.0.1 {
        inherit leaf1;
}        

R1 configuration :

here on R1, i am configuring eth5 looking towards ExaBGP container & the required BGP config. I have some left over config from my last lab, hence marked the required ExaBGP things with --->> ExaBGP<<--- marker.

R1#show run int eth5
interface Ethernet5 --->> ExaBGP<<---
   no switchport --->> ExaBGP<<---
   ip address 191.0.0.1/24 --->> ExaBGP<<---
R1#show run sec bgp
router bgp 100
   router-id 1.1.1.1
   neighbor R3 peer group
   neighbor R3 remote-as 100
   neighbor R3 next-hop-self
   neighbor R3 update-source Loopback0
   neighbor exa peer group --->> ExaBGP<<---
   neighbor exa remote-as 101 --->> ExaBGP<<---
   neighbor v6 peer group
   neighbor v6 remote-as 100
   neighbor v6 update-source Loopback0
   neighbor 3.3.3.3 peer group R3
   neighbor 191.0.0.2 peer group exa --->> ExaBGP<<---
   neighbor 9000::3 peer group v6
   !
   address-family ipv4
      neighbor 3.3.3.3 activate
      neighbor 191.0.0.2 activate --->> ExaBGP<<---
      network 5.10.0.0/24
   !
   address-family ipv6
      neighbor 9000::3 activate
      network 5001::/64
        

Starting ExaBGP program:

command1 is to go into the docker container.

command2 and 3 are showing whats mounted.

Command4 starts ExaBGP program.

dshaw@dshaw-pc:~/arsta-seg/exa1$ docker exec -it clab-arsta-seg-exa1 bash
root@exa1:/# cd home/
root@exa1:/home# ls -lrt
-rwxrwxr-x 1 1000 1000  46 Feb 14 17:49 deploy.sh
-rw-rw-r-- 1 1000 1000 370 Feb 14 18:36 ebgp-code.conf
-rw-rw-r-- 1 1000 1000 220 Feb 14 18:40 route_gen.py
root@exa1:/home# exabgp ebgp-code.conf 

if things are fine, then BGP will come up.
18:37:25 | 60     | reactor       | connected to peer-1 with outgoing-10 191.0.0.2-191.0.0.1
        

Validation on R1

R1#show ip bgp summary 
BGP summary information for VRF default
Router identifier 1.1.1.1, local AS number 100
Neighbor Status Codes: m - Under maintenance
  Neighbor  V AS           MsgRcvd   MsgSent  InQ OutQ  Up/Down State   PfxRcd PfxAcc
  3.3.3.3   4 100              255       263    0    0 00:44:58 Estab   1      1
  191.0.0.2 4 101               45        53    0    0 00:41:34 Estab   19     19        
R1#show ip route bgp interface ethernet 5

 B E      10.0.0.1/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.2/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.3/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.4/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.5/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.6/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.7/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.8/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.9/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.10/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.11/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.12/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.13/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.14/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.15/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.16/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.17/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.18/32 [200/0]
           via 191.0.0.2, Ethernet5
 B E      10.0.0.19/32 [200/0]
           via 191.0.0.2, Ethernet5        

so we are receiving the routes from ExaBGP container.

lets go to R3, to see if we are receiving them

R3#show ip route 10.0.0.19/32
 B I      10.0.0.19/32 [200/0]
           via 1.1.1.1/32, IS-IS SR tunnel index 3
              via 1.23.1.2, Ethernet2, label 900041
        

Yes, i am receiving them on R3.

thanks for reading , hope it helps.

While trying to make the ExaBGP container, i faced some issue, but this blog from Julio helped a lot

https://juliopdx.com/2022/02/25/exabgp-in-the-lab/

https://github.com/Exa-Networks/exabgp


Rushikesh Jagdale

Solutions Architect at Cisco ? Innovator ? CCIE#49883 R&S/Enterprise & SP ? DevNet500 ? SDWAN ? ACI

11 个月

Additionally, you can use BIRD, which supports IPv6 as well as more features

Pavel Odintsov

On mission to deliver affordable DDoS protection

11 个月

Can recommended playing with GoBGP instead. Way more pleasant experience

要查看或添加评论,请登录

Dipankar Shaw的更多文章

  • SRv6 L3VPN with Flex-Algo

    SRv6 L3VPN with Flex-Algo

    In my last article i explained a best effort uDT6 service, that sets the foundation for srv6 services & tunnels. Now…

  • SRv6 Tunnel with uDT6 Service SID

    SRv6 Tunnel with uDT6 Service SID

    In this article, I will provide an explanation of SRv6 (Segment Routing over IPv6) and delve into the uDT6 service…

  • UDPPing : Ping-pong with Layer 4

    UDPPing : Ping-pong with Layer 4

    Introduction: Recently i was watching a NANOG Presentation, where they showcased PINGO Project, which is able to…

    2 条评论
  • Arista Segment Routing Config & show commands

    Arista Segment Routing Config & show commands

    Introduction : Will be keeping this post very very short, intention is to capture, how we can configure segment routing…

    2 条评论
  • EVPN VXLAN Inter subnet Routing using Asymmetric IRB model

    EVPN VXLAN Inter subnet Routing using Asymmetric IRB model

    Hello Guys, Frankly speaking, this topic is a complex one to understand if you dont work with evpn, VXLAN and IRB. I…

    1 条评论
  • BGP Unnumbered by Bard

    BGP Unnumbered by Bard

    Introduction BGP unnumbered is a feature that allows BGP to establish peering sessions without explicitly configuring…

    1 条评论
  • Ixia Open Traffic generator & DUT

    Ixia Open Traffic generator & DUT

    Hey, this will be a small post about using ixia open traffic generator, how it can generate some traffic so that…

  • Metallb Loadbalancer With BGP for k8s, Not Rock Music

    Metallb Loadbalancer With BGP for k8s, Not Rock Music

    Ok, 2023 is On. This article will be the 1st one of this year.

  • Default Route to Container lab

    Default Route to Container lab

    inuz Containers are awesome. They are lightweight, spins up too fast.

  • Route Target Constraint Intra-AS

    Route Target Constraint Intra-AS

    Problem Statement :- In MPLS VPN case, Each PE router needs to hold Routes for a particular VRF from all other PE's…

    8 条评论

社区洞察

其他会员也浏览了