Guide

BGP Policy

Ze applies ordered import and export filter chains to BGP updates. Define named policy objects once, attach them globally, to a group, or to one peer, then verify both accepted routes and the routes sent onward.

Policy model

Policy has two parts:

  1. Named filter instances under bgp { policy { ... } }.
  2. Ordered references under filter { import [...] export [...] }.
bgp {
    policy {
        loop-detection no-self-as {
            allow-own-as 0
        }
    }

    filter {
        import [ no-self-as rpki:validate ]
    }

    group customers {
        filter {
            import [ community:scrub ]
            export [ prefix:customer-export ]
        }
    }
}

The effective chain is cumulative: automatic safety filters run first, followed by global, group, and peer references. Use insert in the editor when order matters.

Filter outcomes

A filter can:

Each plugin declares whether an internal error fails open or closed. Security filters should normally reject on failure. Operational policy should make that choice explicit rather than depending on an unavailable external service.

Common policy building blocks

Ze ships filters for:

The plugin guide documents the registered filter types and their current configuration. The generated plugin catalogue shows which plugin owns each filter.

IRR and RPKI

IRR filters build allowed prefix sets from routing registry data. RPKI validates route origin against ROAs. They answer different questions and can be used together:

Use the IRR filtering and RPKI guides for cache configuration, refresh, failure behaviour, and operator commands.

Attribute changes

Attribute modification belongs in an explicit export or import chain. Keep each named modifier narrow, then compose it with other filters. Typical operations include setting local preference or MED, changing next hop, and adding or removing communities.

Inspect the live plugin documentation before using increment or decrement operations. Attribute ranges and missing-attribute behaviour are validated by the owning plugin.

Redistribution

The top-level redistribute block moves selected routes between protocol RIBs. Redistribution is separate from ordinary per-peer BGP filtering, but the resulting routes still pass through the destination protocol's policy and loop-prevention rules.

Use named destinations and specify the source protocols deliberately. Avoid broad two-way redistribution unless the topology and loop controls have been proven. Connected, static, kernel, OSPF, IS-IS, and BGP route sources have different ownership and withdrawal behaviour.

See Route filters and redistribution for the current chain rules and configuration syntax.

Verify policy

Use the same route at each boundary:

ze cli -c "show bgp rib peer transit-a"
ze cli -c "show bgp rib best"
ze cli -c "show bgp irr check peer transit-a prefix 192.0.2.0/24"
ze cli -c "show bgp peer transit-b rib"

Confirm:

  1. The route is present or absent at the expected import boundary.
  2. The best-path result carries the intended local attributes.
  3. Exported attributes match the destination peer's policy.
  4. A rejected route does not reappear through redistribution.
  5. A policy reload completes without warnings or partial application.