Dumping BGP MRT in Cumulus Linux

2 minute read Published: 2026-03-13

Motivation

I wanted to import some real routes from a PE router (for an Nvidia AIR simulation) and this seemed like the easiest way about it. I heard about MRT before, so I searched Cumulus documentation to see if there was an NVUE command for this, but it seems like there is not (as of version 5.16). Cumulus allows you to just use the vtysh shell so I did that.

Procedure

This outlines steps to use a Cumulus router for gathering a BGP table and then using the BGP table in further Cumulus configuration.

Extracting an MRT file from FRR

I initially used the vtysh method because I couldn't find how to do this using NVUE CLI. Turns out, there is a way to do it using "snippets".

Correct method

An example snippet that dumps the MRT looks like this:

- set:
    system:
      config:
        snippet:
          frr.conf: |
            dump bgp routes-mrt /tmp/routes-mrt

You'll then use this as a file in the CLI:

nv config patch snippet.yaml
nv config apply

(most likely) Incorrect method

USE THE METHOD ABOVE This does require entering configure mode in FRR, but AFAIK it doesn't make any changes in routing behavior (nor should it).

fbartik@cumulus:mgmt:~$ sudo vtysh
cumulus# configure
cumulus(config)# dump bgp routes-mrt /tmp/routes-mrt 

The dump command requires a path, which needs to be somewhere FRR can write into (so either /tmp or /etc/frr). Optionally you can specify an interval (after the path argument, using strftime format) for continuous creation of the BGP table output.

Parsing the MRT file

The first tool that comes up in search is RIPENCC/bgpdump (however the version in nixpkgs was not built for aarch64-darwin at the time).

I ran into bgpkit/monocle as well, so I used that.

Example usage

monocle parse ./routes-mrt # Prints all routes
monocle parse -j <peer_IP> ./routes-mrt # Prints routes from a chosen peer
monocle parse -o 13335 ./routes-mrt # Prints routes from a chosen origin ASN
monocle parse -C "13335:*" ./routes-mrt # Prints routes containing BGP communities starting with 13335

Useful flags

  • --format=json will print the data in JSON, as the default is a pipe (|) separated table.

Creating an NVUE configuration from MRT file

This command will print routes from peer 192.0.2.1 and then turn them into an nv command that will add the routes as static in the routing table of VRF TEST.

monocle parse -j 192.0.2.1 routes-mrt --format json | jq --raw-output '"nv set vrf TEST router static \(.prefix) via blackhole"'

--raw-output is used because jq prints results with double quotes by default, which is not recognized as a command in Cumulus.