Repository navigation
Use Cases Financial Services
ExaBGP enables low-latency, high-reliability networking for financial services including trading platforms, market data distribution, and compliance requirements.
- Overview
- Low-Latency Trading Networks
- Market Data Distribution
- Compliance and Security
- Configuration Examples
- See Also
Financial services networking demands:
- Ultra-low latency: Microseconds matter for high-frequency trading
- High reliability: 99.999% uptime for trading systems
- Deterministic routing: Predictable network paths
- Market data distribution: Efficient multicast for price feeds
- Security: Network segmentation, encryption, audit trails
- Compliance: Regulatory requirements (MiFID II, SEC, etc.)
- Geographic distribution: Connect to multiple exchanges globally
ExaBGP enables:
- Anycast for trading systems: Automatic failover between trading engines
- Market data routing: Announce the sources of multicast price feeds with multicast BGP
- Exchange connectivity: Manage routes to multiple exchanges
- Network segmentation: Isolate trading, market data, and corporate networks
- Disaster recovery: Instant failover between data centers
Important: ExaBGP announces routes but does NOT manipulate kernel routing tables. Ensure your routing daemon or application handles route installation for forwarding.
Multiple trading engines share one IP for instant failover. The health checker shipped with ExaBGP runs the check, here every 100ms with a decision after a single result:
process trading-monitor {
run exabgp healthcheck --name trading --cmd "timeout 0.05 nc -z 127.0.0.1 7000" --ip 10.1.1.100/32 --next-hop 10.0.0.1 --interval 0.1 --fast-interval 0.1 --rise 1 --fall 1 --withdraw-on-down;
encoder text;
}The checker's own --timeout counts whole seconds, so the shorter limit on the connection is set in the command with timeout. The checker starts the command for every check, which limits how short the interval can usefully be. Healthcheck describes every option.
Manage routes to multiple exchanges. The programs on this page read ExaBGP's answer (done or error) after each command they write, with the send() function from Reading the answers. ExaBGP 6.0 writes these commands with a peer * selector, see How a program talks to ExaBGP.
#!/usr/bin/env python3
import sys
def send(command):
"""Write one command, then read lines until ExaBGP answers it"""
sys.stdout.write(command + "\n")
sys.stdout.flush()
while True:
line = sys.stdin.readline()
if not line: # ExaBGP closed the pipe: it is stopping
sys.exit(0)
answer = line.strip()
if answer == 'done':
return True
if answer == 'error':
return False
# Exchange connections
EXCHANGES = {
'NYSE': {
'prefix': '198.51.100.0/24',
'next_hop': '10.1.0.1',
'community': '65000:1', # Primary link
'local_pref': 200
},
'NASDAQ': {
'prefix': '203.0.113.0/24',
'next_hop': '10.1.0.2',
'community': '65000:2',
'local_pref': 200
},
'CME': {
'prefix': '192.0.2.0/24',
'next_hop': '10.1.0.3',
'community': '65000:3',
'local_pref': 200
}
}
# Announce exchange routes with high local preference
for exchange, config in EXCHANGES.items():
send(f"announce route {config['prefix']} "
f"next-hop {config['next_hop']} "
f"community [{config['community']}] "
f"local-preference {config['local_pref']}")
while True:
line = sys.stdin.readline().strip()
if not line:
breakAchieve very fast failover using BFD-like health checks: a program sends a UDP probe to the trading engine (HEALTH to 127.0.0.1:9000, expecting OK within a millisecond) every 10ms, announces 10.1.1.100/32 while the engine answers, and withdraws it after 3 consecutive failures.
Starting a command every 10ms is more than the health checker shipped with ExaBGP is built for, so this needs a program of your own which probes in-process. Writing API Programs gives templates for such a program, which only need their check replaced, and which read ExaBGP's answer after each command.
Multicast BGP (the ipv4 multicast family) does not carry multicast groups. It carries the unicast prefixes of the sources, which routers use for the reverse path forwarding (RPF) check of PIM, so that the routers can build the multicast tree for a feed along a path other than the unicast one. The groups themselves remain PIM's business. This program announces the address of each feed's source once, in the ipv4 multicast family, which the neighbour has to list in its family block:
#!/usr/bin/env python3
import sys
def send(command):
"""Write one command, then read lines until ExaBGP answers it"""
sys.stdout.write(command + "\n")
sys.stdout.flush()
while True:
line = sys.stdin.readline()
if not line: # ExaBGP closed the pipe: it is stopping
sys.exit(0)
answer = line.strip()
if answer == 'done':
return True
if answer == 'error':
return False
# Market data feeds: the multicast group, and the source sending it
MARKET_DATA = {
'level1': {'group': '239.1.1.1', 'source': '10.1.1.1'},
'level2': {'group': '239.1.1.2', 'source': '10.1.1.1'},
'options': {'group': '239.1.1.3', 'source': '10.1.1.1'},
}
NEXT_HOP = "10.1.1.1"
COMMUNITY = "65000:100"
# Announce each source once, in the IPv4 multicast family (SAFI 2)
for source in sorted({config['source'] for config in MARKET_DATA.values()}):
send(f"announce ipv4 multicast {source}/32 "
f"next-hop {NEXT_HOP} "
f"community [{COMMUNITY}]")
while True:
line = sys.stdin.readline().strip()
if not line:
breakRoute market data to regional offices:
#!/usr/bin/env python3
import sys
def send(command):
"""Write one command, then read lines until ExaBGP answers it"""
sys.stdout.write(command + "\n")
sys.stdout.flush()
while True:
line = sys.stdin.readline()
if not line: # ExaBGP closed the pipe: it is stopping
sys.exit(0)
answer = line.strip()
if answer == 'done':
return True
if answer == 'error':
return False
# Regional market data servers
REGIONS = {
'us-east': {
'prefix': '10.100.1.0/24',
'next_hop': '10.1.0.1',
'community': '65000:1',
'med': 10 # Prefer this path for US traders
},
'eu-london': {
'prefix': '10.100.2.0/24',
'next_hop': '10.2.0.1',
'community': '65000:2',
'med': 10 # Prefer for EU traders
},
'apac-tokyo': {
'prefix': '10.100.3.0/24',
'next_hop': '10.3.0.1',
'community': '65000:3',
'med': 10 # Prefer for APAC traders
}
}
# Announce with geographic communities
for region, config in REGIONS.items():
send(f"announce route {config['prefix']} "
f"next-hop {config['next_hop']} "
f"community [{config['community']}] "
f"med {config['med']}")
while True:
line = sys.stdin.readline().strip()
if not line:
breakIsolate trading, market data, and corporate networks:
#!/usr/bin/env python3
import sys
def send(command):
"""Write one command, then read lines until ExaBGP answers it"""
sys.stdout.write(command + "\n")
sys.stdout.flush()
while True:
line = sys.stdin.readline()
if not line: # ExaBGP closed the pipe: it is stopping
sys.exit(0)
answer = line.strip()
if answer == 'done':
return True
if answer == 'error':
return False
# Network segments per compliance requirements
SEGMENTS = {
'trading': {
'vrf': 'TRADING',
'prefix': '10.1.0.0/16',
'rd': '10.0.0.1:1',
'rt': '65000:1',
'label': 100
},
'market-data': {
'vrf': 'MKTDATA',
'prefix': '10.2.0.0/16',
'rd': '10.0.0.1:2',
'rt': '65000:2',
'label': 101
},
'corporate': {
'vrf': 'CORP',
'prefix': '10.3.0.0/16',
'rd': '10.0.0.1:3',
'rt': '65000:3',
'label': 102
},
'dmz': {
'vrf': 'DMZ',
'prefix': '10.4.0.0/16',
'rd': '10.0.0.1:4',
'rt': '65000:4',
'label': 103
}
}
NEXT_HOP = "10.0.0.1"
# Announce segments with VRF isolation (ipv4 mpls-vpn routes need a label)
for segment, config in SEGMENTS.items():
send(f"announce route {config['prefix']} "
f"next-hop {NEXT_HOP} "
f"route-distinguisher {config['rd']} "
f"label {config['label']} "
f"extended-community [target:{config['rt']}]")
while True:
line = sys.stdin.readline().strip()
if not line:
breakLog all BGP route changes for compliance:
#!/usr/bin/env python3
import sys
import json
import logging
from datetime import datetime
def send(command):
"""Write one command, then read lines until ExaBGP answers it"""
sys.stdout.write(command + "\n")
sys.stdout.flush()
while True:
line = sys.stdin.readline()
if not line: # ExaBGP closed the pipe: it is stopping
sys.exit(0)
answer = line.strip()
if answer == 'done':
return True
if answer == 'error':
return False
# Compliance logging
logging.basicConfig(
filename='/var/log/bgp-audit.log',
level=logging.INFO,
format='%(message)s'
)
def log_route_change(action, route, next_hop, timestamp):
"""Log route changes with timestamp for audit"""
audit_entry = {
'timestamp': timestamp,
'action': action,
'route': route,
'next_hop': next_hop,
'source': 'exabgp'
}
logging.info(json.dumps(audit_entry))
TRADING_IP = "10.1.1.100/32"
NEXT_HOP = "10.0.0.1"
# Announce with audit
timestamp = datetime.utcnow().isoformat()
send(f"announce route {TRADING_IP} next-hop {NEXT_HOP}")
log_route_change('announce', TRADING_IP, NEXT_HOP, timestamp)
# Process updates and log
while True:
line = sys.stdin.readline().strip()
if not line:
break
try:
data = json.loads(line)
# Log received route updates
timestamp = datetime.utcnow().isoformat()
logging.info(json.dumps({'timestamp': timestamp, 'update': data}))
except:
passUse FlowSpec to block malicious traffic:
#!/usr/bin/env python3
import sys
def send(command):
"""Write one command, then read lines until ExaBGP answers it"""
sys.stdout.write(command + "\n")
sys.stdout.flush()
while True:
line = sys.stdin.readline()
if not line: # ExaBGP closed the pipe: it is stopping
sys.exit(0)
answer = line.strip()
if answer == 'done':
return True
if answer == 'error':
return False
def block_malicious_ip(attacker_ip):
"""Block attacker IP using FlowSpec"""
send(f"announce flow route "
f"{{ match {{ source {attacker_ip}/32; }} "
f"then {{ discard; }} }}")
def rate_limit_suspicious(source_ip, rate_kbps):
"""Rate limit suspicious traffic"""
# rate-limit is in bytes per second
send(f"announce flow route "
f"{{ match {{ source {source_ip}/32; }} "
f"then {{ rate-limit {rate_kbps * 1000 // 8}; }} }}")
# Example: Block detected DDoS source
block_malicious_ip("192.0.2.100")
# Example: Rate limit suspicious trading client
rate_limit_suspicious("203.0.113.50", 1000)
while True:
line = sys.stdin.readline().strip()
if not line:
breakConfiguration (/etc/exabgp/trading.conf):
process trading-monitor {
run exabgp healthcheck --name trading --cmd "timeout 0.05 nc -z 127.0.0.1 7000" --ip 10.1.1.100/32 --next-hop 10.0.0.1 --interval 0.1 --fast-interval 0.1 --rise 1 --fall 1 --withdraw-on-down;
encoder text;
}
# Connection to core switches
neighbor 10.0.0.1 {
router-id 10.1.1.1;
local-address 10.1.1.1;
local-as 65001;
peer-as 65001;
family {
ipv4 unicast;
ipv4 flow;
}
# Fast convergence
hold-time 9;
api {
processes [ trading-monitor ];
}
}
neighbor 10.0.0.2 {
router-id 10.1.1.1;
local-address 10.1.1.1;
local-as 65001;
peer-as 65001;
family {
ipv4 unicast;
ipv4 flow;
}
hold-time 9;
api {
processes [ trading-monitor ];
}
}Connect trading sites globally:
process global-trading {
run python3 /etc/exabgp/global-announce.py;
encoder json;
}
# Local site connection
neighbor 10.1.0.1 {
router-id 10.1.1.1;
local-address 10.1.1.1;
local-as 65001;
peer-as 65001;
family {
ipv4 unicast;
ipv4 mpls-vpn;
}
api {
processes [ global-trading ];
}
}
# Remote site connection (London)
neighbor 10.2.0.1 {
router-id 10.1.1.1;
local-address 10.1.1.1;
local-as 65001;
peer-as 65002;
family {
ipv4 unicast;
ipv4 mpls-vpn;
}
api {
processes [ global-trading ];
}
}Getting Started
Configuration
- Configuration Syntax
- Neighbor Configuration
- Directives A-Z
- Syntax Reference
- 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