Skip to content

Command Reference

Thomas Mangin edited this page Nov 15, 2025 · 7 revisions

Command Reference

A-Z alphabetical reference for all ExaBGP commands (API and configuration)

Complete command reference covering API commands, configuration directives, and operational commands.


Table of Contents


Overview

Command Types

ExaBGP has three types of commands:

Type Where Used Purpose Example
API Commands Process STDOUT β†’ ExaBGP STDIN Dynamic route control announce route 10.0.0.0/24 next-hop self
Configuration Directives Config file Static configuration neighbor 192.168.1.1 { }
CLI Commands Terminal/shell ExaBGP operation exabgp --test /etc/exabgp/exabgp.conf

API Command Format

All API commands are sent via STDOUT from your process to ExaBGP.

import sys

# Send command
sys.stdout.write("announce route 10.0.0.0/24 next-hop self\n")
sys.stdout.flush()  # CRITICAL: Always flush!

Rules:

  • βœ… Always end commands with \n
  • βœ… Always call sys.stdout.flush() after writing
  • βœ… Commands are case-sensitive
  • βœ… ExaBGP 4.x and 5.x send ACK responses by default (done, error, shutdown)
  • ℹ️ ACK can be disabled:
    • Environment variable: exabgp.api.ack=false (4.x and 5.x)
    • Runtime commands: disable-ack or silence-ack (5.x/main only)

API Commands

Route Announcement

announce route

Announce IPv4/IPv6 unicast route

Syntax:

announce route <prefix> next-hop <ip> [attributes]

Examples:

# Basic IPv4
announce route 10.0.0.0/24 next-hop self
announce route 10.0.0.0/24 next-hop 192.168.1.1

# Basic IPv6
announce route 2001:db8::/64 next-hop 2001:db8::1
announce route 2001:db8::/64 next-hop self

# With attributes
announce route 10.0.0.0/24 next-hop self community [65001:100]
announce route 10.0.0.0/24 next-hop self as-path [65001 65002]
announce route 10.0.0.0/24 next-hop self local-preference 200
announce route 10.0.0.0/24 next-hop self med 50
announce route 10.0.0.0/24 next-hop self origin igp

# Combined attributes
announce route 10.0.0.0/24 next-hop self local-preference 200 community [65001:100] as-path [65001]

Attributes:

  • next-hop self - Use local router IP
  • next-hop <ip> - Explicit next-hop
  • community [<asn>:<value>] - BGP communities
  • large-community [<asn>:<v1>:<v2>] - Large communities (RFC 8092)
  • as-path [<asn> ...] - AS path
  • local-preference <n> - Local preference (higher = preferred)
  • med <n> - Multi-Exit Discriminator (lower = preferred)
  • origin igp|egp|incomplete - Origin attribute

See also: Text API Reference, Attribute Reference


announce flow

Announce FlowSpec rule

Syntax:

announce flow route { match { <conditions> } then { <actions> } }

Examples:

# Block TCP port 80 from 10.0.0.0/8
announce flow route { match { source 10.0.0.0/8; destination-port =80; protocol =tcp; } then { discard; } }

# Rate limit UDP traffic to 1 Mbps
announce flow route { match { destination 192.168.1.0/24; protocol =udp; } then { rate-limit 1000000; } }

# Redirect traffic to VRF
announce flow route { match { source 10.0.0.0/8; } then { redirect 65001:100; } }

# Mark DSCP
announce flow route { match { source 10.0.0.0/8; } then { mark 10; } }

# Complex rule with multiple conditions
announce flow route { match { source 10.0.0.0/8; destination 192.168.0.0/16; destination-port [ =80 =443 ]; protocol =tcp; } then { discard; community [65001:666]; } }

Match Conditions:

  • source <prefix> - Source IP prefix
  • destination <prefix> - Destination IP prefix
  • port [=<port>] - Any port (source or destination)
  • source-port [=<port>] - Source port
  • destination-port [=<port>] - Destination port
  • protocol [=<proto>] - Protocol (tcp, udp, icmp, or number)
  • packet-length [>N&<M] - Packet length range
  • tcp-flags [SYN ACK] - TCP flags
  • fragment [first-fragment] - Fragment type

Actions:

  • discard - Drop traffic
  • rate-limit <bps> - Rate limit in bits/second
  • redirect <asn>:<value> - Redirect to VRF
  • redirect <ip> - Redirect to IP
  • mark <dscp> - Mark DSCP value
  • community [<asn>:<value>] - Add community
  • action sample|terminal - FlowSpec action flags

See also: FlowSpec Overview, Match Conditions, Actions Reference


announce vpnv4

Announce VPNv4 (L3VPN) route

Syntax:

announce vpnv4 <prefix> rd <rd> next-hop <ip> [attributes]

Examples:

# Basic VPNv4
announce vpnv4 10.0.0.0/24 rd 65001:100 next-hop self extended-community [target:65001:100]

# With label
announce vpnv4 10.0.0.0/24 rd 65001:100 next-hop self label 100 extended-community [target:65001:100]

# Multiple Route Targets
announce vpnv4 10.0.0.0/24 rd 65001:100 next-hop self extended-community [target:65001:100 target:65001:200]

Route Distinguisher formats:

  • <asn>:<value> - 2-byte ASN format (e.g., 65001:100)
  • <ip>:<value> - IPv4 format (e.g., 192.168.1.1:100)
  • <4byte-asn>:<value> - 4-byte ASN format (e.g., 4200000000:100)

See also: L3VPN Overview


announce vpnv6

Announce VPNv6 (L3VPN IPv6) route

Syntax:

announce vpnv6 <prefix> rd <rd> next-hop <ip> [attributes]

Examples:

# Basic VPNv6
announce vpnv6 2001:db8::/64 rd 65001:100 next-hop 2001:db8::1 extended-community [target:65001:100]

See also: L3VPN Overview


announce vpls

Announce VPLS (L2VPN) route

Syntax:

announce vpls <endpoint> <offset> <size> rd <rd> [attributes]

Examples:

announce vpls 10 10 1500 rd 65001:100 extended-community [target:65001:100]

See also: VPLS Configuration


Route Withdrawal

withdraw route

Withdraw IPv4/IPv6 unicast route

Syntax:

withdraw route <prefix> [next-hop <ip>]

Examples:

# Withdraw IPv4
withdraw route 10.0.0.0/24
withdraw route 10.0.0.0/24 next-hop 192.168.1.1

# Withdraw IPv6
withdraw route 2001:db8::/64
withdraw route 2001:db8::/64 next-hop 2001:db8::1

Note: If multiple routes with different next-hops exist for the same prefix, you must specify the next-hop to withdraw a specific one.

See also: Text API Reference


withdraw flow

Withdraw FlowSpec rule

Syntax:

withdraw flow route { match { <conditions> } }

Examples:

# Withdraw by exact match
withdraw flow route { match { source 10.0.0.0/8; destination-port =80; protocol =tcp; } }

# The match conditions must EXACTLY match the announced rule

Important: You must specify the exact same match conditions used in the original announcement.

See also: FlowSpec Overview


withdraw vpnv4

Withdraw VPNv4 route

Syntax:

withdraw vpnv4 <prefix> rd <rd> [next-hop <ip>]

Examples:

withdraw vpnv4 10.0.0.0/24 rd 65001:100
withdraw vpnv4 10.0.0.0/24 rd 65001:100 next-hop 192.168.1.1

withdraw vpnv6

Withdraw VPNv6 route

Syntax:

withdraw vpnv6 <prefix> rd <rd> [next-hop <ip>]

Examples:

withdraw vpnv6 2001:db8::/64 rd 65001:100

Operational Commands

flush route

Flush all announced routes (ExaBGP 5.x/main only)

Syntax:

flush route

Examples:

# Withdraw all previously announced routes
flush route

Availability: ExaBGP 5.x/main only (not in 4.x)

Use case: Clean slate - withdraw all routes before announcing new set


shutdown

Shut down BGP session

Syntax:

shutdown

Examples:

# Gracefully shut down BGP session
shutdown

Behavior:

  • Sends BGP NOTIFICATION message
  • Closes BGP session gracefully
  • ExaBGP process continues running (session can restart)

See also: Debugging Guide


Control Commands

eor

Send End-of-RIB (EoR) marker

Syntax:

eor

Examples:

# Signal end of initial route announcements
eor

Purpose: Signals to BGP peer that initial route convergence is complete.

Automatic EoR: ExaBGP normally sends EoR automatically. Use manual EoR when you need fine-grained control (e.g., staggered announcements).

See also: Configuration Example, Manual EOR Example


Configuration Directives

Configuration file directives for static configuration.

Global Directives

[exabgp.api]

API configuration section

Syntax:

[exabgp.api]
ack = true|false
encoder = text|json

Examples:

[exabgp.api]
ack = true          # Enable command acknowledgment (5.x/main only)
encoder = text      # Default encoder: text or json

See also: Directives Reference


[exabgp.daemon]

Daemon mode configuration

Syntax:

[exabgp.daemon]
daemonize = true|false
pid = <path>
user = <username>

Examples:

[exabgp.daemon]
daemonize = true
pid = /var/run/exabgp.pid
user = exabgp

[exabgp.log]

Logging configuration

Syntax:

[exabgp.log]
destination = stdout|syslog|<file-path>
level = DEBUG|INFO|WARNING|ERROR|CRITICAL
all = true|false
configuration = true|false
reactor = true|false
processes = true|false
network = true|false
packets = true|false
message = true|false
rib = true|false

Examples:

[exabgp.log]
destination = /var/log/exabgp.log
level = INFO
packets = true
message = true
network = true

See also: Debugging Guide


Neighbor Directives

neighbor

Define BGP neighbor

Syntax:

neighbor <ip> {
    <neighbor-directives>
}

Examples:

neighbor 192.168.1.1 {
    description "Primary BGP peer";
    router-id 192.168.1.2;
    local-address 192.168.1.2;
    local-as 65001;
    peer-as 65000;
}

See also: Configuration Syntax


router-id

BGP router identifier

Syntax:

router-id <ipv4-address>

Examples:

router-id 192.168.1.2;
router-id 10.0.0.1;

Note: Must be a valid IPv4 address (even for IPv6-only sessions).


local-address

Local IP address to bind

Syntax:

local-address <ip>

Examples:

local-address 192.168.1.2;
local-address 2001:db8::1;

local-as

Local Autonomous System Number

Syntax:

local-as <asn>

Examples:

local-as 65001;
local-as 4200000000;  # 4-byte ASN

peer-as

Peer Autonomous System Number

Syntax:

peer-as <asn>

Examples:

peer-as 65000;
peer-as 4200000000;  # 4-byte ASN

hold-time

BGP hold time (seconds)

Syntax:

hold-time <seconds>

Examples:

hold-time 180;   # 3 minutes (common)
hold-time 90;    # 1.5 minutes
hold-time 240;   # 4 minutes

Default: 180 seconds

Keepalive: Automatically set to 1/3 of hold-time


md5-password

TCP MD5 authentication

Syntax:

md5-password <password>

Examples:

md5-password "MySecretPassword123";

See also: Security Best Practices, Example


ttl-security

TTL security (Generalized TTL Security Mechanism)

Syntax:

ttl-security <hops>

Examples:

ttl-security 1;   # Direct connection
ttl-security 255; # Disable TTL security

See also: Security Best Practices, Example


Family Directives

family

Address family configuration

Syntax:

family {
    <afi> <safi>;
}

Examples:

family {
    ipv4 unicast;
    ipv4 multicast;
    ipv4 flow;
    ipv4 flow-vpn;
    ipv4 nlri-mpls;
    ipv6 unicast;
    ipv6 flow;
    l3vpn ipv4;
    l3vpn ipv6;
    l2vpn vpls;
    l2vpn evpn;
    bgp-ls bgp-ls;
}

Common AFI/SAFI combinations:

  • ipv4 unicast - IPv4 routing
  • ipv6 unicast - IPv6 routing
  • ipv4 flow - FlowSpec IPv4
  • ipv6 flow - FlowSpec IPv6
  • l3vpn ipv4 - VPNv4 (MPLS L3VPN)
  • l3vpn ipv6 - VPNv6
  • l2vpn vpls - VPLS
  • l2vpn evpn - EVPN
  • bgp-ls bgp-ls - BGP-LS

See also: Address Families, Configuration Reference


Process Directives

process

Define API process

Syntax:

process <name> {
    run <command>;
    encoder text|json;
}

Examples:

process announce-routes {
    run /etc/exabgp/api/announce.py;
    encoder text;
}

process healthcheck {
    run python3 -m exabgp healthcheck --cmd "curl http://localhost";
    encoder text;
}

See also: Process Configuration, API Overview


run

Process command to execute

Syntax:

run <command> [arguments];

Examples:

run /etc/exabgp/api/announce.py;
run python3 /etc/exabgp/api/healthcheck.py --interval 5;
run python3 -m exabgp healthcheck --cmd "curl http://localhost";

encoder

Process encoder (text or json)

Syntax:

encoder text|json;

Examples:

encoder text;  # Use text API format
encoder json;  # Use JSON API format

Default: text

See also: Text API Reference, JSON API Reference


Static Route Directives

static

Static route block

Syntax:

static {
    route <prefix> {
        <attributes>
    }
}

Examples:

static {
    route 10.0.0.0/24 {
        next-hop 192.168.1.1;
        community [65001:100];
    }

    route 10.0.1.0/24 next-hop 192.168.1.1;  # Compact syntax
}

flow

FlowSpec block

Syntax:

flow {
    route <name> {
        match { <conditions> }
        then { <actions> }
    }
}

Examples:

flow {
    route block-attack {
        match {
            source 10.0.0.0/8;
            destination-port =80;
            protocol tcp;
        }
        then {
            discard;
            community [65001:666];
        }
    }
}

See also: FlowSpec Overview, Configuration Example


CLI Commands

Commands for running and managing ExaBGP from the terminal.

exabgp

Run ExaBGP with configuration file

Syntax:

exabgp [options] <config-file>

Examples:

# Run with configuration
exabgp /etc/exabgp/exabgp.conf

# Run in foreground with debug output
exabgp /etc/exabgp/exabgp.conf -d

# Test configuration (syntax check)
exabgp /etc/exabgp/exabgp.conf --test

# Run with specific environment file
env exabgp.env.config=/etc/exabgp/exabgp.env exabgp /etc/exabgp/exabgp.conf

Options:

  • -d, --debug - Enable debug output
  • --test - Test configuration and exit
  • -h, --help - Show help message
  • -v, --version - Show version

See also: Installation Guide, Quick Start


exabgpcli

ExaBGP command-line interface

Syntax:

exabgpcli [command]

Examples:

# Show version
exabgpcli version

# Show neighbors
exabgpcli neighbor

# Show routes
exabgpcli route

Note: Requires ExaBGP to be running.

See also: ExaBGP CLI Documentation


Alphabetical Quick Reference

Complete A-Z listing of all commands and directives.

Command/Directive Type Purpose
announce flow API Announce FlowSpec rule
announce route API Announce IPv4/IPv6 unicast route
announce vpls API Announce VPLS route
announce vpnv4 API Announce VPNv4 route
announce vpnv6 API Announce VPNv6 route
as-path Attribute AS path attribute
community Attribute BGP community attribute
description Config Neighbor description
encoder Config Process encoder (text/json)
eor API Send End-of-RIB marker
[exabgp.api] Config API configuration section
[exabgp.daemon] Config Daemon configuration
[exabgp.log] Config Logging configuration
exabgp CLI Run ExaBGP
exabgpcli CLI ExaBGP CLI tool
extended-community Attribute Extended community attribute
family Config Address family configuration
flow Config FlowSpec static configuration
flush route API Withdraw all routes (5.x only)
hold-time Config BGP hold time
large-community Attribute Large community attribute
local-address Config Local IP address
local-as Config Local AS number
local-preference Attribute Local preference attribute
md5-password Config MD5 authentication
med Attribute Multi-Exit Discriminator
neighbor Config BGP neighbor definition
next-hop Attribute Next-hop attribute
origin Attribute Origin attribute (igp/egp/incomplete)
peer-as Config Peer AS number
process Config API process definition
router-id Config BGP router ID
run Config Process command to execute
shutdown API Shut down BGP session
static Config Static route block
ttl-security Config TTL security (GTSM)
withdraw flow API Withdraw FlowSpec rule
withdraw route API Withdraw IPv4/IPv6 route
withdraw vpls API Withdraw VPLS route
withdraw vpnv4 API Withdraw VPNv4 route
withdraw vpnv6 API Withdraw VPNv6 route

Command Categories

By Function

Route Management

  • announce route - Announce unicast route
  • announce flow - Announce FlowSpec rule
  • announce vpnv4 / announce vpnv6 - Announce VPN routes
  • announce vpls - Announce VPLS route
  • withdraw route - Withdraw unicast route
  • withdraw flow - Withdraw FlowSpec rule
  • withdraw vpnv4 / withdraw vpnv6 - Withdraw VPN routes
  • flush route - Withdraw all routes

Session Control

  • shutdown - Shut down BGP session
  • eor - Send End-of-RIB marker

Configuration

  • neighbor - Define BGP neighbor
  • family - Configure address families
  • process - Define API process
  • static - Static routes
  • flow - FlowSpec rules

Attributes

  • next-hop - Next-hop configuration
  • as-path - AS path manipulation
  • community - Standard communities
  • large-community - Large communities
  • extended-community - Extended communities
  • local-preference - Local preference
  • med - Multi-Exit Discriminator
  • origin - Origin attribute

By ExaBGP Version

ExaBGP 4.x Commands

All basic commands supported:

  • announce route, withdraw route
  • announce flow, withdraw flow
  • announce vpnv4, withdraw vpnv4
  • shutdown
  • eor

Not supported in 4.x:

  • flush route (5.x only)
  • ack = true in [exabgp.api] (5.x only)

ExaBGP 5.x/main New Commands

  • flush route - Withdraw all routes
  • Command acknowledgment (ACK) feature
  • Enhanced JSON API format

See also: Migration from 4.x to 5.x


See Also

Documentation

Address Families

Operations

Examples


πŸ‘» Ghost written by Claude (Anthropic AI)

Clone this wiki locally