Skip to content

bgp redistribute

Thomas Mangin edited this page May 17, 2026 · 2 revisions

Pre-Alpha. This page describes behavior that may change.

Cross-protocol route redistribution. Imports routes from non-BGP sources (static, connected, kernel, l2tp, ospf) into BGP for advertisement to peers.

Category

Policy.

Configuration

redistribute {
    destination bgp {
        import static { }
        import kernel { }
        import l2tp {
            family [ ipv4/unicast ipv6/unicast ];
        }
        import connected { }
    }
}

Each destination protocol has its own container. Each import entry names a registered source. The family leaf-list restricts which address families are imported (empty means all).

Available sources

Source What it redistributes
static Static routes configured under static { }.
kernel Externally-installed kernel routes (DHCP, PPP, manual). Filters RTPROT_KERNEL and RTPROT_REDIRECT.
connected Directly connected interface subnets.
l2tp Subscriber routes from L2TP/PPP sessions.

The kernel source uses a shared routewatch infrastructure that subscribes to netlink route notifications. It filters out routes owned by Ze itself (identified by RTPROT_ZE), so only externally-installed routes are redistributed. Routes are tracked and withdrawn automatically when removed from the kernel table.

Architecture

The redistribute system has two plugins:

  • redistribute-egress (orchestrator): discovers producers at startup, subscribes to route events, dispatches to registered consumers.
  • redistribute-ingress: ingress filter with loop prevention and family filtering.

Producers (static, kernel, l2tp, connected) register themselves with the orchestrator. Consumers (bgp) subscribe to receive redistributed routes.

The kernel redistribute plugin (internal/plugins/kernel/) registers as a routewatch consumer. The shared routewatch infrastructure (internal/core/routewatch/) provides netlink route subscription with synchronous fanout to all registered consumers, halving syscall and parsing cost compared to per-plugin subscriptions.

See also

Source

internal/component/bgp/plugins/redistribute_ingress/, internal/component/bgp/plugins/redistribute_egress/, internal/plugins/kernel/

Home

About

First Steps

Configuration

Operation

Interfaces

Plugins

Plugin Development

Chaos Testing

Blueprints

Development

Reference

Clone this wiki locally