NAME
bgpq3 – bgp filtering automation tool
SYNOPSIS
bgpq3 [-h host[:port]] [-S sources] [-EPz][ -f asn | -F fmt | -G asn -t] [-2346ABbDdJjNnsXU] [-a asn] [-r len] [-R len] [-m max] [-W len] OBJECTS [...] [EXCEPT OBJECTS]
DESCRIPTION
The bgpq3 utility used to generate configurations (prefix-lists, extended access-lists, policy-statement terms and as-path lists) based on RADB data.
The options are as follows:
- -2
-
accept routes registered for as23456 (transition-as) (default: false)
- -3
-
assume that your device is asn32-safe.
- -4
-
generate IPv4 prefix/access-lists (default).
- -6
-
generate IPv6 prefix/access-lists (IPv4 by default).
- -A
-
try to aggregate prefix-lists as much as possible (not all output formats supported).
- -a asn
-
specify what asn shall be denied in case of empty prefix-list (OpenBGPD)
- -B
-
generate output in OpenBGPD format (default: Cisco)
- -b
-
generate output in BIRD format (default: Cisco).
- -d
-
enable some debugging output.
- -D
-
use asdot notation for Cisco as-path access-lists.
- -E
-
generate extended access-list (Cisco), policy-statement term using route-filters (Juniper), [ip|ipv6]-prefix-list (Nokia) or prefix-sets (OpenBGPd).
- -f number
-
generate input as-path access-list (use 0 to not enforce first AS)
- -F fmt
-
generate output in user-defined format.
- -G number
-
generate output as-path access-list.
- -h host[:port]
-
host running IRRD database (default: whois.radb.net).
- -J
-
generate config for Juniper (default: Cisco).
- -j
-
generate output in JSON format (default: Cisco).
- -l name
-
name of generated entry.
- -L limit
-
limit recursion depth when expanding as-sets.
- -m len
-
maximum prefix-length of accepted prefixes (default: 32 for IPv4 and 128 for IPv6).
- -M match
-
extra match conditions for Juniper route-filters.
- -n
-
generate config for Nokia SR OS MD-CLI (Cisco IOS by default)
- -N
-
generate config for Nokia SR OS classic CLI (Cisco IOS by default).
- -p
-
accept routes registered for private ASNs (default: disabled)
- -P
-
generate prefix-list (default, backward compatibility).
- -r len
-
allow more specific routes starting with specified masklen too.
- -R len
-
allow more specific routes up to specified masklen too.
- -s
-
generate sequence numbers in IOS-style prefix-lists.
- -S sources
-
use specified sources only (recommended: RADB,RIPE,APNIC).
- -t
-
generate as-sets for OpenBGPD (OpenBSD 6.4+), BIRD and JSON formats.
- -T
-
disable pipelining.
- -W len
-
generate as-path strings of no more than len items (use 0 for inifinity).
- -U
-
generate config for Huawei devices (Cisco IOS by default)
- -X
-
generate config for Cisco IOS XR devices (plain IOS by default).
- -z
-
generate route-filter-lists (JunOS 16.2+).
- OBJECTS
-
means networks (in prefix format), autonomous systems, as-sets and route-sets.
- EXCEPT OBJECTS
-
those objects will be excluded from expansion.
EXAMPLES
Generating named juniper prefix-filter for AS20597:
For Cisco we can use aggregation (-A) flag to make this prefix-filter more compact:
- you see, prefixes 89.112.0.0/19 and 89.112.32.0/19 now aggregated into single entry 89.112.0.0/18 ge 19 le 19.
Well, for Juniper we can generate even more interesting policy-options, using -M <extra match conditions>, -R <len> and hierarchical names:
generated policy-option term now allows all specifics with prefix-length between /29 and /32 for eltel networks if they match with special community blackhole (defined elsewhere in configuration).
Of course, this version supports IPv6 (-6):
and support for ASN 32 is also here
see AS196611 in the end of the list ? That's AS3.3 in 'asplain' notation.
For non-ASN32 capable routers you should not use switch -3, and the result will be next:
AS196611 is no more in the list, however, AS23456 (transition AS) would be added to list if it were not present.
USER-DEFINED FORMAT
If you want to generate configuration not for routers, but for some other programs/systems, you may use user-defined formatting, like in example below:
Recognized format characters: %n - network, %l - mask length, %N - object name, %m - object mask and %i - inversed mask. Recognized escape characters: \n - new line, \t - tabulation. Please note that no new lines inserted automatically after each sentence, you have to add them into format string manually, elsewhere output will be in one line (sometimes it makes sense):
DIAGNOSTICS
When everything is OK, bgpq3 generates access-list to standard output and exits with status == 0. In case of errors they are printed to stderr and program exits with non-zero status.
SEE ALSO
http://www.radb.net/ Routing Arbiter project
http://tools.ietf.org/html/draft-michaelson-4byte-as-representation-05 for information on 'asdot' and 'asplain' notations.
http://www.cisco.com/en/US/docs/ios/12_0s/release/ntes/120SNEWF.html#wp3521658 for information on Cisco implementation of ASN32.
AUTHOR
Alexandre Snarskii ⟨[email protected]⟩