-
Notifications
You must be signed in to change notification settings - Fork 461
Environment Variables
ExaBGP can be configured using environment variables, providing an alternative to command-line arguments and allowing easy integration with containerized deployments.
- Overview
- Naming Convention
- Network & Connection (tcp.*)
- BGP Protocol (bgp.*)
- Daemon Control (daemon.*)
- Logging (log.*)
- API & Processes (api.*)
- Reactor Control (reactor.*)
- Caching (cache.*)
- Profiling & Debugging (profile., pdb., debug.*)
- Docker and Container Usage
- Examples
- See Also
Environment variables control ExaBGP's runtime behavior without modifying configuration files. They are especially useful for:
- Docker/Kubernetes deployments
- CI/CD pipelines
- Quick debugging sessions
- Overriding defaults without editing config
ExaBGP accepts two formats for environment variables:
| Format | Example | Notes |
|---|---|---|
| Dot notation (canonical) | exabgp.log.level=DEBUG |
Preferred in documentation |
| Underscore notation | exabgp_log_level=DEBUG |
Shell-friendly alternative |
Both formats work identically. The code checks both.
# These are equivalent:
env exabgp.log.level=DEBUG exabgp server config.conf
env exabgp_log_level=DEBUG exabgp server config.conf-
Default:
0 - Type: integer
- Description: Maximum TCP connection attempts per peer before giving up (0 = unlimited).
| Value | Behavior |
|---|---|
0 |
Daemon mode (default) — each peer retries indefinitely |
N > 0 |
Limited retry mode — each peer gives up after N failed connection attempts |
# Production: run forever
env exabgp.tcp.attempts=0 exabgp server config.conf
# Testing: exit after 50 failures
env exabgp.tcp.attempts=50 exabgp server config.conf- Default: (empty — disable listening)
- Type: space-separated IP list
- Description: Local IP addresses to bind to when listening for incoming BGP connections.
env exabgp.tcp.bind="127.0.0.1 ::1" exabgp server config.conf-
Default:
179 - Type: integer
- Description: TCP port for incoming BGP connections. Ports below 1024 require root.
env exabgp.tcp.port=1179 exabgp server config.conf-
Default:
0 - Type: integer
- Description: Delay route announcements until the minutes in the hour is a modulo of this number. Used for synchronized startup across multiple instances.
-
Default:
false - Type: boolean
-
Description: Only one TCP connection attempt per peer. Deprecated — use
tcp.attempts=1instead.
- Default: (empty)
- Type: boolean
- Description: EXPERIMENTAL — DO NOT USE. Unimplemented ACL feature.
-
Default:
60 - Type: integer (seconds)
- Description: How many seconds to wait for a BGP OPEN message after TCP connection is established.
env exabgp.bgp.openwait=30 exabgp server config.conf-
Default:
false - Type: boolean
- Description: Ignore peer configuration and make all peers passive (only accept incoming connections, never initiate).
-
Default:
false - Type: boolean
- Description: Run ExaBGP in the background as a daemon process.
env exabgp.daemon.daemonize=true exabgp server config.conf- Default: (empty)
- Type: string (file path)
- Description: Where to write the PID file.
env exabgp.daemon.pid=/var/run/exabgp.pid exabgp server config.conf-
Default:
nobody - Type: string (username)
- Description: User to drop privileges to after binding to ports.
-
Default:
true - Type: boolean
- Description: Drop privileges before forking API processes.
-
Default:
0137 - Type: octal
- Description: Daemon umask — governs permissions of log files and other created files.
-
Default:
true - Type: boolean
- Description: Enable logging to file or syslog.
-
Default:
INFO - Type: string
-
Values:
DEBUG,INFO,WARNING,ERROR,CRITICAL - Description: Minimum log level to display.
env exabgp.log.level=DEBUG exabgp server config.conf-
Default:
stdout - Type: string
- Description: Where to send log output.
| Value | Description |
|---|---|
stdout |
Standard output (default) |
stderr |
Standard error |
syslog |
Local syslog |
host:<location> |
Remote syslog server |
<filename> |
File path |
env exabgp.log.destination=/var/log/exabgp.log exabgp server config.conf
env exabgp.log.destination=syslog exabgp server config.conf-
Default:
true - Type: boolean
- Description: Use short log format (no timestamp, level, PID, or source prefix).
-
Default:
false - Type: boolean
- Description: Report debug information for everything (overrides individual log category settings below).
Fine-grained control over which subsystems produce log output:
| Variable | Default | Description |
|---|---|---|
log.configuration |
true |
Configuration file parsing |
log.reactor |
true |
Signal handling, reloads |
log.daemon |
true |
PID changes, forking |
log.processes |
true |
Forked process handling |
log.network |
true |
TCP/IP, network state |
log.statistics |
true |
Packet statistics |
log.packets |
false |
BGP packets (verbose!) |
log.rib |
false |
Local route changes |
log.message |
false |
Route announcements on reload |
log.timers |
false |
Keepalive timers |
log.routes |
false |
Received routes |
log.parser |
false |
BGP message parsing |
# Enable packet-level debugging
env exabgp.log.packets=true exabgp server config.conf
# Enable all log categories at once
env exabgp.log.all=true exabgp server config.conf-
Default:
true - Type: boolean
-
Description: Acknowledge API commands and report issues. When enabled, ExaBGP sends
doneor error responses after each command.
# Disable ACK for simple fire-and-forget scripts
env exabgp.api.ack=false exabgp server config.confNote: ACK can also be controlled at runtime with enable-ack, disable-ack, and silence-ack commands (5.x/6.x). See ACK Feature Documentation.
-
Default:
6 -
Type: integer (
4or6) -
Description: API format version. Version 6 uses structured JSON-only commands (
peer * announce route ...). Version 4 is the legacy format with text/JSON (announce route ...).
# Use legacy v4 API format
env exabgp.api.version=4 exabgp server config.conf-
Default:
json -
Type: string (
jsonortext) - Description: EXPERIMENTAL — Default encoder for external API communication.
-
Default:
false - Type: boolean
- Description: Use shorter JSON encoding for IPv4/IPv6 Unicast NLRI.
-
Default:
1 - Type: integer
-
Description: Maximum lines to print before yielding in
show routesAPI command.
-
Default:
true - Type: boolean
- Description: Automatically respawn API processes if they die.
-
Default:
false - Type: boolean
- Description: Terminate ExaBGP if any API process dies.
-
Default:
true - Type: boolean
- Description: Create a named pipe for CLI access.
-
Default:
exabgp - Type: string
- Description: Name to use for the ExaBGP named pipe (CLI).
-
Default:
exabgp - Type: string
- Description: Name to use for the ExaBGP Unix socket.
-
Default:
1.0 - Type: float
- Description: Reactor event loop speed multiplier. Lower values = faster loop. Use only if you understand the code.
-
Default:
true - Type: boolean
- Description: Cache all BGP attributes (configuration and wire format) for faster parsing.
-
Default:
true - Type: boolean
- Description: Cache route next-hops. Deprecated: next-hops are always cached regardless of this setting.
-
Default:
false - Type: boolean
- Description: Enable profiling of the code.
- Default: (empty)
- Type: string (file path)
- Description: Profiling result file. Empty means stdout. Does not overwrite existing files.
-
Default:
false - Type: boolean
- Description: On program fault, start Python interactive debugger (pdb).
-
Default:
false - Type: boolean
- Description: Enable Python debugger on errors.
-
Default:
false - Type: boolean
- Description: Enable memory debugging output.
-
Default:
false - Type: boolean
- Description: Raise exceptions on configuration parsing errors (instead of warnings).
-
Default:
false - Type: boolean
- Description: Perform self-check on the configuration file.
- Default: (empty)
- Type: string
- Description: Decode a specific route using the configuration.
-
Default:
false - Type: boolean
- Description: Generate random faults in the code intentionally (for testing fault tolerance).
-
Default:
false - Type: boolean
- Description: Rotate configuration files on reload (signal).
-
Default:
false - Type: boolean
- Description: Enable timing instrumentation for asyncio reactor performance analysis.
When enabled, logs warnings for slow operations:
- Main loop iterations > 100ms
- Peer message loop iterations > 50ms
- Peer establishment > 5000ms
env exabgp.debug.timing=true exabgp server config.confEnvironment variables are particularly useful in Docker/Kubernetes deployments:
Docker Compose:
services:
exabgp:
image: exabgp/exabgp:latest
environment:
- exabgp.daemon.daemonize=false
- exabgp.log.level=INFO
- exabgp.log.destination=stdout
- exabgp.api.ack=true
- exabgp.api.encoder=json
volumes:
- ./exabgp.conf:/etc/exabgp/exabgp.confKubernetes ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: exabgp-env
data:
exabgp.daemon.daemonize: "false"
exabgp.log.level: "INFO"
exabgp.api.encoder: "json"#!/bin/bash
export exabgp.daemon.daemonize=true
export exabgp.daemon.pid=/var/run/exabgp.pid
export exabgp.daemon.user=exabgp
export exabgp.log.level=INFO
export exabgp.log.destination=/var/log/exabgp.log
export exabgp.log.routes=true
export exabgp.api.ack=true
exabgp server /etc/exabgp/exabgp.conf#!/bin/bash
export exabgp.daemon.daemonize=false
export exabgp.log.level=DEBUG
export exabgp.log.destination=stdout
export exabgp.log.packets=true
export exabgp.log.routes=true
exabgp server /etc/exabgp/exabgp.conf#!/bin/bash
export exabgp.daemon.daemonize=false
export exabgp.log.level=WARNING
export exabgp.api.ack=false
exabgp server /etc/exabgp/exabgp.conf#!/bin/bash
export exabgp.cache.attributes=true
export exabgp.reactor.speed=0.5
export exabgp.log.level=WARNING
export exabgp.log.routes=false
exabgp server /etc/exabgp/exabgp.confAll environment variables at a glance:
| Variable | Default | Description |
|---|---|---|
| tcp.attempts | 0 |
Per-peer connection attempt limit (0=unlimited) |
| tcp.bind | (empty) | Local bind addresses |
| tcp.port | 179 |
BGP listen port |
| tcp.delay | 0 |
Startup delay modulo |
| tcp.once | false |
Single attempt (deprecated) |
| bgp.openwait | 60 |
OPEN wait timeout (seconds) |
| bgp.passive | false |
Passive-only mode |
| daemon.daemonize | false |
Background mode |
| daemon.pid | (empty) | PID file path |
| daemon.user | nobody |
Drop privileges to user |
| daemon.drop | true |
Drop privileges |
| daemon.umask | 0137 |
File creation mask |
| log.enable | true |
Enable logging |
| log.level | INFO |
Log level |
| log.destination | stdout |
Log output target |
| log.short | true |
Short log format |
| log.all | false |
Enable all log categories |
| log.configuration | true |
Log config parsing |
| log.reactor | true |
Log reactor events |
| log.daemon | true |
Log daemon events |
| log.processes | true |
Log process events |
| log.network | true |
Log network events |
| log.statistics | true |
Log statistics |
| log.packets | false |
Log BGP packets |
| log.rib | false |
Log RIB changes |
| log.message | false |
Log messages on reload |
| log.timers | false |
Log keepalive timers |
| log.routes | false |
Log received routes |
| log.parser | false |
Log message parsing |
| api.ack | true |
Command acknowledgment |
| api.version | 6 |
API format version (4 or 6) |
| api.encoder | json |
Default encoder |
| api.compact | false |
Compact JSON |
| api.chunk | 1 |
Show routes chunk size |
| api.respawn | true |
Respawn dead processes |
| api.terminate | false |
Exit on process death |
| api.cli | true |
Enable CLI pipe |
| api.pipename | exabgp |
CLI pipe name |
| api.socketname | exabgp |
Unix socket name |
| reactor.speed | 1.0 |
Event loop speed |
| cache.attributes | true |
Cache attributes |
| cache.nexthops | true |
Cache next-hops (deprecated) |
| profile.enable | false |
Enable profiling |
| profile.file | (empty) | Profile output file |
| pdb.enable | false |
PDB on fault |
| debug.pdb | false |
PDB on error |
| debug.memory | false |
Memory debugging |
| debug.configuration | false |
Strict config parsing |
| debug.selfcheck | false |
Config self-check |
| debug.route | (empty) | Route decode debug |
| debug.defensive | false |
Random fault injection |
| debug.rotate | false |
Rotate config on reload |
| debug.timing | false |
Timing instrumentation |
- Configuration Syntax - Configuration file format
- Directives Reference - All configuration directives
- API Overview - API programming guide
- Production Best Practices - Production deployment
- Debugging - Troubleshooting guide
- Monitoring - Production monitoring
- Log Analysis - Log file analysis
- Docker - Docker deployment
- Kubernetes - Kubernetes integration
Getting Started
Configuration
- Configuration Syntax
- Neighbor Configuration
- Directives A-Z
- Templates
- Environment Variables
- Process Configuration
API
- API Overview
- Text API Reference
- JSON API Reference
- API Commands
- Writing API Programs
- Error Handling
- Production Best Practices
Address Families
- Overview
- IPv4 Unicast
- IPv6 Unicast
- FlowSpec
- EVPN
- L3VPN
- BGP-LS
- VPLS
- SRv6 / MUP
- Multicast
- RT Constraint
Features
Use Cases
Tools
Operations
Reference
- Architecture
- Design
- Attribute Reference
- Command Reference
- BGP State Machine
- Capabilities
- Communities
- Examples Index
- Glossary
- RFC Support
Integration
Migration
Community
External