Go to file
Annika Hannig 70eb549c3d
Merge pull request #53 from kotronis-te/netmask-support
Support for netmasks in route net queries
2024-01-17 11:07:37 +01:00
bird Allow disabling MemoryCache in Config per BIRD 2023-10-29 11:46:43 +01:00
develop added development env. docker-compose 2020-10-28 15:41:16 +01:00
docs formatting. 2019-07-18 12:20:55 +02:00
endpoints fixing small issue with netmask implementation 2023-12-21 18:04:53 +02:00
etc/birdwatcher adding route_net_mask endpoint 2023-12-21 18:08:51 +02:00
install Conclude de-ecixification 2019-02-20 17:27:02 +01:00
test relaxed regex for extracting the version, see #38 2022-06-07 10:55:30 +02:00
vendor/github.com removed old code 2019-12-23 15:53:46 +01:00
.gitignore added first test for ipv4 with bird 2.x 2018-01-18 09:21:32 +01:00
CHANGELOG updated changelog 2024-01-17 11:05:09 +01:00
Dockerfile updated running instructions 2019-12-23 17:17:43 +01:00
Gopkg.lock fixed vendoring 2019-02-22 14:06:37 +01:00
Gopkg.toml go dep 2018-01-15 19:04:38 +01:00
LICENSE Conclude de-ecixification 2019-02-20 17:27:02 +01:00
Makefile make static linux build 2023-04-21 14:04:21 +02:00
README.md Update README.md with new path to bird.ctl 2023-08-23 15:49:37 +02:00
VERSION added memory profiling 2023-04-21 14:37:37 +02:00
birdwatcher.go Support for netmasks in route net queries 2023-12-21 17:45:00 +02:00
config.go Expire cache entries to save memory 2019-02-18 17:46:32 +01:00
config_test.go Conclude de-ecixification 2019-02-20 17:27:02 +01:00
go.mod updated redis dependency 2020-10-28 15:41:44 +01:00
go.sum updated redis dependency 2020-10-28 15:41:44 +01:00
housekeeping.go Refactor housekeeping and memory cache 2019-02-20 11:17:13 +01:00
profiling.go added memory profiling 2023-04-21 14:37:37 +02:00

README.md

birdwatcher

birdwatcher is a small HTTP server meant to provide an API defined by Barry O'Donovan's birds-eye to the BIRD internet routing daemon.

Why

The INEX implementation of birdseye runs PHP, which is not always desirable (and performant) in a route server setting. By using Go, we are able to work with regular binaries, which means deployment and maintenance might be more convenient.

Our version also has a few more capabilities, as you will discover when looking at the modules section of the config.

Installation

You will need to have go installed to build the package. Please make sure your go version is >= 1.9.

Running go install github.com/alice-lg/birdwatcher@latest will give you a binary. You might need to cross-compile it for your bird-running service (GOARCH and GOOS are your friends).

We provide a Makefile for more advanced compilation/configuration. Running make linux will create a Linux executable (by default for amd64, but that is configurable by providing the ARCH argument to the Makefile).

2.0 Breaking Change

The BIRD configuration setup (single/multi table, pipe/table prefixes) is no longer configured in birdwatcher but directly in Alice-LG. Please have a look at the source section of the Alice-LG config example.

BIRD configuration

Birdwatcher parses the output of birdc[6] and expects (for now) the time format to be iso long. You need to configure

timeformat base         iso long;
timeformat log          iso long;
timeformat protocol     iso long;
timeformat route        iso long;

in your /etc/bird[6].conf for birdwatcher to work.

BIRD keep filtered routes

To also see filtered routes in configured BGP protocol instances, you need to make sure that you have enabled the import keep filtered on option for affected bgp protocols.

protocol bgp 'peerX' {
    ...
    import keep filtered on;
    ...
}

Now you should be able to do a show route filtered protocol peerX in BIRD.

If you use a multi table setup you are also using the pipe protocol the connect the tables. No special BIRD configuration is required to be able to query pipe filtered routes.

birdwatcher provides various endpoints (see "available modules" section) to query routes filtered in bgp protocol as well as pipe protocol instances.

For use with Alice-LG, make sure to set the appropriate BIRD config setup in your Alice-LG configuration.

BIRD tagging filtered routes

If you want to make use of the filtered route reasons in Alice-LG, you need to make sure that you are using BIRD 1.6.3 or up as you will need Large BGP Communities (http://largebgpcommunities.net/) support.

You need to add a Large BGP Community just before you filter a route, for example:

define yourASN = 12345
define yourFilteredNumber = 65666
define prefixTooLong = 1
define pathTooLong = 2

function importScrub() {
    ...
    if (net.len > 24) then {
        print "REJECTING: ",net.ip,"/",net.len," received from ",from,": Prefix is longer than 24: ",net.len,"!";
        bgp_large_community.add((YourASN,yourFilteredNumber,prefixTooLong));
        return false;
    }
    if (bgp_path.len > 64) then {
        print "REJECTING: ",net.ip,"/",net.len," received from ",from,": AS path length is ridiculously long: ",bgp_path.len,"!";
        bgp_large_community.add((yourASN,yourFilteredNumber,pathTooLong));
        return false;
    }
    ...
    return true;
}

function importFilter() {
    ...
    if !(importScrub()) then reject;
    ...
    accept;
}

Using Docker

You can run the birdwatcher for BIRD2 with docker:

docker pull alicelg/birdwatcher:latest

docker run -p 29184:29184 -v /run/bird/bird.ctl:/run/bird/bird.ctl -it --rm birdwatcher:latest

Or build your own image:

docker build . -t alicelg/birdwatcher:latest

Building an RPM

Building RPMs is supported through fpm. If you have fpm installed locally, you can run make rpm to create a RPM in the folder RPMS. If you have a remote build server with fpm installed, you can build and fetch an RPM with make remote_rpm BUILD_SERVER=<buildserver_url> (requires SSH access).

Deployment

If you want to deploy birdwatcher on a system that uses RPMs, you should be able to install it after following the instructions on building an RPM.

We do not currently support other deployment methods.

Configuration

An example config with sane defaults is provided in etc/birdwatcher/birdwatcher.conf. You should be able to use it out of the box. If you need to change it, it is well-commented and hopefully intuitive. If you do not know how to configure it, please consider opening an issue.

How

In the background birdwatcher runs the birdc[6] client, sends commands and parses the result. It also leverages simple caching techniques to help reduce the load on the BIRD service.

Who

Initially developed by Daniel and MC from Netnod in two days at the RIPE 73 IXP Tools Hackathon in Madrid, Spain.

Running BIRD and parsing the results was added by Veit Heller on behalf of ecix.

With major contributions from: Patrick Seeburger and Benedikt Rudolph on behalf of DE-CIX.