Skip to content

Instantly share code, notes, and snippets.

@tonusoo
Created February 10, 2025 16:17
Show Gist options
  • Save tonusoo/04eabf1e5392a0b98d06e4cf2e44f57e to your computer and use it in GitHub Desktop.
Save tonusoo/04eabf1e5392a0b98d06e4cf2e44f57e to your computer and use it in GitHub Desktop.
injecting MRT data into BIRD || discussion on Packet Pushers Slack group

BGP full feed in lab environment with gobgpd and BIRD

Prefixes are injected with patched gobgp. Systemd service template for gobgpd processes:

martin@bgp-feed:~$ cat /etc/systemd/system/[email protected]
[Unit]
Description=GoBGP Routing Daemon - instance %i
After=network.target syslog.service
ConditionPathExists=/usr/local/etc/gobgpd-%i.conf

[Service]
Type=notify
ExecStartPre=/usr/local/sbin/gobgpd --api-hosts=127.0.0.1:505%i --config-file=/usr/local/etc/gobgpd-%i.conf --dry-run
ExecStart=/usr/local/sbin/gobgpd --api-hosts=127.0.0.1:505%i --config-file=/usr/local/etc/gobgpd-%i.conf --sdnotify --disable-stdlog --syslog yes $GOBGPD_OPTIONS
ExecReload=/usr/local/sbin/gobgpd --api-hosts=127.0.0.1:505%i --graceful-restart
DynamicUser=yes
AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target
martin@bgp-feed:~$

gobgpd configuration file example:

martin@bgp-feed:~$ cat /usr/local/etc/gobgpd-1.conf
[global.config]
  as = 6667
  router-id = "127.0.0.55"
  port = 8055

[[neighbors]]
  [neighbors.config]
    neighbor-address = "127.0.0.1"
    peer-as = 6667
  [neighbors.transport.config]
    passive-mode = true
    local-address = "127.0.0.1"
    remote-port = 8010

[[neighbors]]
  [neighbors.config]
    neighbor-address = "::1"
    peer-as = 6667
  [neighbors.transport.config]
    passive-mode = true
    local-address = "::1"
    remote-port = 8010
martin@bgp-feed:~$

iBGP and eBGP configuration snippets from BIRD's conf file:

protocol bgp elisa_ibgp_v6 {

    neighbor ::1 port 8055 as 6667 internal;
    local ::1 port 8010 as 6667;

    allow local as;

    ipv6 {
        table elisa_rib_v6;
        import all;
        export none;
    };
};


protocol bgp gtt_ibgp_v4 {

    neighbor 127.0.0.1 port 8065 as 3257 internal;
    local 127.0.0.1 port 8010 as 3257;

    allow local as;

    ipv4 {
        table gtt_rib_v4;
        import all;
        export none;
    };
};


protocol bgp elisa_ebgp_v4 {

    description "Elisa v4";
    router id 192.175.45.10;

    local 95.129.199.8 as 2586;
    neighbor 95.129.199.9 as acme_asn;

    # Ensures that own AS number is not inserted to the AS path,
    # MED attribute is kept.
    rs client;

    ipv4 {
        table elisa_rib_v4;
        import where bgp_in(2586);
        export filter {
            bgp_path.delete(bgp_path.first);
            bgp_path.prepend(2586);
            accept;
        };
    };
};


protocol bgp gtt_ebgp_v6 {

    description "GTT v6";
    router id 213.200.87.225;

    local 2001:668:0:3:ffff:1:0:2a as 3257;
    neighbor 2001:668:0:3:ffff:1:0:2b as acme_asn;

    rs client;

    ipv6 {
        table gtt_rib_v6;
        import where bgp_in(3257);
        export all;
    };
};
@tonusoo
Copy link
Author

tonusoo commented Feb 10, 2025

gobgpd and BIRD setup:
gobgpd_and_bird_setup

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