bgpgrep
Filter and search BGP routing data in MRT format
TLDR
SYNOPSIS
bgpgrep [file ...] [filter expressions]
DESCRIPTION
bgpgrep is part of the Micro BGP Suite, a set of shell tools for filtering and analyzing BGP routing data stored in MRT (Multi-threaded Routing Toolkit) format. It processes BGP table dumps and update files from route collectors like RIPE RIS and RouteViews.Each line of output is prefixed with a character indicating the message type: `=` for RIB snapshot, `+` for announcement, `-` for withdrawal, and `#` for BGP state change. The output uses a pipe-delimited format where the 9th field contains the peer address and ASN, enabling easy integration with standard command-line tools like `cut` and `awk`.The tool supports filtering by prefix, AS path patterns, peer, communities, and timestamp. Multiple filters can be combined using boolean operators (`-and`, `-or`, `-not`) with parentheses for grouping. It handles both IPv4 and IPv6 prefixes and supports compressed MRT files (gzip, bzip2).
PARAMETERS
-peer address|asn
Match routes received from a specific peer, identified by IP address or AS number.-aspath pattern
Match routes whose AS path matches the given pattern. Supports AS number sequences and regular expression-like syntax.-supernet prefix
Match routes that are supernets of (or equal to) the specified prefix.-subnet prefix|file
Match routes that are subnets of the specified prefix, or match against a prefix list from a file.-communities expression
Match routes with specific BGP community values. Supports wildcard patterns.-bogon-asn
Match routes containing bogon (reserved/unallocated) AS numbers in the AS path.-loops
Detect AS path loops.-timestamp condition
Filter by timestamp using comparison operators (e.g., ">=2021-07-01").-and
Logical AND between filter conditions (default when combining filters).-or
Logical OR between filter conditions.-not
Negate the following filter condition.
CAVEATS
Input must be in MRT format (common BGP dump format). Filter option names use single-dash long form (e.g., `-peer`, not `--peer`). AS path matching patterns use bgpgrep-specific syntax that differs from standard regular expressions.
SEE ALSO
traceroute(1), whois(1)
