-
Notifications
You must be signed in to change notification settings - Fork 460
Command Reference
A-Z alphabetical reference for all ExaBGP commands (API and configuration)
Complete command reference covering API commands, configuration directives, and operational commands.
- Overview
- API Commands
- Configuration Directives
- CLI Commands
- Alphabetical Quick Reference
- Command Categories
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 |
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-ackorsilence-ack(5.x/main only)
- Environment variable:
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 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 (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 (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 (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
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::1Note: 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 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 ruleImportant: You must specify the exact same match conditions used in the original announcement.
See also: FlowSpec Overview
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.1Withdraw VPNv6 route
Syntax:
withdraw vpnv6 <prefix> rd <rd> [next-hop <ip>]
Examples:
withdraw vpnv6 2001:db8::/64 rd 65001:100Flush all announced routes (ExaBGP 5.x/main only)
Syntax:
flush route
Examples:
# Withdraw all previously announced routes
flush routeAvailability: ExaBGP 5.x/main only (not in 4.x)
Use case: Clean slate - withdraw all routes before announcing new set
Shut down BGP session
Syntax:
shutdown
Examples:
# Gracefully shut down BGP session
shutdownBehavior:
- Sends BGP NOTIFICATION message
- Closes BGP session gracefully
- ExaBGP process continues running (session can restart)
See also: Debugging Guide
Send End-of-RIB (EoR) marker
Syntax:
eor
Examples:
# Signal end of initial route announcements
eorPurpose: 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 file directives for static configuration.
API configuration section
Syntax:
[exabgp.api]
ack = true|false
encoder = text|jsonExamples:
[exabgp.api]
ack = true # Enable command acknowledgment (5.x/main only)
encoder = text # Default encoder: text or jsonSee also: Directives Reference
Daemon mode configuration
Syntax:
[exabgp.daemon]
daemonize = true|false
pid = <path>
user = <username>Examples:
[exabgp.daemon]
daemonize = true
pid = /var/run/exabgp.pid
user = exabgpLogging 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|falseExamples:
[exabgp.log]
destination = /var/log/exabgp.log
level = INFO
packets = true
message = true
network = trueSee also: Debugging Guide
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
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 IP address to bind
Syntax:
local-address <ip>Examples:
local-address 192.168.1.2;
local-address 2001:db8::1;Local Autonomous System Number
Syntax:
local-as <asn>Examples:
local-as 65001;
local-as 4200000000; # 4-byte ASNPeer Autonomous System Number
Syntax:
peer-as <asn>Examples:
peer-as 65000;
peer-as 4200000000; # 4-byte ASNBGP hold time (seconds)
Syntax:
hold-time <seconds>Examples:
hold-time 180; # 3 minutes (common)
hold-time 90; # 1.5 minutes
hold-time 240; # 4 minutesDefault: 180 seconds
Keepalive: Automatically set to 1/3 of hold-time
TCP MD5 authentication
Syntax:
md5-password <password>Examples:
md5-password "MySecretPassword123";See also: Security Best Practices, Example
TTL security (Generalized TTL Security Mechanism)
Syntax:
ttl-security <hops>Examples:
ttl-security 1; # Direct connection
ttl-security 255; # Disable TTL securitySee also: Security Best Practices, Example
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
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
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";Process encoder (text or json)
Syntax:
encoder text|json;Examples:
encoder text; # Use text API format
encoder json; # Use JSON API formatDefault: text
See also: Text API Reference, JSON API Reference
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
}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
Commands for running and managing ExaBGP from the terminal.
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.confOptions:
-
-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
ExaBGP command-line interface
Syntax:
exabgpcli [command]Examples:
# Show version
exabgpcli version
# Show neighbors
exabgpcli neighbor
# Show routes
exabgpcli routeNote: Requires ExaBGP to be running.
See also: ExaBGP CLI Documentation
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 |
-
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
-
shutdown- Shut down BGP session -
eor- Send End-of-RIB marker
-
neighbor- Define BGP neighbor -
family- Configure address families -
process- Define API process -
static- Static routes -
flow- FlowSpec rules
-
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
All basic commands supported:
-
announce route,withdraw route -
announce flow,withdraw flow -
announce vpnv4,withdraw vpnv4 shutdowneor
Not supported in 4.x:
-
flush route(5.x only) -
ack = truein[exabgp.api](5.x only)
-
flush route- Withdraw all routes - Command acknowledgment (ACK) feature
- Enhanced JSON API format
See also: Migration from 4.x to 5.x
- API Overview - API architecture and concepts
- Text API Reference - Complete text API
- JSON API Reference - Complete JSON API
- Configuration Syntax - Configuration file syntax
- Directives Reference - All configuration directives
- Attribute Reference - All BGP attributes
- IPv4/IPv6 Unicast - Basic routing
- FlowSpec - DDoS mitigation
- L3VPN - MPLS VPNs
- EVPN - Data center fabrics
- Debugging Guide - Troubleshooting
- Monitoring Guide - Production monitoring
- Examples Index - Browse all 86 configuration examples
- API Examples - 37 API examples
- Configuration Examples - 35 static config examples
π» Ghost written by Claude (Anthropic AI)
π Home
π Getting Started
π§ API
π‘οΈ Use Cases
π Address Families
βοΈ Configuration
π Operations
π Reference
- Architecture
- BGP State Machine
- Communities (RFC)
- Extended Communities
- BGP Ecosystem
- Capabilities (AFI/SAFI)
- RFC Support
π Migration
π Community
π External
- GitHub Repo β
- Slack β
- Issues β
π» Ghost written by Claude (Anthropic AI)