Skip to content

Instantly share code, notes, and snippets.

@higebu
Last active April 26, 2024 17:41
Show Gist options
  • Save higebu/07ea796a32cdd5fc83e9357cfb4df87c to your computer and use it in GitHub Desktop.
Save higebu/07ea796a32cdd5fc83e9357cfb4df87c to your computer and use it in GitHub Desktop.
FRR BGP-MUP Development

References

FRR

SRv6 MUP

Build and Install

./bootstrap.sh
./configure \
    --prefix=/usr \
    --localstatedir=/var/run/frr \
    --sbindir=/usr/lib/frr \
    --sysconfdir=/etc/frr \
    --enable-vtysh \
    --enable-pimd \
    --enable-sharpd \
    --enable-multipath=64 \
    --enable-user=frr \
    --enable-group=frr \
    --enable-vty-group=frrvty \
    --with-pkg-extra-version=-bgp-mup
make && make install

Running FRR and GoBGP in netns

https://docs.frrouting.org/en/latest/setup.html#network-namespaces

Setup netns

  • red: for GoBGP as origin
  • blue: for FRR
  • green: for GoBGP as rr client
#!/bin/bash

sudo ip link add br0 type bridge

sudo ip link add veth0 type veth peer name veth0-host
sudo ip link add veth1 type veth peer name veth1-host
sudo ip link add veth2 type veth peer name veth2-host

sudo ip link set dev veth0-host master br0
sudo ip link set dev veth1-host master br0
sudo ip link set dev veth2-host master br0

sudo ip link set up dev veth0-host
sudo ip link set up dev veth1-host
sudo ip link set up dev veth2-host
sudo ip link set up dev br0

sudo ip netns add red
sudo ip link set veth0 netns red
sudo ip netns exec red ip link set up lo
sudo ip netns exec red ip link set up veth0
sudo ip netns exec red ip addr add 10.0.0.1/24 dev veth0
sudo ip netns exec red ip addr add 2001:db8::1/64 dev veth0

sudo ip netns add blue
sudo ip link set veth1 netns blue
sudo ip netns exec blue ip link set up lo
sudo ip netns exec blue ip link set up veth1
sudo ip netns exec blue ip addr add 10.0.0.2/24 dev veth1
sudo ip netns exec blue ip addr add 2001:db8::2/64 dev veth1

sudo ip netns add green
sudo ip link set veth2 netns green
sudo ip netns exec green ip link set up lo
sudo ip netns exec green ip link set up veth2
sudo ip netns exec green ip addr add 10.0.0.3/24 dev veth2
sudo ip netns exec green ip addr add 2001:db8::3/64 dev veth2

Setup FRR

/etc/frr/frr.conf

frr version 8.5-dev-bgp-mup
frr defaults traditional
hostname frr-dev-bgp-mup
log stdout
service integrated-vtysh-config

/etc/frr/daemons

bgpd=no
ospfd=no
ospf6d=no
ripd=no
ripngd=no
isisd=no
pimd=no
ldpd=no
nhrpd=no
eigrpd=no
babeld=no
sharpd=no
pbrd=no
bfdd=no
fabricd=no
vrrpd=no

vtysh_enable=yes
zebra_options="  -A 127.0.0.1 -s 90000000"
bgpd_options="   -A 127.0.0.1"
ospfd_options="  -A 127.0.0.1"
ospf6d_options=" -A ::1"
ripd_options="   -A 127.0.0.1"
ripngd_options=" -A ::1"
isisd_options="  -A 127.0.0.1"
pimd_options="   -A 127.0.0.1"
ldpd_options="   -A 127.0.0.1"
nhrpd_options="  -A 127.0.0.1"
eigrpd_options=" -A 127.0.0.1"
babeld_options=" -A 127.0.0.1"
sharpd_options=" -A 127.0.0.1"
pbrd_options="   -A 127.0.0.1"
staticd_options="-A 127.0.0.1"
bfdd_options="   -A 127.0.0.1"
fabricd_options="-A 127.0.0.1"
vrrpd_options="  -A 127.0.0.1"

/etc/frr/blue/daemons

bgpd=yes
ospfd=no
ospf6d=no
ripd=no
ripngd=no
isisd=no
pimd=no
ldpd=no
nhrpd=no
eigrpd=no
babeld=no
sharpd=no
pbrd=no
bfdd=no
fabricd=no
vrrpd=no

vtysh_enable=yes
zebra_options="  -A 127.0.0.1 -s 90000000"
bgpd_options="   -A 127.0.0.1 -l 10.0.0.2"
ospfd_options="  -A 127.0.0.1"
ospf6d_options=" -A ::1"
ripd_options="   -A 127.0.0.1"
ripngd_options=" -A ::1"
isisd_options="  -A 127.0.0.1"
pimd_options="   -A 127.0.0.1"
ldpd_options="   -A 127.0.0.1"
nhrpd_options="  -A 127.0.0.1"
eigrpd_options=" -A 127.0.0.1"
babeld_options=" -A 127.0.0.1"
sharpd_options=" -A 127.0.0.1"
pbrd_options="   -A 127.0.0.1"
staticd_options="-A 127.0.0.1"
bfdd_options="   -A 127.0.0.1"
fabricd_options="-A 127.0.0.1"
vrrpd_options="  -A 127.0.0.1"

watchfrr_options=" --netns=blue"

/etc/frr/blue/frr.conf

!
frr version 8.5-dev-bgp-mup
frr defaults traditional
hostname xxxxx
log file /var/log/frr/bgpd.log
log stdout
service integrated-vtysh-config
!
debug zebra events
debug bgp neighbor-events
debug bgp updates in
debug bgp updates out
!
router bgp 65000
 bgp router-id 10.0.0.2
 neighbor 10.0.0.1 remote-as 65000
 !
 address-family ipv4 mup
  neighbor 10.0.0.1 activate
 exit-address-family
 !
 address-family ipv6 mup
  neighbor 10.0.0.1 activate
 exit-address-family
exit
!
end

start & stop

sudo /usr/lib/frr/frrinit.sh start blue
sudo /usr/lib/frr/frrinit.sh stop blue

Setup GoBGP

gobgp_red.toml

[global.config]
    as = 65000
    router-id = "10.0.0.1"
    local-address-list = ["10.0.0.1"]

[[neighbors]]
    [neighbors.config]
        peer-as = 65000
        local-as = 65000
        neighbor-address = "10.0.0.2"
    [[neighbors.afi-safis]]
        [neighbors.afi-safis.config]
            afi-safi-name = "ipv4-mup"
        [neighbors.afi-safis.prefix-limit.config]
            max-prefixes = 1000
    [[neighbors.afi-safis]]
        [neighbors.afi-safis.config]
            afi-safi-name = "ipv6-mup"

start

sudo ip netns exec red gobgpd -f ./gobgp_red.toml -l debug
@leojojo
Copy link

leojojo commented Jul 22, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment