The documentation moves from READMEs into a site in docs/: getting started, a user guide, operations, a reference, and development pages, written in the style of network vendors' documentation (docs/STYLE.md). bin/bgp/README.md and docs/RFCs.md are folded into it. - A theme of its own in the International Typographic Style, in blues, with self-hosted Inter and JetBrains Mono, search over Zola's index, dark mode, and no resources loaded from other hosts. - Example configurations in docs/examples/, shown on the pages and checked with `bgp --check` in CI. - A test that fails when a field of config.proto is missing from the configuration reference. - A CI job that builds the site; Zola fails on broken links and anchors. - A hardened systemd unit, tried under systemd with kernel routes on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7.3 KiB
+++ title = "Route Advertisement" description = "Describes how Ferrix advertises originated and learned routes, how BGP roles and communities restrict advertisement, and how to configure export policy." weight = 6 +++
Ferrix advertises two kinds of routes to its neighbors:
- Originated routes, configured with the
originatestatement. Ferrix advertises them to every neighbor. - Learned routes, received from other neighbors. Ferrix advertises the
best path for each prefix to the neighbors whose export policy enables
learned_routes.
Configuring Originated Routes
The following example originates one IPv4 and one IPv6 prefix:
originate { prefix: "198.51.100.0/24" }
originate {
prefix: "2001:db8:100::/48"
med: 50
as_path_prepend: 1
large_communities: "64500:2:0"
}
Ferrix advertises an originated route with an AS path that contains the local AS number and, on each session, the local address of the session as the next hop. For the optional attributes, see OriginatedRoute.
Advertising Learned Routes
To advertise learned routes to a neighbor, enable learned_routes in its
export policy:
export { learned_routes: true }
The top-level export statement applies to every neighbor that does not
have its own export statement. A neighbor's export statement replaces
the top-level statement entirely.
Ferrix does not advertise a learned route in the following cases. These rules cannot be disabled:
- To the neighbor from which the route was received.
- To a neighbor whose AS number is in the AS path of the route.
- From one IBGP neighbor to another IBGP neighbor. Route reflection is not supported.
- To an EBGP neighbor, if the route has the
NO_EXPORTcommunity; to any neighbor, if the route has theNO_ADVERTISEcommunity.
Attributes of Advertised Routes
Table 1 lists how Ferrix modifies the attributes of a learned route for each type of neighbor.
| Neighbor type | AS path | Next hop | MED | Local preference |
|---|---|---|---|---|
| EBGP | Local AS prepended | Local address of the session | Removed | Not sent |
| IBGP | Unchanged | Local address of the session | Unchanged | Sent; 100 if the route has none |
ROUTE_SERVER_CLIENT (RFC 7947) |
Unchanged | Unchanged, if the client can use it | Unchanged | Not sent |
Ferrix advertises unknown optional transitive attributes with the Partial bit set, and does not advertise unknown non-transitive attributes.
Roles and Route Advertisement
Ferrix adds the Only to Customer (OTC) attribute to routes received from providers, peers, and route servers (RFC 9234), and advertises routes with the OTC attribute only to customers. Routes received from customers are advertised to all neighbors. Therefore, when every neighbor has a role, the local router provides transit only to its customers.
export { learned_routes: true }
peers { name: "customer-a" role: CUSTOMER ... }
peers { name: "transit-a" role: PROVIDER ... }
peers { name: "ixp-a-rs" role: ROUTE_SERVER ... }
Caution
A neighbor without a role is not subject to this restriction. If
learned_routesis enabled for such a neighbor, Ferrix advertises all learned routes to it, including routes from providers and peers. Ferrix logs a warning at startup for each such neighbor.
Configuring Export Policy
The export policy can add and remove communities on advertised routes, and prepend the local AS number to the AS path:
export {
remove_communities: "64500:2:*"
add_large_communities: "64500:3:1"
as_path_prepend: 2
}
| Statement | Description |
|---|---|
remove_communities |
Removes matching communities before communities are added. A pattern has two fields for a standard community and three for a large community; each field is a number or *. |
add_communities, add_large_communities |
Adds communities to every advertised route. |
as_path_prepend |
Prepends the local AS number the specified number of additional times. Range: 0 through 16. Default: 0. |
Control Communities
Control communities allow a route's communities to restrict the neighbors to which Ferrix advertises it. The format is the one used by Internet exchange route servers. To enable control communities, configure the following top-level statement:
control_communities: true
Table 2 lists the control communities, where L is the local AS number and
P is a neighbor's AS number.
| Standard community | Large community | Action |
|---|---|---|
0:P |
L:0:P |
Do not advertise to the neighbor with AS P. |
L:P |
L:1:P |
Advertise to the neighbor with AS P. If present, advertise only to neighbors named in such communities. |
0:L |
L:0:0 |
Do not advertise to any neighbor. |
Control communities are evaluated as follows:
- "Do not advertise" takes precedence over "advertise".
- A route without control communities is advertised as the other rules permit.
- Standard communities can express AS numbers up to 65535 only. Use the large community forms for four-octet AS numbers.
- Ferrix removes control communities from a route when it advertises the route.
- Control communities apply to originated routes and to communities added by the import policy.
The following example prevents the advertisement of an originated route to AS 64496:
control_communities: true
originate {
prefix: "198.51.100.0/24"
large_communities: "64500:0:64496"
}
Important
When control communities are enabled, Ferrix interprets the standard community
L:nas "advertise to AS n", and the large communitiesL:0:nandL:1:nas listed in Table 2. Use large communitiesL:2:nand higher for informational communities. Do not remove customers' control communities withremove_communities.
Update Generation
Ferrix groups routes with identical attributes into a single UPDATE message. It collects changes for 50 milliseconds before it sends them.
When a neighbor requires the full routing table, at session establishment or after a ROUTE-REFRESH message, Ferrix collects the entire table before it sends it, so that prefixes with identical attributes share UPDATE messages. At most four sessions collect a full table concurrently; other sessions wait.
Each session has its own export task, which records the routes advertised on the session. If the neighbor reads slowly, only that session's task waits; other sessions are not affected.
In the transit benchmark, in which one neighbor advertises 1.23 million
routes and Ferrix advertises them to a second neighbor, the second neighbor
receives all routes after 2.1 seconds, with an average of four routes in
each UPDATE message.
Verifying Route Advertisement
The metric bgp_routes_exported_total{change} counts learned routes that
Ferrix advertised (announced) and withdrew (withdrawn). Ferrix does not
provide a view of the routes advertised to a neighbor (Adj-RIB-Out); to
display them, use the neighbor's own tools.
Limitations
- Per-client best path selection for route servers is not supported. Every client receives the same best path.
- ADD-PATH is not supported for advertisement; only the best path is advertised.
- Route reflection is not supported.
- UPDATE messages are generated separately for each session, even when several sessions receive identical routes.