Internet routing policy: filtering, RPKI and route-leak prevention
Build inbound and outbound eBGP filters for IPv6 following RFC 7454 (bogons, prefix lengths, own prefixes, limits). Explain RPKI route origin validation (RFC 6480, RFC 6811) and compute the validation state of a route. Run a validating cache with local test ROAs (RFC 8416) and connect routers over RPKI-to-Router (RFC 8210). Use BGP roles and the OTC attribute (RFC 9234) to prevent route leaks.
Take the quiz · pass mark 70% · 9 questions
Explanation
BGP believes what it is told. Almost every large Internet outage caused by routing is a route leak (routes passed on to a party that should not get them) or a hijack (someone originating your prefix). Good policy at every eBGP session is the defence, and RFC 7454 (BCP 194) is the operator checklist.
Inbound filters (RFC 7454)
On every eBGP session, reject:
- Special-purpose and unallocated space ("bogons"). Accept only global unicast (
2000::/3), and reject the special-purpose blocks inside it, including the documentation prefixes2001:db8::/32and3fff::/20. Also reject::/8,fc00::/7(ULA),fe80::/10andff00::/8, which are outside2000::/3anyway. Base the list on the IANA special-purpose registry and review it, because it changes. (This course uses documentation prefixes as if they were real, so the lab filters leave them out. In production, never accept them.) - Prefixes that are too long. RFC 7454 notes that IPv6 prefixes longer than /48 are commonly not accepted on the Internet. Accept /48 or shorter; never accept /128s or /64s from a transit peer.
- Prefixes that are too short, such as
::/0(unless you asked for a default route) or anything shorter than the smallest allocations. - Your own prefixes (
3fff:a00::/32and everything inside it) coming back from outside. - Routes with your own ASN in the path (the default in BGP) and, for customers, any origin or prefix they are not registered for.
Also set a maximum-prefix limit per session (neighbor X maximum-prefix N), so a peer that suddenly leaks a full table is shut down instead of flooding your RIB.
Outbound filters
Announce only what you mean to: your aggregates and your customers' prefixes. A prefix-list of exactly what may leave the AS is the strongest protection against leaking a transit provider's routes to another provider. Tag routes with communities on ingress (L4.06) and filter on them on egress.
RPKI and route origin validation
The Resource Public Key Infrastructure (RFC 6480) lets address holders sign Route Origin Authorisations (ROAs): "prefix P, up to length maxLength, may be originated by AS N". Validating caches (Routinator, rpki-client, Fort) fetch and check them, produce a list of Validated ROA Payloads (VRPs), and send it to routers with the RPKI-to-Router protocol (RFC 8210; IANA port 323, though caches often listen on another port such as 3323).
A router classifies each route by its prefix and origin AS (RFC 6811):
- NotFound: no VRP covers the route's prefix.
- Valid: a covering VRP has the same origin AS and a maxLength at least as long as the route's prefix length.
- Invalid: at least one VRP covers the prefix, but none matches (wrong origin, or the prefix is longer than maxLength).
The usual policy is drop Invalid, accept Valid and NotFound. Valid does not mean safe: it only says the origin is authorised. A forged path ending in the right ASN is still Valid.
maxLength matters. A ROA for 2001:db8:3000::/44 with maxLength 48 authorises every prefix from /44 to /48 in that block, so an attacker can announce a more specific /48 with the right (forged) origin and win by longest-prefix match. RFC 9319 recommends minimal ROAs: avoid maxLength and create ROAs for exactly what you announce.
Local exceptions (SLURM)
RFC 8416 defines SLURM, a JSON file that lets an operator filter VRPs or add local assertions. Labs use it to create test ROAs without touching the real RPKI:
{
"slurmVersion": 1,
"validationOutputFilters": { "prefixFilters": [], "bgpsecFilters": [] },
"locallyAddedAssertions": {
"prefixAssertions": [
{ "asn": 64497, "prefix": "2001:db8:2000::/36", "maxPrefixLength": 36, "comment": "ISP-B aggregate" },
{ "asn": 64498, "prefix": "2001:db8:3000::/44", "maxPrefixLength": 44, "comment": "Enterprise" }
],
"bgpsecAssertions": []
}
}
Run Routinator with only these assertions:
routinator --no-rir-tals --exceptions /etc/routinator/slurm.json server --rtr [::]:3323 --http [::]:8323
Check the current Routinator manual for option names on your version. StayRTR, which serves VRPs from a JSON file, is an alternative for labs.
Router configuration (FRR)
bgpd needs the RPKI module: add -M rpki to bgpd_options in /etc/frr/daemons. Then:
rpki
rpki cache tcp 2001:db8:f000:53::10 3323 preference 1
exit
!
ipv6 prefix-list BOGONS-LAB seq 10 permit ::/0
ipv6 prefix-list BOGONS-LAB seq 20 permit 2001:db8:1000::/36 le 128
ipv6 prefix-list V6-TOO-LONG seq 10 permit ::/0 ge 49
!
route-map ISPB-IN deny 10
match ipv6 address prefix-list BOGONS-LAB
route-map ISPB-IN deny 20
match ipv6 address prefix-list V6-TOO-LONG
route-map ISPB-IN deny 30
match rpki invalid
route-map ISPB-IN permit 100
!
router bgp 64496
address-family ipv6 unicast
neighbor 2001:db8:f000:1::b route-map ISPB-IN in
neighbor 2001:db8:f000:1::b maximum-prefix 1000
The lab bogon list here only drops the default route and ISP-A's own space; a production list adds the special-purpose blocks. Older FRR releases wrote rpki cache HOST PORT preference N without tcp. show rpki cache-connection, show rpki prefix-table and show bgp ipv6 unicast (which shows the validation state per route) verify it.
On MikroTik RouterOS v7, the cache is configured under /routing rpki, the BGP connection's input settings select it, and routing filter rules then match the validation state. The syntax has changed between v7 releases; check the manual for your version.
Route-leak prevention with BGP roles (RFC 9234)
Filters depend on getting every session right. RFC 9234 makes the relationship explicit: each side announces its role in a capability (code 9): Provider, Customer, Route Server, Route Server Client or Peer. Mismatched roles can refuse the session (strict mode). Routes then get the Only to Customer (OTC) attribute (type 35) when they are received from a provider, peer or route server, or sent to a customer, peer or route-server client, if they do not carry it already. A route with OTC is never sent to another provider or peer, which stops the classic leak automatically.
neighbor 2001:db8:f000:1::b local-role peer strict-mode
ASPA (Autonomous System Provider Authorisation) extends RPKI to check the AS path against signed provider relationships. It is still an IETF draft, not an RFC; watch for it.
ictNetworks scenario
ictNetworks has ROAs for 3fff:a00::/32 (AS65550, maxLength 32) and separate minimal ROAs for the few /48s it announces for DDoS-protected customers. Its border routers drop RPKI Invalid routes, reject bogons, prefixes longer than /48 and its own space, set maximum-prefix on each session, and set local-role customer towards both transit providers.
Drawing diagram…
Worked examples
VRPs: 2001:db8:2000::/36 maxLength 36 AS64497, and 2001:db8:3000::/44 maxLength 44 AS64498.
Example 1: Three routes
| Route | Origin | State | Why |
|---|---|---|---|
2001:db8:2000::/36 | AS64497 | valid | Covered, origin matches, /36 ≤ 36 |
2001:db8:3001::/48 | AS64498 | invalid | Covered by the /44, origin matches, but /48 > maxLength 44 |
2001:db8:3000::/44 | AS64497 | invalid | Covered, wrong origin |
2001:db8:4000::/48 | AS64499 | notfound | No VRP covers it |
The second line is a common real problem: the enterprise announces a /48 for traffic engineering but its ROA only allows the /44. Fix the ROA (a separate ROA for the /48), not the router.
Example 2: The cost of maxLength
A ROA for 2001:db8:2000::/36 with maxLength 48 authorises every prefix from /36 to /48 inside it: 1 + 2 + 4 + … + 4096 = 2^13 − 1 = 8191 prefixes, including 4096 /48s, any of which a forged-origin attacker could announce. With maxLength 36 it authorises exactly one.
Lab
Goal: Build RFC 7454 filters and route origin validation, and see each validation state.
You need: the L4.04 topology (a-br1 and b-br1 at least), plus a Linux container or Proxmox VM running Routinator at 2001:db8:f000:53::10. b-br1 originates test routes: 2001:db8:2000::/36 and 2001:db8:2000:100::/56 (its own), 2001:db8:3000::/44 (a "hijack" of the enterprise), and 2001:db8:4000::/48 (no ROA).
- Write the SLURM file above and start Routinator with no RIR TALs. Show the VRPs (
routinator vrpsor the HTTP interface on port 8323). - Enable the RPKI module on a-br1, connect to the cache, and show
show rpki cache-connectionandshow rpki prefix-table. - Before applying filters, list b-br1's routes on a-br1 with their validation state and predict each state first (the /36 valid, the /56 invalid because it is longer than maxLength 36, the hijack invalid, the DC /48 notfound).
- Apply the inbound route-map: reject the default, ISP-A's own space, prefixes longer than /48 and RPKI Invalid, and set maximum-prefix. Show which routes remain and explain each rejection (the /56 fails both the length filter and ROV).
- Add a SLURM assertion that makes the "hijack" valid for AS64497, reload Routinator, and show the state change on the router without resetting the BGP session. Remove it again.
- Set
local-role peer strict-modeon a-br1 only and show the session failing; configure the matching role on b-br1 and show OTC on received routes (show bgp ipv6 unicast PREFIX).
What to submit: the SLURM file, cache and RTR outputs, the route table with states before and after policy, the route-map, the state-change test, and the roles test.
Summary
- Filter every eBGP session: bogons, prefixes longer than /48, too-short prefixes, your own space, and set maximum-prefix.
- Announce only an explicit list of your own and your customers' prefixes.
- ROV states: NotFound (no covering VRP), Valid (covered with matching origin and length), Invalid (covered, no match). Drop Invalid.
- Avoid maxLength (RFC 9319); it lets attackers announce forged more-specifics.
- SLURM (RFC 8416) adds local test ROAs; RTR (RFC 8210) carries VRPs to routers.
- BGP roles and OTC (RFC 9234) block route leaks automatically. ASPA is still a draft.
- Next lesson (L4.06): multihoming and traffic engineering.
Quiz imported · 9 questions · pass mark 70%. Lab questions are not auto-marked.