Skip to content

Environment Variables

Thomas Mangin edited this page Nov 15, 2025 · 1 revision

Environment Variables

ExaBGP can be configured using environment variables, providing an alternative to command-line arguments and allowing easy integration with containerized deployments.


Table of Contents


Overview

Environment variables in ExaBGP follow the naming convention:

exabgp.<section>.<option>

For example:

  • exabgp.daemon.daemonize - Run as daemon
  • exabgp.api.ack - Enable API acknowledgments
  • exabgp.log.level - Set log level

Core Variables

Process Configuration

exabgp.daemon.daemonize

  • Type: Boolean (true/false)
  • Default: false
  • Description: Run ExaBGP as a background daemon
export exabgp.daemon.daemonize=true

exabgp.daemon.pid

  • Type: String (file path)
  • Default: None
  • Description: PID file location
export exabgp.daemon.pid=/var/run/exabgp.pid

exabgp.daemon.user

  • Type: String (username)
  • Default: Current user
  • Description: User to run ExaBGP as (requires root)
export exabgp.daemon.user=exabgp

API Configuration

exabgp.api.ack

  • Type: Boolean (true/false)
  • Default: true
  • Description: Enable API command acknowledgments
  • Note: Can also be controlled at runtime with enable-ack/disable-ack commands (5.x/main)
export exabgp.api.ack=true   # Enable ACK (default)
export exabgp.api.ack=false  # Disable ACK (fire-and-forget mode)

exabgp.api.encoder

  • Type: String (text/json)
  • Default: text
  • Description: API message encoding format
export exabgp.api.encoder=json  # Use JSON format
export exabgp.api.encoder=text  # Use text format (default)

Logging Configuration

exabgp.log.level

  • Type: String
  • Values: DEBUG, INFO, WARNING, ERROR, CRITICAL
  • Default: INFO
  • Description: Minimum log level to display
export exabgp.log.level=DEBUG    # Verbose logging
export exabgp.log.level=WARNING  # Warnings and errors only

exabgp.log.destination

  • Type: String (file path or stdout/stderr/syslog)
  • Default: stdout
  • Description: Where to send log output
export exabgp.log.destination=/var/log/exabgp.log
export exabgp.log.destination=syslog

exabgp.log.packets

  • Type: Boolean (true/false)
  • Default: false
  • Description: Log BGP packets for debugging
export exabgp.log.packets=true  # Enable packet logging (verbose!)

exabgp.log.routes

  • Type: Boolean (true/false)
  • Default: false
  • Description: Log route updates
export exabgp.log.routes=true   # Log all route changes

BGP Configuration

exabgp.bgp.openwait

  • Type: Integer (seconds)
  • Default: 60
  • Description: How long to wait for BGP OPEN message
export exabgp.bgp.openwait=30

exabgp.tcp.bind

  • Type: String (IP address)
  • Default: Empty (bind to all)
  • Description: Local IP address to bind to
export exabgp.tcp.bind=192.168.1.10

exabgp.tcp.port

  • Type: Integer
  • Default: 179
  • Description: TCP port for BGP (requires root for port < 1024)
export exabgp.tcp.port=1179  # Non-privileged port

Advanced Variables

Performance Tuning

exabgp.cache.attributes

  • Type: Boolean (true/false)
  • Default: true
  • Description: Cache BGP attributes for memory efficiency

exabgp.cache.nexthops

  • Type: Boolean (true/false)
  • Default: true
  • Description: Cache next-hop information

Reactor Configuration

exabgp.reactor.speed

  • Type: Float (seconds)
  • Default: 1.0
  • Description: Main event loop sleep time

Docker and Container Usage

Environment variables are particularly useful in Docker/Kubernetes deployments:

Docker Compose example:

version: '3'
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.conf
      - ./run:/etc/exabgp/run

Kubernetes ConfigMap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: exabgp-env
data:
  exabgp.daemon.daemonize: "false"
  exabgp.log.level: "INFO"
  exabgp.api.encoder: "json"

Examples

Example 1: Production Daemon

#!/bin/bash
# Production ExaBGP with logging and ACK enabled

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
export exabgp.api.encoder=text

exabgp /etc/exabgp/exabgp.conf

Example 2: Development/Debug Mode

#!/bin/bash
# Debug mode with verbose logging

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

export exabgp.api.ack=true
export exabgp.api.encoder=json

exabgp /etc/exabgp/exabgp.conf

Example 3: Simple Fire-and-Forget API

#!/bin/bash
# Minimal configuration for simple API programs

export exabgp.daemon.daemonize=false
export exabgp.log.level=WARNING
export exabgp.api.ack=false  # No ACK responses

exabgp /etc/exabgp/exabgp.conf

Example 4: High-Performance Setup

#!/bin/bash
# Optimized for performance

export exabgp.cache.attributes=true
export exabgp.cache.nexthops=true
export exabgp.reactor.speed=0.5
export exabgp.log.level=WARNING
export exabgp.log.routes=false

exabgp /etc/exabgp/exabgp.conf

See Also

Configuration

API

Operations

Deployment


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

Clone this wiki locally