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

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