-
Notifications
You must be signed in to change notification settings - Fork 459
MRT Format
Working with MRT (Multi-Threaded Routing Toolkit) BGP dumps
MRT is a standardized binary format for storing BGP routing information, commonly used for BGP table dumps, UPDATE message captures, and routing analysis. This page explains how to work with MRT files in the context of ExaBGP.
- What is MRT?
- ExaBGP and MRT
- Converting MRT to ExaBGP
- Converting Cisco IOS Dumps
- Use Cases
- Tools
- See Also
MRT (Multi-Threaded Routing Toolkit) is a binary format for recording BGP routing information, defined by RFC 6396.
BGP Table Dumps:
- RIB (Routing Information Base) snapshots
- Full BGP tables from route collectors
- Historical routing data
BGP UPDATE Messages:
- Real-time BGP update captures
- BGP event recording
- Protocol analysis
Route Collectors:
- RIPE RIS (Routing Information Service)
- RouteViews
- PCH (Packet Clearing House)
| Type | Description | Use Case |
|---|---|---|
| TABLE_DUMP | Full RIB snapshot (deprecated) | Legacy table dumps |
| TABLE_DUMP_V2 | Full RIB snapshot (current) | Modern table dumps |
| BGP4MP | BGP UPDATE/KEEPALIVE/NOTIFICATION | Live capture |
| BGP4MP_STATE_CHANGE | BGP state transitions | FSM monitoring |
β οΈ Important: ExaBGP does NOT have native MRT support. ExaBGP uses its own configuration format and text/JSON API.
Why?
- ExaBGP focuses on route injection and control, not passive monitoring
- MRT is primarily for recording and analysis
- Different use cases require different formats
If you need to inject routes from an MRT dump into ExaBGP:
ββββββββββββββββ
β MRT Dump β
β (binary) β
ββββββββ¬ββββββββ
β
β Convert
v
ββββββββββββββββ
β MRTparse or β
β IOS2ExaBGP β
ββββββββ¬ββββββββ
β
β Generate
v
ββββββββββββββββ
β ExaBGP β
β Config β
ββββββββ¬ββββββββ
β
β Load
v
ββββββββββββββββ
β ExaBGP β
β Announces β
ββββββββββββββββ
URL: https://github.com/YoshiyukiYamauchi/mrtparse
Description: Python library and tool that converts MRT format dumps into ExaBGP configuration format.
pip install mrtparseConvert MRT dump to ExaBGP config:
# Parse MRT file and output ExaBGP format
mrtparse -f exabgp latest-bview.gz > exabgp-routes.confExample Output (ExaBGP format):
neighbor 192.0.2.1 {
router-id 192.0.2.2;
local-address 192.0.2.2;
local-as 65001;
peer-as 65000;
static {
route 203.0.113.0/24 next-hop 192.0.2.1 as-path [ 65000 64512 ];
route 198.51.100.0/24 next-hop 192.0.2.1 as-path [ 65000 64513 ];
# ... thousands of routes
}
}Filter specific prefixes:
#!/usr/bin/env python3
import mrtparse
# Parse MRT and filter
for entry in mrtparse.Reader('latest-bview.gz'):
if entry.data['type'][0] == mrtparse.MRT_T['TABLE_DUMP_V2']:
prefix = entry.data['prefix']
# Filter: only /24 prefixes
if prefix.endswith('/24'):
# Output ExaBGP format
print(f"route {prefix} next-hop {entry.data['next_hop']};")Parse UPDATE messages:
for entry in mrtparse.Reader('updates.20250101.0000.bz2'):
if entry.data['type'][0] == mrtparse.MRT_T['BGP4MP']:
if entry.data['subtype'][0] == mrtparse.BGP4MP_ST['BGP4MP_MESSAGE']:
# Process BGP UPDATE
bgp_message = entry.data['bgp_message']
# Convert to ExaBGP formatURL: https://github.com/lochiiconnectivity/ios2exa
Description: Converts Cisco IOS IPv4 BGP LOC-RIB dumps to ExaBGP configuration format.
Cisco IOS: Capture BGP table
router# show ip bgp | redirect flash:bgp-table.txt
Convert to ExaBGP format:
./ios2exa bgp-table.txt > exabgp-routes.confExample Input (Cisco IOS format):
Network Next Hop Metric LocPrf Weight Path
*> 10.0.0.0/8 192.168.1.1 0 0 65000 i
*> 172.16.0.0/12 192.168.1.1 0 0 65000 65001 i
Example Output (ExaBGP format):
static {
route 10.0.0.0/8 next-hop 192.168.1.1 as-path [ 65000 ] origin IGP;
route 172.16.0.0/12 next-hop 192.168.1.1 as-path [ 65000 65001 ] origin IGP;
}Scenario: Test router behavior with real BGP tables
Workflow:
- Download RIB dump from RouteViews or RIPE RIS
- Convert MRT to ExaBGP config with MRTparse
- Load into ExaBGP
- Peer with test router
- Observe router behavior with full internet table
Example:
# Download RIPE RIS dump
wget https://data.ris.ripe.net/rrc00/latest-bview.gz
# Convert to ExaBGP
mrtparse -f exabgp latest-bview.gz > internet-table.conf
# Load into ExaBGP
exabgp internet-table.confScenario: Replay historical BGP events
Workflow:
- Obtain historical MRT dumps (BGP4MP UPDATE messages)
- Convert to ExaBGP format
- Replay updates to simulate past events
- Analyze behavior during historical incidents
Application: BGP hijack analysis, outage investigation
Scenario: Migrate static route announcements from Cisco to ExaBGP
Workflow:
- Export Cisco BGP table (
show ip bgp) - Convert with IOS2ExaBGP
- Review and clean up ExaBGP config
- Deploy ExaBGP with converted routes
Scenario: Test software with real-world BGP data
Workflow:
- Download representative BGP table (MRT)
- Convert to ExaBGP format
- Use as test data for development
- Validate against production-scale routing tables
| Tool | Language | Purpose | URL |
|---|---|---|---|
| mrtparse | Python | MRT parsing and conversion to ExaBGP | https://github.com/YoshiyukiYamauchi/mrtparse |
| IOS2ExaBGP | Python | Cisco IOS dump conversion | https://github.com/lochiiconnectivity/ios2exa |
| bgpdump | C | MRT dump analysis (not ExaBGP specific) | https://github.com/RIPE-NCC/bgpdump |
| bgpscanner | C | High-performance MRT processing | https://gitlab.com/Isolario/bgpscanner |
| Source | Description | URL |
|---|---|---|
| RIPE RIS | Route collectors worldwide | https://www.ripe.net/analyse/internet-measurements/routing-information-service-ris |
| RouteViews | University of Oregon route views | http://www.routeviews.org/ |
| PCH | Packet Clearing House | https://www.pch.net/resources/Routing_Data/ |
- Community Projects - MRTparse and IOS2ExaBGP listed under Interoperability
- Configuration: Configuration Syntax - ExaBGP config format
- Reference: Examples Index - ExaBGP configuration examples
- Operations: Debugging - Testing configurations
- RFC 6396 - Multi-Threaded Routing Toolkit (MRT) Routing Information Export Format
- MRTparse GitHub - Python MRT parser
- IOS2ExaBGP GitHub - Cisco IOS conversion tool
- RIPE RIS - MRT dump source
π» 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)