HomeLearnRPKI Explained: Securing BGP Route Origins

RPKI Explained: Securing BGP Route Origins

Last updated

RPKI - Resource Public Key Infrastructure - is a security system that makes BGP route origins verifiable. It lets the legitimate holder of a block of IP addresses publish a signed statement, a Route Origin Authorization (ROA), declaring which autonomous system may announce that block. Routers then perform Route Origin Validation (ROV): they compare each BGP announcement with the published ROAs and mark it valid, invalid or not-found. Networks that drop RPKI-invalid routes are protected from the most common accidental and malicious origin hijacks of prefixes that are covered by ROAs.

RPKI & ROA Lookup

The problem RPKI solves

In plain BGP, any network can announce any prefix, and its neighbors have no built-in way to check whether the announcing network actually holds those addresses. Before RPKI, the main defense was filtering based on Internet Routing Registry (IRR) data - useful, but anyone can create IRR objects in some databases, and nothing ties them cryptographically to the address holder.

RPKI closes that gap by attaching cryptographic certificates to the same allocation chain that hands out the addresses. The five Regional Internet Registries know who holds which prefix, so they can certify it. A statement signed with the holder's certificate is therefore strong evidence that the holder really authorized it.

How the RPKI is built

The architecture is described in RFC 6480. It has four parts:

  • Trust anchors: each of the five RIRs (AFRINIC, APNIC, ARIN, LACNIC, RIPE NCC) operates a root certificate. Validators are configured with a Trust Anchor Locator (TAL) file for each of them.
  • Resource certificates: below each trust anchor, certificates bind address blocks and ASNs to their holders, following the allocation hierarchy (RIR, then member, sometimes national registry or sub-allocation).
  • Signed objects: holders use their certificate to sign objects such as ROAs (and newer object types such as ASPA). Most holders use the hosted RPKI service of their RIR; larger ones can run delegated RPKI and publish from their own infrastructure.
  • Relying party software (validators): programs that download all published objects (over RRDP, RFC 8182, or rsync), verify every signature back to a trust anchor, and output the list of validated authorizations. Routers receive that list from the validator over the RPKI-to-Router (RTR) protocol, RFC 8210.

The router never handles certificates itself. It only receives a compact list of validated entries - prefix, maximum length, origin AS - and applies it to incoming routes.

What a ROA contains

A ROA (profile in RFC 9582) says: "AS X may originate this prefix, and more-specifics of it up to length Y". It has three fields that matter for validation:

FieldExampleMeaning
Prefix203.0.113.0/24The address block being authorized.
maxLength24The longest prefix length that may be announced. Optional; if omitted it equals the prefix length.
Origin ASAS64500The only AS allowed to originate the prefix under this ROA.

A prefix can have several ROAs, one per authorized origin. That is how anycast setups or customers announcing provider space are expressed. A ROA with origin AS0 is a special case (RFC 6483, RFC 7607): AS0 never appears as a real origin, so an AS0 ROA marks a prefix that should not be routed at all - unless another ROA for a real AS also covers it.

Route Origin Validation step by step

ROV is defined in RFC 6811. For every route it receives, the router takes the prefix and the origin AS (the right-most ASN of the AS-path) and checks them against the validated ROA list:

  1. Find all ROAs whose prefix covers the route's prefix (equal or less specific). If there are none, the route is NotFound.
  2. If any covering ROA has the same origin AS and a maxLength at least as long as the route's prefix length, the route is Valid.
  3. Otherwise - covered, but no ROA matches both origin and length - the route is Invalid.

Take a single ROA for 203.0.113.0/24, maxLength 24, origin AS64500, and four announcements:

Documentation prefixes and ASNs.
AnnouncementOriginResultWhy
203.0.113.0/24AS64500ValidOrigin and length match the ROA
203.0.113.0/24AS64511InvalidCovered by the ROA, wrong origin
203.0.113.128/25AS64500InvalidRight origin, but /25 is longer than maxLength 24
198.51.100.0/24AS64500NotFoundNo ROA covers this prefix

The third row is the one that surprises people: the legitimate origin announcing a more-specific is still invalid if the ROA does not allow that length. The usual policy is to accept Valid and NotFound routes and reject Invalid ones. NotFound has to be accepted because a large part of the address space still has no ROA.

Why maxLength matters

maxLength decides which more-specifics are authorized. If a ROA for 203.0.113.0/24 had maxLength 32, anyone able to forge the origin AS64500 at the end of an AS-path could announce 203.0.113.0/25 and 203.0.113.128/25, ROV would mark those routes valid, and every network that accepts them would send the traffic to the attacker. (Many networks filter IPv4 prefixes longer than /24, which limits this particular example, but the same problem applies to a /22 with maxLength 24.) This is called a forged-origin sub-prefix hijack.

RFC 9319 (BCP 185) therefore recommends avoiding maxLength unless every more-specific it permits is actually announced. In practice: create one ROA per prefix you really announce, with maxLength equal to that prefix's length. If you deaggregate for traffic engineering, add a ROA for each more-specific instead of opening a wide maxLength. Loose maxLength values are a common RPKI misconfiguration and worth checking.

How to check RPKI status

The RPKI and ROA lookup shows, for any prefix or ASN, the covering ROAs and the validation state of the announced routes. The prefix pages show the same per prefix, and the ASN pages summarize how many of a network's announcements are valid, invalid or not covered.

From a terminal, the plain-text interface prints the state of the prefix that routes an address:

$ curl ipctl.io/ip/1.1.1.1/rpki
valid

$ curl ipctl.io/prefix/1.1.1.0/24
Prefix:          1.1.1.0/24
Origin AS:       AS13335
RPKI:            valid
...
Output trimmed. See 1.1.1.0/24 for the ROA details.

For automation, the REST API returns the ROAs (prefix, origin_asn, max_length, trust_anchor) and the RPKI status of each BGP route in the prefix endpoint; the API documentation has the details.

Deploying RPKI: publishing ROAs and enforcing ROV

If you hold address space: create ROAs

  1. List every prefix you announce and the AS that originates it, including more-specifics and prefixes announced by customers or DDoS protection services on your behalf.
  2. Create the ROAs in your RIR's hosted RPKI (or your delegated CA). Use maxLength equal to the announced length.
  3. Wait for the objects to propagate (validators typically refresh within an hour), then check that every announcement shows as valid and none as invalid.
  4. Keep ROAs in your change process: before you move a prefix to a new origin or start announcing a more-specific, create the matching ROA first.

If you run routers: validate and drop invalids

  1. Run at least two validator instances, independently of each other, so a single failure does not leave routers without data.
  2. Connect the routers to the validators over RTR and start by only tagging routes with their state, to see what would be dropped.
  3. Once the impact is understood, reject Invalid routes on eBGP sessions. If all validators become unreachable, routers keep using their cached data until it expires and then treat every route as NotFound, so the network keeps working.

What RPKI does not do

RPKI ROV validates only the origin - the last ASN in the path - and it can only see a wrong origin, not a forged one. An attacker who announces the prefix with the legitimate origin AS placed at the end of a fake path passes ROV, and a route leak keeps the correct origin and passes as well.

Closing that gap is the job of path validation. ASPA uses the same RPKI hierarchy to publish customer-to-provider relationships so routers can detect implausible paths and leaks; BGPsec signs the path hop by hop but has seen little deployment. ROV remains the foundation: ASPA complements it, it does not replace it.

See it live
1.1.1.0/24 - A prefix with a valid ROA - see the ROA and the RPKI state of its route.
AS13335 (Cloudflare) - A network with broad RPKI coverage across its announced prefixes.
BGP statistics - Share of valid, invalid and not-found routes in the global table.

Frequently Asked Questions

What does RPKI stand for?

Resource Public Key Infrastructure. It binds IP address and ASN allocations to cryptographic certificates so routing origins can be verified.

What is the difference between a ROA and ROV?

A ROA is the signed authorization the address holder publishes; ROV is the check a router performs against all ROAs. One is data, the other is the process. See also ROA vs ROV.

What are the RPKI validation states?

Valid (a ROA authorizes the origin and length), Invalid (a ROA covers the prefix but the origin or length does not match) and NotFound (no ROA covers the prefix).

Why is my own route RPKI-invalid?

Usually because the announced prefix is longer than the ROA's maxLength, or because a ROA exists for a different origin AS (for example after moving the prefix to a new provider or a DDoS protection service). Add or fix the ROA for the exact prefix and origin you announce.

Is it safe to drop RPKI-invalid routes?

Yes, it is the recommended policy and widely deployed. Invalid means the address holder's own published authorization contradicts the announcement. Routes without a ROA are NotFound, not Invalid, and stay accepted.

Does RPKI stop all BGP hijacks?

No. ROV blocks announcements with the wrong origin AS, which covers the most common hijacks and mistakes. Forged paths that keep the real origin, and route leaks, need ASPA or other path validation.