Nerd blog.

14 Oct 2022

exabgp 4.x, anycast, and healthchecks

This is a fifth in a blog series about DNS, specifically to address changes in exabgp 4.x, and how its built in healthcheck works.

Getting Started

I guess the easiest way to begin is to lay out a sample config.

This is going to have advertised from Extrapolate this out sideways to meet your needs.


This config sets up a healthcheck on, and advertises it with the next-hop of It checks every 5 seconds, and when states are changing it changes that to checking every 1 second. We need 5 checks to succeed to consider up, and 2 to fail to consider down. The reason I’m specififying the next-hop is because this is a IPv4/IPv6 multi address-family BGP session (which makes IPv6 next-hops just work better). We’re also specifying withdraw-on-down which pulls the IP from BGP vs lowering metric.

name = dns-lb-1
ip =
next-hop =
command = dig @ a +short
disable = /etc/exabgp/healthcheck_dns-lb-1.disable
interval = 5
fast-interval = 1
rise = 5
fall = 2

Additional Options

python3 -m exabgp healthcheck --help

Running this shows all of the additional options. Production use will likely need use of up-metric and perhaps community or large-community.

These options can be specified in the configuration file or on the CLI (IE: --up-metric or --community). We’re using the config here.


process dns-lb-1 {
  run python3 -m exabgp healthcheck --config /etc/exabgp/dns-lb-1;
  encoder text;

neighbor 2001:db8::1 {
  description "Will announce anycasted DNS service routes";

  local-address 2001:db8::135;
  local-as 65053;
  peer-as 65000;
  hold-time 30;

 family {
    ipv4 unicast;
    ipv6 unicast;
  api services {
#    processes [ dns-lb-1, dns-lb-2, dns-lb-3, dns-lb-4 ];
    processes [ dns-lb-1 ];

Disabling BGP advertisements is as simple as touching the file listed in the disable option. This can be handy before reboots to take down BGP gracefully and fail over to other servers gracefully. Routes are pulled almost immediately.

Theodore Baschak - Theo is a network engineer with experience operating core internet technologies like HTTP, HTTPS and DNS. He has extensive experience running service provider networks with OSPF, MPLS, and BGP.