Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Wren operator handbook

Wren exchanges routes with adjacent routers and can install selected paths in the Linux forwarding table. Use this handbook to evaluate a peering change in a disposable lab, inspect what reached the kernel, and decide which protocols fit your deployment.

How the parts fit

flowchart LR
  peers[Adjacent routers] <-->|BGP, OSPF, IS-IS, RIP, Babel| wren[wren daemon]
  conf[wren.toml] -->|start, SIGHUP| wren
  wren -->|netlink| kernel[Linux routing tables]
  op[wren show, monitor] <-->|control socket| wren

Choose a task

TaskStart here
Validate a configuration without starting routingBuild Wren and check a file
Carry IPv4 prefixes without assigning IPv4 addresses to the peering linkRun the IPv6-only BGP lab
Add a neighbor while unaffected BGP sessions keep their routesReload and verify the change
Keep tenant routes in independent Linux tablesPlace a BGP instance in a VRF
Feed forwarding decisions to another processSubscribe to route changes

Which version?

The published handbook follows main. For a released binary, start with its release notes and use the examples from the matching tag. Coverage and release status distinguishes working scenarios from open requirements.

License

The routing core uses Apache-2.0. The daemon and the other crates use GPL-2.0-or-later. License files

Build and check Wren

Build the daemon

Install Git, a C linker, and stable Rust with Cargo. Use Linux for the kernel backend. All commands below run from the checkout root.

git clone https://github.com/Velstra/wren.git
cd wren
cargo build --locked -p wren-daemon --bin wren
export PATH="$PWD/target/debug:$PATH"
wren --version

The build produces target/debug/wren. To evaluate a release, check out its tag before building and use its copy of the example scripts.

Validate an example

wren check -c examples/wren.toml

Look for examples/wren.toml is valid, router ID 10.0.0.1 and two resolved static routes. An invalid file exits nonzero. This check reads the configuration without opening protocol sockets or changing routes.

Inspect a running instance

Use a fresh working directory and a dedicated socket. This complete configuration has only a static route. Keep terminal A open.

work=$(mktemp -d)
cd "$work"
cat >router.toml <<'TOML'
router-id = "192.0.2.10"
[[static]]
prefix = "198.51.100.0/24"
via = "192.0.2.1"
TOML
printf 'Lab directory: %s\n' "$PWD"
wren --config router.toml --backend memory --socket "$PWD/wren.sock"

In terminal B, add the checkout’s absolute target/debug path to PATH and enter the printed lab directory:

wren --socket "$PWD/wren.sock" show routes

Look for 198.51.100.0/24 with next hop 192.0.2.1 and protocol static. The memory backend keeps the forwarding decision in process. Stop the daemon with Ctrl-C.

Run a two-router lab

On Linux, install iproute2 and util-linux. The scripts use unprivileged user/network namespaces and create their own interfaces. Run these from the checkout root:

bash scripts/bgp-unnumbered-smoke.sh
bash scripts/bgp-hot-reload-smoke.sh

The first lab checks an IPv4 route with an IPv6 next hop in the actual kernel table. The second checks which sessions and routes survive adding and removing a peer.

Build a smaller binary

cargo build --release --locked -p wren-daemon --bin wren --no-default-features

Add features such as --features ospf,isis when those protocols are required. The daemon manifest lists the default set.

Logging

Set RUST_LOG=debug when starting the daemon to inspect protocol startup. The monitoring guide covers state queries, metrics, and reloads.

Configure routes and policy

Start with one file

Wren loads TOML from /etc/wren/wren.toml or the path supplied with --config. Use a unique 32-bit router ID. The ID is still written as an IPv4 address on a router with only IPv6 transport.

router-id = "192.0.2.10"
[[static]]
prefix = "198.51.100.0/24"
via = "192.0.2.1"

Save it as router.toml and check it:

wren check --config router.toml

The result reports one static route. A check validates the file only; verify reachability with a peer and a kernel route lookup.

Apply an explicit eBGP policy

This complete example permits a single peer prefix in and a single local prefix out. Both filters reject everything else.

flowchart LR
  peer[Peer 192.0.2.20<br/>AS 65002] -->|"import: from-peer<br/>203.0.113.0/24 only"| rib[Wren RIB]
  rib -->|"export: to-peer<br/>198.51.100.0/24 only"| peer
router-id = "192.0.2.10"

[[filter]]
name = "from-peer"
default = "reject"
[[filter.rule]]
prefix = ["203.0.113.0/24"]
action = "accept"

[[filter]]
name = "to-peer"
default = "reject"
[[filter.rule]]
prefix = ["198.51.100.0/24"]
action = "accept"

[bgp]
enabled = true
local-as = 65001
network = ["198.51.100.0/24"]
[[bgp.neighbor]]
address = "192.0.2.20"
remote-as = 65002
import = "from-peer"
export = "to-peer"

With default RFC 8212 policy, a session can be Established and exchange no usable routes in a direction with no attached policy. Verify the filters in a running lab.

Protocol configuration

Full schema and defaults · Worked configuration

Inspect routes and reload peers

Find the layer where a route disappears

QuestionCommandExpected evidence
Is my neighbor up?wren show bgp neighborsPeer AS and state Established
Did BGP learn the prefix?wren show bgp routesPrefix and BGP attributes
Did the router select it?wren show routesWinning route, protocol and next hop
Did Linux install it?ip -4 route show proto bgpKernel route on the expected interface, when using --backend kernel

For a nondefault control socket, specify its path before the subcommand, for example wren --socket /tmp/lab.sock show routes.

Add or remove a BGP peer on reload

Wren compares the new neighbor set with the running one. Use this procedure for adding or removing peers. A change to an existing peer’s policy, timers, or other settings requires separate validation.

sequenceDiagram
  participant Op as Operator
  participant W as wren
  participant P as BGP peers
  Op->>W: SIGHUP
  W->>W: parse and resolve (same as wren check)
  alt rejected
    W-->>Op: log error, keep running config
  else accepted
    W->>P: connect new peers
    W->>P: drop removed peers, withdraw their routes
    Note over W,P: unchanged peers keep session and routes
  end

Run the complete three-router lab from a Linux checkout:

bash scripts/bgp-hot-reload-smoke.sh
PhaseNeighbor B (AS 65002)Neighbor C (AS 65003)
Start A with B onlyEstablished; 10.20.0.0/24 learnedAbsent
Add C and reloadStill Established; route retainedEstablished; 10.30.0.0/24 learned
Remove C and reloadStill Established; route retainedSession removed; its route withdrawn

On a managed host, check the edited file, then send SIGHUP to the daemon that loaded it (its process ID as WREN_PID). Inspect the same socket before and after.

wren check --config /etc/wren/wren.toml
kill -HUP "$WREN_PID"
wren show bgp neighbors
wren show routes

A rejected reload leaves the running configuration active. Check the daemon log for parsing or resolution errors. Complete test and expected conditions.

Subscribe to forwarding changes

wren monitor routes

The initial snapshot ends with % end-of-dump. A + record installs or replaces a route; a - record withdraws a prefix from a table. For example, - 198.51.100.0/24 table 254 withdraws that prefix from Linux’s main table. Directly connected routes stay with the interface owner.

Export FlowSpec decisions

wren show bgp flowspec
wren monitor flowspec

The stream carries action and match fields plus snapshot and withdrawal events. Downstream consumers apply forwarding policy. Actions include discard, rate-limit:<bytes-per-second> and mark:<dscp>. A none token means no recognized action. FlowSpec integration test.

Collect metrics

wren show metrics

The Unix socket returns Prometheus exposition text. Inspect wren_bgp_neighbor_up by neighbor and ASN and wren_rib_routes by protocol. For node_exporter’s textfile collector, write a temporary file in its configured directory and rename it into place after a successful read.

Stream BGP events to a collector

[bgp.bmp]
station = "192.0.2.50:11019"

Add this table to your BGP configuration. Wren connects to that BMP collector and emits peer-up, route-monitoring and peer-down messages. Reconnection resumes live observations; it does not replay the missed interval. Collector test.

BGP on Linux

Wren can carry an IPv4 prefix across a peering link with only IPv6 addresses. Use the example below to verify both the negotiated next hop and the installed Linux route.

Peer over an IPv6-only link

The lab connects AS 65001 to AS 65002 over 2001:db8::/64. Router B originates 10.99.0.0/24. A and B negotiate extended next-hop encoding; the 32-bit router IDs do not need to be assigned to the peering interfaces.

flowchart LR
  A["Router A · AS 65001<br/>2001:db8::1"] <-->|"eBGP, extended next hop"| B["Router B · AS 65002<br/>2001:db8::2"]
  B -.->|"10.99.0.0/24 via 2001:db8::2"| A

Router A · receiving peer

router-id = "10.0.0.1"
[bgp]
enabled             = true
local-as            = 65001
ebgp-require-policy = false
[[bgp.neighbor]]
address          = "2001:db8::2"
remote-as        = 65002
extended-nexthop = true

Router B · originating peer

router-id = "10.0.0.2"
[bgp]
enabled             = true
local-as            = 65002
network             = ["10.99.0.0/24"]
next-hop6           = "2001:db8::2"
ebgp-require-policy = false
[[bgp.neighbor]]
address          = "2001:db8::1"
remote-as        = 65001
passive          = true
extended-nexthop = true

The example sets ebgp-require-policy = false for this isolated two-router test. For deployment, attach explicit import and export filters as in the configuration guide.

Verify the route in Linux

From the checkout root on Linux with iproute2 and user/network namespaces enabled:

bash scripts/bgp-unnumbered-smoke.sh
InspectWhat the lab checks
wren show bgp neighbors2001:db8::2 AS 65002 Established
wren show bgp10.99.0.0/24 has an IPv6 next hop
ip -4 route show proto bgp10.99.0.0/24 via inet6 … dev veth0

For a directly connected peer the next hop may be link-local. Check the egress interface alongside that address. If the peer is up but the route is absent, check address-family negotiation and eBGP policy first. Full test fixture.

Filter what an eBGP peer can exchange

The default eBGP policy requires explicit filters for each direction. The configuration example admits one prefix per direction. Run bash scripts/bgp-default-deny-smoke.sh to compare the four cases: neither filter, import only, export only, and both. A peer can remain Established throughout while its usable route set changes.

Session states

wren show bgp neighbors prints each peer’s RFC 4271 state:

stateDiagram-v2
  [*] --> Idle
  Idle --> Connect: start
  Connect --> OpenSent: TCP up
  Connect --> Active: TCP failed
  Active --> OpenSent: TCP up
  Active --> Connect: ConnectRetry
  OpenSent --> OpenConfirm: OPEN received
  OpenConfirm --> Established: KEEPALIVE received
  Established --> Idle: hold timer, NOTIFICATION or TCP failure

A manual stop or a received NOTIFICATION returns any state to Idle. An UPDATE in OpenSent or OpenConfirm, a KEEPALIVE in OpenSent, or a second OPEN is an FSM error: Wren sends NOTIFICATION code 5, drops the connection and returns to Idle.

Change and observe sessions

Add or remove a peer while other sessions stay up. For other protocol mechanisms, each linked lab below includes both ends and the assertions made on the receiver. From the checkout root, run bash scripts/<lab-name>-smoke.sh.

Select and propagate paths

CapabilityWhat to verifyLab
Four-octet ASNsNegotiate a four-byte ASN across a peering session.bgp-4octet
Equal-cost next hopsCheck that two eligible paths produce a multipath kernel route.bgp-multipath
ADD-PATHCompare one path with multiple path IDs announced to an IPv4 peer.bgp-add-path
RedistributionOriginate selected routes from another protocol in BGP.bgp-redistribute
TransitObserve the AS path after an advertisement crosses a transit AS.bgp-propagate
Route reflectionRelay a route between iBGP clients without a direct client-to-client session.bgp-route-reflection
ConfederationsCompare AS paths inside the confederation and at the external edge.bgp-confederation
Default originationLimit which neighbor receives the advertised default.bgp-default-originate
Address aggregationCompare the summary and its contributing prefixes.bgp-aggregate

Tag and validate routes

CapabilityWhat to verifyLab
Standard communitiesRecognize community attributes at the receiving peer.bgp-community
Per-prefix tagsApply tags selectively with a neighbor export filter.bgp-export-filter
Large communitiesObserve the global administrator and two local values on a received route.bgp-large-community
Extended communitiesInspect extended community attributes after exchange.bgp-ext-community
Origin validationCompare Valid, Invalid and NotFound results against local ROAs.bgp-rpki
RTR cacheFetch ROAs from a validating cache and check how invalid origins are handled.bgp-rtr

Operate sessions

CapabilityWhat to verifyLab
Connection collisionsCheck which session remains when both neighbors initiate.bgp-collision
TTL securitySet the expected hop distance consistently on both peers.bgp-ttl-security
TCP-MD5Configure matching peer authentication on a supported Linux kernel.bgp-password-v6
TCP-AONegotiate a session on a kernel with TCP-AO support.bgp-tcp-ao
Maximum prefixesBound the number of prefixes accepted from one peer.bgp-max-prefix
Route refreshRequest advertisements again over an established session.bgp-route-refresh
Graceful restartObserve retained routes on a helper when its peer restarts.bgp-graceful-restart

Exchange tenant reachability with EVPN

Use a MAC-VRF to exchange tenant MAC addresses and an IP-VRF to exchange tenant prefixes. Each imports its own route targets. A route reflector can relay these advertisements without being a tenant VTEP.

flowchart LR
  a["Leaf 10.0.0.1<br/>VNI 10100, L3 VNI 50100"] <-->|iBGP, evpn| rr[Route reflector<br/>10.0.0.254]
  rr <-->|iBGP, evpn| b[Other leaf]

Configure the first router

This leaf advertises a MAC/IP on VNI 10100 and an IP prefix in L3 VNI 50100. Its peer is an iBGP route reflector. The other leaf uses its own addresses and matching tenant import targets.

router-id = "10.0.0.1"
[bgp]
enabled  = true
local-as = 65010
[[bgp.neighbor]]
address   = "10.0.0.254"
remote-as = 65010
passive   = true
evpn      = true
[bgp.evpn]
vtep-ip = "10.0.0.1"
srv6-locator = "fc00:0:1::/48"
[[bgp.evpn.instance]]
evi = 100
vni = 10100
advertise-mac = ["02:00:5e:00:00:01/10.100.0.1"]
[[bgp.evpn.ip-vrf]]
name = "tenant-a"
l3-vni = 50100
advertise-prefix = ["10.20.0.0/24"]
router-mac = "02:00:5e:00:00:aa"

Observe the result

bash scripts/bgp-evpn-smoke.sh

On a separate running instance, inspect the same state:

wren show evpn
wren monitor evpn

On the receiving leaf, the test checks the remote MAC, flood VTEP, and 10.20.0.0/24 in tenant-a. The monitor emits vni for bridging entries and l3vni for routed entries.

Lab source.

VXLAN and SRv6 service identifiers

For routed VXLAN traffic the IP-VRF advertises a router MAC. With srv6-locator configured, eligible EVPN advertisements also carry service SIDs. Use the receiving leaf’s show evpn and monitor output to verify the remote next hop and SID. A forwarding-plane consumer implements the encapsulation.

Advertise a local MAC on demand

On a running VNI, wren evpn advertise 10100 02:00:00:00:00:cc 192.0.2.20 originates a type-2 route. Use wren evpn withdraw 10100 02:00:00:00:00:cc to withdraw it. The documented lab covers single-homed leaf VTEPs and route types 2, 3, and 5.

OSPFv2 on a point-to-point link

Use OSPFv2 to advertise IPv4 routes inside an area. The first checkpoint is a Full adjacency; the link-state database and the Linux route table answer different questions.

Configure the first router

This is router A on the test veth pair. Router B uses its own router ID, the interface on the opposite end, and the same network type and area.

router-id = "10.0.0.1"
[ospf]
enabled = true
interfaces = ["veth0"]
network-type = "point-to-point"

Observe the result

bash scripts/ospf-show-smoke.sh

On a separate running instance, inspect the same state:

wren show ospf neighbors
wren show ospf interfaces
wren show ospf database

The lab runs its own queries before cleanup and checks for the neighbor in Full state and the interface in PtP state. wren show ospf neighbors steps through the RFC 2328 states on the way:

stateDiagram-v2
  direction LR
  [*] --> Down
  Down --> Init: Hello seen
  Init --> TwoWay: our ID in its Hello
  TwoWay --> ExStart: form adjacency
  ExStart --> Exchange
  Exchange --> Loading: database described
  Loading --> Full: LSAs received
  Exchange --> Full: nothing to request

Lab source.

Choose an area type

Stub areas suppress external LSAs. An NSSA may originate local externals as type 7. An ABR can inject a default into a plain NSSA. Use the stub, NSSA default, or totally stubby lab to check what each router learns.

Redistribution and authentication

Configure redistribution deliberately on the ASBR and inspect the receiving router’s database. Separate regression cases cover redistribution and authentication. Review the coverage notes before relying on an optional extension.

OSPFv3 over IPv6

OSPFv3 peers over IPv6 link-local addresses. Its router ID is still 32 bits. An IPv4 address on the peering interface is unnecessary.

Configure the first router

On a point-to-point interface, set a unique router ID on each node and enable the matching interface on its peer.

router-id = "10.0.0.1"
[ospf3]
enabled = true
interfaces = ["veth0"]
network-type = "point-to-point"

Observe the result

bash scripts/ospf3-show-smoke.sh

On a separate running instance, inspect the same state:

wren show ospf3 neighbors
wren show ospf3 interfaces

On the running lab, the neighbor appears as 10.0.0.2 via fe80:… dev veth0 state Full. The interface view identifies area 0.0.0.0 and PtP.

Lab source.

Validate additional requirements

Use the OSPFv3/BFD lab to observe a failed BFD session tear down the adjacency. For authenticated adjacencies, use the authentication trailer configuration on both peers.

IS-IS on a point-to-point link

IS-IS exchanges link-state information over the interface itself. Identify the router by its unique system ID and inspect adjacency level as well as interface state.

Configure the first router

This router uses the fixture’s six-byte system ID. Give the peer its own ID and matching level/network type.

router-id = "10.0.0.1"
[isis]
enabled = true
interfaces = ["veth0"]
system-id = "0000.0000.0001"
network-type = "point-to-point"
hello-interval = 3

Observe the result

bash scripts/isis-show-smoke.sh

On a separate running instance, inspect the same state:

wren show isis neighbors
wren show isis interfaces
wren show isis database

The lab checks that 0000.0000.0002 reaches Up at level 1 and that veth0 is a point-to-point l1l2 interface.

Lab source.

Levels, redistribution, and authentication

Use the three-way handshake test for point-to-point adjacency and the L1/L2 leak test for cross-level prefix policy. The redistribution and authentication fixtures include both endpoints.

Babel neighbor and route inspection

Babel uses Hello and IHU messages to measure a neighboring link. Examine receive and total link cost before interpreting the metric of a learned IPv6 prefix.

Configure the first router

The two test routers use separate interfaces joined by a veth pair. This is router A.

router-id = "10.0.0.1"
[babel]
enabled = true
interfaces = ["veth0"]

Observe the result

bash scripts/babel-show-smoke.sh

On a separate running instance, inspect the same state:

wren show babel neighbors
wren show babel routes

The lab finds a link-local neighbor with numeric rxcost and cost values, then checks 2001:db8:99::/64 through a link-local next hop.

Lab source.

Redistribute selected routes

The redistribution lab exercises the export policy. Use the VRF lab when the route belongs in a separate Linux table. The neighbor lab above measures a wired virtual link; use your own topology to evaluate wireless behavior.

RIPv2 and RIPng

Use [rip] for IPv4 and [ripng] for IPv6. Enable both on the same link when both families should advertise routes.

Configure the first router

The lab originates two static routes. Each protocol exports the route in its own address family.

router-id = "10.0.0.1"
[[static]]
prefix = "10.99.0.0/24"
via    = "10.0.0.2"
[[static]]
prefix = "2001:db8:99::/64"
via    = "2001:db8::2"
[rip]
enabled      = true
interfaces   = ["veth0"]
redistribute = ["static"]
[ripng]
enabled      = true
interfaces   = ["veth0"]
redistribute = ["static"]

Observe the result

bash scripts/rip-show-smoke.sh

On a separate running instance, inspect the same state:

wren show rip
wren show ripng

Inspect 10.99.0.0/24 in the RIP table and 2001:db8:99::/64 in RIPng. With a kernel backend, inspect learned routes separately with ip -4 route and ip -6 route.

Lab source.

Filter advertisements

Run the IPv4 redistribution lab and the IPv6 redistribution lab to compare an accepted and a rejected route across a live adjacency.

Static and connected routes

Declare a static route

Use via for a gateway, dev for an on-link destination, or both to pin a gateway to an interface. A blackhole route has no next hop. This example keeps a fallback route to the documentation prefix.

router-id = "192.0.2.10"
[[static]]
prefix = "198.51.100.0/24"
via = "192.0.2.1"
distance = 250

Save as fallback.toml and run wren check -c fallback.toml. With the kernel backend, the gateway must resolve through an interface. Check wren show routes for the selected path and ip -4 route show exact 198.51.100.0/24 for the kernel result. A higher administrative distance makes the fallback less preferred.

Interpret connected networks

Linux creates a route when it configures a local subnet. Wren can use connected networks for route selection and redistribution. Interface routes stay under kernel ownership; they are omitted from the forwarding export stream. Inspect ip -4 route show proto kernel to see routes installed by address configuration.

Separate tenant routes with VRFs

A named VRF directs selected routes into a dedicated Linux table. A BGP instance bound to it uses the VRF’s routing domain for its session as well.

flowchart LR
  st["[[static]] vrf = blue"] --> rib[VRF blue RIB]
  bgp["[bgp] vrf = blue"] <--> rib
  rib --> t100[Linux table 100]
  other[Routes without vrf] --> main[Linux main table]

Configure the first router

This fixture uses a Linux VRF master named blue and table 100. The test script creates the Linux devices. The Wren TOML binds BGP and a static prefix to that domain; its permissive eBGP policy is limited to the isolated lab.

router-id = "10.0.0.1"
[[vrf]]
name  = "blue"
table = 100
[[static]]
prefix = "10.99.0.0/24"
via    = "10.9.0.100"
vrf    = "blue"
[bgp]
enabled             = true
local-as            = 65001
vrf                 = "blue"
redistribute        = ["static"]
ebgp-require-policy = false
[[bgp.neighbor]]
address   = "10.9.0.2"
remote-as = 65002

Observe the result

bash scripts/vrf-bgp-smoke.sh

On a separate running instance, inspect the same state:

ip route show table 100
wren show routes

The receiving router learns 10.99.0.0/24 via 10.9.0.1 in table 100. The same prefix is absent from the main table.

Lab source.

Distinguish table selection from route policy

The Linux table number selects a forwarding domain. A route distinguisher identifies a route in VPN-related contexts. VRF import and export route-maps decide what enters the VRF RIB or reaches the FIB. Static table isolation and route-map example.

Detect a failed routing peer with BFD

BFD can tell a routing protocol that its neighbor has failed before the protocol’s own hold timer expires. Check BFD and protocol state separately.

Configure the first router

Router A enables BFD on a particular BGP neighbor. The lab uses permissive eBGP policy only inside its disposable namespaces. The BFD intervals are milliseconds; the BGP hold time is seconds.

router-id = "10.0.0.1"
[bfd]
min-tx      = 200
min-rx      = 200
detect-mult = 3
[bgp]
enabled             = true
local-as            = 65001
hold-time           = 180
ebgp-require-policy = false
[[bgp.neighbor]]
address   = "10.0.0.2"
remote-as = 65002
bfd       = true

Observe the result

bash scripts/bgp-bfd-smoke.sh

On a separate running instance, inspect the same state:

wren show bfd
wren show bgp neighbors
sequenceDiagram
  participant A as Router A
  participant B as Router B
  A->>B: BGP Established
  A->>B: BFD Up
  Note over B: B stops answering
  A->>A: no BFD packet for detect-mult × interval
  A->>A: BFD Down, BGP session torn down
  Note over A: hold timer (180 s) not needed

The fixture waits for BFD Up and BGP Established, then checks that loss of BFD tears down BGP before its 180-second hold timer. Detection depends on the negotiated intervals and multiplier.

Lab source.

Authentication and echo

The per-session authentication test configures peers independently. To check packet return on the data path, start with the IPv4 echo or IPv6 echo example.

Move a gateway address between two routers

VRRP peers share a virtual router ID and virtual IP. During failover, verify the address on the interface as well as the router role.

stateDiagram-v2
  [*] --> Initialize
  Initialize --> Master: startup, priority 255
  Initialize --> Backup: startup
  Backup --> Master: master-down timer
  Master --> Backup: advert from higher priority, or equal with higher address
  Master --> Initialize: shutdown
  Backup --> Initialize: shutdown

A new master assumes the virtual address and announces it (gratuitous ARP for IPv4, unsolicited neighbor advertisement for IPv6). wren show vrrp prints the state.

Configure the first router

The lab configures priority 200 on router A. Router B uses the same VRID and virtual address with a lower priority.

router-id = "10.0.0.1"
[[vrrp]]
interface       = "veth0"
vrid            = 51
priority        = 200
advert-interval = 300
virtual-address = ["10.0.0.254"]
prefix-length   = 24

Observe the result

bash scripts/vrrp-smoke.sh

On a separate running instance, inspect the same state:

wren show vrrp
ip -4 addr show dev veth0

The fixture checks that only A holds 10.0.0.254 initially, then checks that B assumes the address after A stops.

Lab source.

Use the uplink tracking lab to lower effective priority when a tracked interface fails. With address-interface, elections can run on a separate interface from the VIP. The address ownership test exercises removal and recreation of the serving link.

Appliance forwarding authority

VRRP manages address ownership. Sentinel can additionally gate forwarding on a lease from an independent witness. Its explicit two-node mode has different partition guarantees: two isolated members cannot distinguish peer failure from loss of every control path. Use the Sentinel operator handbook for appliance enrollment and failover procedures.

How Wren selects a route

Follow a prefix

flowchart LR
  proto[Protocol task] -->|import filter| upd[Route update]
  upd --> rib[Router loop<br/>RIB per table and prefix]
  rib -->|winner changed| chg[Install or removal]
  chg -->|FIB export policy| be{Backend}
  be --> k[kernel: netlink]
  be --> m[memory: in process]
  rib -->|redistribution| proto
  rib --> mon[wren monitor routes]
  1. A protocol accepts an advertisement and submits a candidate to the route manager.
  2. The RIB compares candidates for that table and prefix. When the winner changes, the RIB produces an install or a removal.
  3. The selected backend applies the forwarding update. Import and FIB export policy can affect what is retained or installed. Connected networks stay under kernel ownership.

Learned, selected and installed are three views:

wren show bgp routes
wren show routes
ip -4 route show proto bgp

Compare competing sources

Within a table and prefix, higher administrative preference wins, followed by lower metric. Defaults include Connected 240, Static 200, OSPF 150, IS-IS 145, RIP 120, Babel 115, BGP 100, and Kernel 10. A BGP path first competes with other BGP paths inside the protocol. A configured static administrative distance uses the opposite scale: a larger distance makes it a weaker candidate.

Trace the implementation

ComponentResponsibility
wren-corePrefixes, next hops, route identity, best-route selection, and the FIB trait
wren-filterApply rule sets at import and export
wren-daemonSockets, timers, control queries, the router loop, and configuration reload
wren-netlinkEncode decisions as Linux kernel route updates

Other processes can subscribe to forwarding changes over the local control socket.

Embed the routing core

Select and apply a route

The wren-core crate has no third-party dependencies. A caller feeds candidates to Rib and applies the returned change to a Fib implementation. This example keeps the FIB in memory.

#![allow(unused)]
fn main() {
use wren_core::{Rib, Route, Protocol, Prefix, NextHop, Fib, MemoryFib};

let mut rib = Rib::new();
let mut fib = MemoryFib::default();   // or your own Fib implementation

let route = Route::new(
    "10.0.0.0/24".parse::<Prefix>().unwrap(),
    Protocol::Static,
    vec![NextHop::via("192.0.2.1".parse().unwrap())],
    0,                                 // metric
);

if let Some(change) = rib.update(route) {
    fib.apply(&change).unwrap();       // program your data plane
}
}

Identify a candidate

Within a routing table the candidate’s identity includes its prefix, origin protocol and source discriminator. Updating the same candidate replaces it. A different candidate may become the winner after a withdrawal.

Interpret the result

RIB changeConsumer action
Some(FibChange::Install(...))Install or replace the selected route.
Some(FibChange::Remove(...)) (on withdrawal)Remove the prefix after its last eligible route disappears.
NoneThe selected forwarding entry is unchanged.

Choose the backend

Use MemoryFib for in-process tests. A separate integration can implement Fib or consume the daemon’s route stream. To exercise route selection independently of Linux, run cargo test --locked -p wren-core from the workspace root. Core API and tests

Coverage and release status

This handbook is built from main. Check tagged releases and the changelog for the version you intend to deploy. The rows below point to repeatable acceptance cases for a checkout.

Select a test by requirement

RequirementWhere to start
Exchange IPv4 prefixes over an IPv6-only linkBGP lab with a kernel next-hop check
Add a peer without losing other sessions’ routesThree-peer reload procedure
Separate tenants in the control planeEVPN route types 2/3/5, Linux VRF table isolation
Verify an IGP adjacencyOSPFv2, OSPFv3, IS-IS, Babel
Check first-hop or neighbor failoverVRRP address movement, BFD and BGP state transitions
Inspect multicast behaviorIGMP querier, MLD querier, PIM-SM

Boundaries to check before deployment

The EVPN guide covers single-homed VTEPs. Ordinary Linux VRF table isolation and EVPN IP-VRF routes are distinct from MPLS VPNv4 service. FlowSpec exports selected rules through the control socket and expects an enforcing data-plane consumer. A lab that verifies a BGP route reached Linux does not measure line-rate throughput or interoperability with a particular vendor appliance.

Platform and tests

cargo test --locked -p wren-core
bash scripts/run-all-tests.sh

The core suite runs in process. The integration suite needs a Linux kernel with the namespace, routing and protocol capabilities used by each test. For deployment-specific requirements, start with the linked individual lab and reproduce its assertions on your target environment. Current issues