Skip to content

Examples

These are some example configurations for ExaBGP + ExaCheck. The health check configuration examples are taken from the relevant health check configuration page.

ExaBGP Configuration

ExaBGP needs to be configured to execute ExaCheck. By default the ExaBGP configuration is located in /etc/exabgp/exabgp.conf.

Warning

ExaBGP must be configured with the environment variable exabgp.api.ack set to false. If deploying using the Docker container this is already handled for you. A future release of ExaCheck will resolve this.

These configurations can be used as a template:

A simple configuration for a single neighbor:

# Define the ExaCheck process
process exacheck {
    run exacheck run;
    encoder text;
}

# Connect to the BGP neighbor 192.0.2.1
neighbor 192.0.2.1 {
    description "Example BGP neighbor";

    # This should be set to the ExaBGP router ID (eg. the main IP address of this server)
    router-id 192.0.2.10;

    # The local address to source BGP connections from
    local-address 192.0.2.10;

    # The local and peer AS numbers
    local-as 65515;
    peer-as 65515;

    # The address family to advertise
    family {
        ipv4 unicast;
    }

    # Allow routes sent from the ExaCheck process to be sent to this neighbor
    api {
        processes [ exacheck ];
    }
}

A configuration file for multiple neighbors:

# Define the ExaCheck process
process exacheck {
    run exacheck run;
    encoder text;
}

# Define a template to apply common configuration to neighbors
template common {
    # This should be set to the ExaBGP router ID (eg. the main IP address of this server)
    router-id 192.0.2.10;

    # The local address to source BGP connections from
    local-address 192.0.2.10;

    # The local and peer AS numbers
    local-as 65515;
    peer-as 65515;

    # The address family to advertise
    family {
        ipv4 unicast;
    }

    # Allow routes sent from the ExaCheck process to be sent to these neighbors
    api {
        processes [ exacheck ];
    }
}

# Connect to the BGP neighbor 192.0.2.1
neighbor 192.0.2.1 {
    description "Example BGP neighbor";
    inherit common;
}

# Connect to the BGP neighbor 192.0.2.2
neighbor 192.0.2.2 {
    description "Example BGP neighbor";
    inherit common;
}

This configuration can be used for advertising routes to both IPv4 and IPv6 neighbors:

# Define the ExaCheck process
process exacheck {
    run exacheck run;
    encoder text;
}

# Define a template to apply common configuration to IPv4 neighbors
template common-ipv4 {
    # This should be set to the ExaBGP router ID (eg. the main IP address of this server)
    router-id 192.0.2.10;

    # The local address to source BGP connections from
    local-address 192.0.2.10;

    # The local and peer AS numbers
    local-as 65515;
    peer-as 65515;

    # The address family to advertise
    family {
        ipv4 unicast;
    }

    # Allow routes sent from the ExaCheck process to be sent to these neighbors
    api {
        processes [ exacheck ];
    }
}

# Define a template to apply common configuration to IPv6 neighbors
template common-ipv6 {
    # This should be set to the ExaBGP router ID (eg. the main IP address of this server)
    router-id 192.0.2.10;

    # The local address to source BGP connections from
    local-address 2001:db8::a;

    # The local and peer AS numbers
    local-as 65515;
    peer-as 65515;

    # The address family to advertise
    family {
        ipv6 unicast;
    }

    # Allow routes sent from the ExaCheck process to be sent to these neighbors
    api {
        processes [ exacheck ];
    }
}

# Connect to the BGP neighbor 192.0.2.1
neighbor 192.0.2.1 {
    description "Example IPv4 BGP neighbor";
    inherit common-ipv4;
}

# Connect to the BGP neighbor 2001:db8::1
neighbor 2001:db8::1 {
    description "Example IPv6 BGP neighbor";
    inherit common-ipv6;
}

ExaCheck Configuration

These are some example ExaCheck configuration files with various features used. By default the configuration file is located at /etc/exabgp/exacheck.yaml.

A basic HTTP health check configuration; logging is only to STDOUT:

---

# The list of health checks to perform
checks:

  - name: Example Basic HTTP Check
    description: Perform a HTTP request to the web server and verify a successful response code is received
    args:
      method: http
      host: 127.0.0.1
      url: https://example.com
    prefixes:
      - 192.0.2.255
    nexthop: self

Multiple health checks configured with notifications to Microsoft Teams and file logging:

---

# Configure logging
logging:

  # Basic file logger
  - method: file
    destination: /tmp/exacheck.log

# Configure notifications
notifications:

  - name: Microsoft Teams Example
    description: This target will only receive route withdraw/announce events.
    url: msteams://organisation/TokenA/TokenB/TokenC/

# The list of health checks to perform
checks:

  - name: Example Basic HTTP Check
    description: Perform a HTTP request to the web server and verify a successful response code is received
    args:
      method: http
      host: 127.0.0.1
      url: https://example.com
    prefixes:
      - 192.0.2.255
    nexthop: self

  - name: Example NTP Stratum Check
    description: Ensure that the IP 2001:db8::123 responds to NTP queries and the server is at least stratum 2
    args:
      method: ntp
      host: 2001:db8::123
      max_stratum: 2
    prefixes:
      - 2001:db8:aaaa::ffff/128
      - 2001:db8:aaaa::123/128
    nexthop: self

  - name: Example DNS CNAME Test
    description: Perform a CNAME query for www.example.com to 192.0.2.1 and verify the CNAME target contains the word "example"
    args:
      method: dns
      host: 192.0.2.1
      query: www.example.com
      type: cname
      pattern: example
    prefixes:
      - 192.0.2.253
    nexthop: self