Speeding up bgpq4 with IRRd in a container
Vincent Bernat
When building route filters with bgpq4[1] or bgpq3[2], the speed of
rr.ntt.net or whois.radb.net can be a bottleneck. Updating many
filters may take several tens of minutes, depending 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 possible solution is to run your own IRRd[3] instance in your network, mirroring the main routing registries[4]. A close alternative is to bundle IRRd with all the data in a ready-to-use Docker image. This also has the advantage of easy integration 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 Dockerfile[5] contains three stages:
- building IRRd,1
- retrieving various IRR databases, and
- assembling the final container with the result of the two previous stages.
The second stage fetches the databases used by rr.ntt.net[6]:
NTTCOM, RADB, RIPE, ALTDB, BELL, LEVEL3, RGNET, APNIC, JPIRR, ARIN,
BBOI, TC, AFRINIC, ARIN-WHOIS, and REGISTROBR. However, it misses
RPKI.2 Feel free to adapt!
The image can be scheduled to be rebuilt daily or weekly, depending on
your needs. The repository includes a .gitlab-ci.yaml
file[7] automating the build and triggering the compilation
of all filters by your CI/CD upon success.
Update (2021-05)
You can also fetch a prebuilt image with docker pull
ghcr.io/jerikan-network/irrd-legacy:latest. It is updated once a week and
built with GitHub CI[8].
Update (2026-03)
Some sources are now unavailable and the image is no longer updated.
- https://github.com/bgp/bgpq4
- https://github.com/snar/bgpq3
- https://irrd.readthedocs.io/en/stable/
- https://irr.net/docs/list.html
- https://github.com/jerikan-network/irrd-legacy/blob/blade/master/Dockerfile
- https://www.gin.ntt.net/support-center/policies-procedures/routing-registry/
- https://github.com/jerikan-network/irrd-legacy/blob/blade/master/.gitlab-ci.yml
- https://github.com/jerikan-network/irrd-legacy/blob/blade/master/.github/workflows/build.yml