Skip to content

Imports filter, then decide ​

Every BGP import first rejects the routes no neighbor should send you, then ends in a rule that accepts or rejects every route left.

Why ​

A neighbor sends whatever its own filters let out, mistakes included. Four kinds of route are never right from outside:

  • Special-purpose blocks, such as the private ranges, which IANA keeps off the internet.
  • Prefixes too long or too short: longer than /24 or /48 is too specific for the global table. Shorter than /8 or /16 is wider than any one network holds.
  • RPKI invalid routes: the holder of the prefix published a ROA, and the route contradicts it.
  • Your own space, coming back: you know where it is, so anyone else announcing it is a mistake or a hijack.

On February 24, 2008, another network announced a /24 inside YouTube's /22, and much of the internet sent YouTube's traffic there for about two hours. A ROA for YouTube's /22 now makes such a route RPKI invalid, and an import that rejects invalid routes drops it.

The last rule decides for every route that is left. An import that ends in a set with no then accepts nothing, because Circuit rejects a route that no rule accepts.

In Circuit ​

  • presets.bgp_sanity rejects the lengths and the RPKI invalid routes. Your validators go in routing.rpki.
  • presets.bogons lists the special-purpose blocks of each family, for a prefix set.
  • A prefix set of your own space rejects it on the way in.
  • imports_end_in_accept_or_reject: true in circuit.ts stops an import that doesn't end in an accept or a reject with no if.

Here is the transit import of the edge router example:

ts
prefix_sets: {
    ours: { prefixes: as64500.prefixes.ours },
    "bogons-v4": { prefixes: presets.bogons.ipv4 },
    "bogons-v6": { prefixes: presets.bogons.ipv6 },
},
policies: {
    sanity: presets.bgp_sanity,
    // A route from the exchange beats the same route from the transit: the higher local preference wins.
    "transit-import": [
        { call: "sanity" },
        { description: "Bogons", if: { prefix_set: "bogons-v4" }, then: "reject" },
        { description: "Bogons", if: { prefix_set: "bogons-v6" }, then: "reject" },
        { if: { prefix_set: "ours" }, then: "reject" },
        { communities: "import" },
        { set: { local_pref: 100 }, then: "accept" },
    ],

A neighbor without an import_policy accepts nothing. Route policies runs routes through an import one by one, Hijacks and leaks explains RPKI, and Standards gives the RFC behind each preset.

Further reading ​

Discussion

Stuck, or found a mistake? Ask here. You sign in with GitHub.

Released under the Business Source License 1.1.