Speeding up bgpq4 with IRRd in a container

Vincent Bernat

When build­ing route fil­ters with bgpq4 or bgpq3, the speed of rr.​ntt.​net or whois.​radb.​net can be a bot­tle­neck. Up­dat­ing many fil­ters may take sev­eral tens of min­utes, de­pend­ing on the load:

$ time bgpq4 -h whois.radb.net AS-HURRICANE | wc -l
909869
1.96s user 0.15s system 2% cpu 1:17.64 total
$ time bgpq4 -h rr.ntt.net AS-HURRICANE | wc -l
927865
1.86s user 0.08s system 12% cpu 14.098 total

A pos­si­ble so­lu­tion is to run your own IRRd in­stance in your net­work, mir­ror­ing the main rout­ing reg­istries. A close al­ter­na­tive is to bun­dle IRRd with all the data in a ready-to-use Docker im­age. This also has the ad­van­tage of easy in­te­gra­tion into a Docker-based CI/CD pipeline.

$ git clone https://github.com/jerikan-network/irrd-legacy.git -b blade/master
$ cd irrd-legacy
$ docker build . -t irrd-snapshot:latest
[…]
Successfully built 58c3e83a1d18
Successfully tagged irrd-snapshot:latest
$ docker container run --rm --detach --publish=43:43 irrd-snapshot
4879cfe7413075a0c217089dcac91ed356424c6b88808d8fcb01dc00eafcc8c7
$ time bgpq4 -h localhost AS-HURRICANE | wc -l
904137
1.72s user 0.11s system 96% cpu 1.881 total

The Dock­er­file con­tains three stages:

  1. build­ing IRRd,1
  2. re­triev­ing var­i­ous IRR data­bases, and
  3. as­sem­bling the fi­nal con­tainer with the re­sult of the two pre­vi­ous stages.

The sec­ond stage fetches the data­bases used by rr.​ntt.​net: NTTCOM, RADB, RIPE, ALTDB, BELL, LEVEL3, RGNET, APNIC, JPIRR, ARIN, BBOI, TC, AFRINIC, ARIN-WHOIS, and REGISTROBR. How­ever, it misses RPKI.2 Feel free to adapt!

The im­age can be sched­uled to be re­built daily or weekly, de­pend­ing on your needs. The repos­i­tory in­cludes a .gitlab-ci.​yaml file au­tomat­ing the build and trig­ger­ing the com­pi­la­tion of all fil­ters by your CI/CD upon success.

Up­date (2021-05)

You can also fetch a pre­built im­age with docker pull ghcr.​io/​jerikan-network/​irrd-legacy:​latest. It is up­dated once a week and built with GitHub CI.

Up­date (2026-03)

Some sources are now un­avail­able and the im­age is no longer updated.