Files
ferrix/bin/bgp
Rayhaan JaufeerallyandClaude Fable 5.1 cc022c3b7b feature: restyle statusz after the classic Google status pages
Modelled on Vitess's servenv status page and golang.org/x/net/trace, both
written by Google engineers to mirror the internal pages: plain sans-serif
HTML, default links and native form controls, dense bordered tables, and a
full-width centred light blue (#eef) heading bar per section. Header shows
"Status for ferrix_bgp" with start time, uptime, version, router ID and AS
on the left and host, "View:" links and live-update state on the right.
The dark theme is dropped on purpose.

Behaviour is unchanged (live updates, owner-gated withdraw, per-session
UPDATE bytes, looped-route highlight, peers polling). Additions:
- a SwissIX large-community picker next to the field; presets with a peer
  AS ask for the number
- event log lines include prepend and MED
- /api/status gains hostname and started_at_unix (RouterInfo::new)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-19 17:06:00 +02:00
..

BGP

This crate provides the bgp binary which runs the Border Gateway Protocol daemon together with its HTTP API.

cargo run -- path/to/config.textpb

The configuration format is defined in crates/server/proto/config.proto; testdata/server.textpb is a worked example. When http_endpoint is set the binary also serves:

Path Purpose
GET /statusz Status page: peers, announce form, local and received routes, live event log
GET /api/status Router ID, ASN, uptime and table sizes
GET /api/peers Established sessions
GET /api/routes/local Locally originated routes
POST /api/routes/local Announce a route (JSON body, see below)
DELETE /api/routes/local Withdraw a route (JSON body: prefix, optional owner)
GET /api/routes/local/wire?prefix=… The exact UPDATE bytes sent to each peer
GET /api/routes/received Adj-RIB-In contents
GET /api/communities/well-known Names accepted in place of numeric communities
GET /api/events Server-sent events for session and route changes
GET /metricz Prometheus metrics

Announce body:

{
  "prefix": "10.100.1.0/24",
  "owner": "alice",
  "origin": "IGP",
  "prepend": 2,
  "med": 100,
  "communities": ["65000:100", "NO_EXPORT"],
  "large_communities": ["65000:1:2"]
}

Only prefix and owner are required. Routes are subject to the local_route_policy in the configuration.

Trying it without a router

fake_peer is a minimal BGP speaker that connects to the daemon, announces a prefix, prints every UPDATE it receives and, with --echo, re-announces each received prefix back with its own ASN prepended (dropping NO_EXPORT routes). That makes locally announced prefixes show up in the received table as if they had travelled through a neighbouring AS:

cargo run -- testdata/server.textpb
cargo run -p bgp-integration-tests --example fake_peer -- \
    --server 127.0.0.1:179 --asn 65001 --announce 203.0.113.0/24 --echo

Please refer to the other implementation crates in this repository where most of the actual implementation lives.

Warning: This is still very much a work in progress and is not yet ready for production use.