Skip to content

Instantly share code, notes, and snippets.

@mdpuma
Last active April 2, 2025 17:19
Show Gist options
  • Select an option

  • Save mdpuma/82b1ebb05a9cd811eea477f1e91d9191 to your computer and use it in GitHub Desktop.

Select an option

Save mdpuma/82b1ebb05a9cd811eea477f1e91d9191 to your computer and use it in GitHub Desktop.
bird commands
# birdc
# show prefixes with community 60602:1000
show route where bgp_community ~ [ (60602,1000) ] all
show route where bgp_path.last ~ [31252] all
# BGP masks are patterns used for BGP path matching (using path ~ [= 2 3 5 * =] syntax). The masks resemble wildcard patterns as used by UNIX shells. Autonomous system numbers match themselves, * matches any (even empty) sequence of arbitrary AS numbers and ? matches one arbitrary AS number. For example, if bgp_path is 4 3 2 1, then: bgp_path ~ [= * 4 3 * =] is true, but bgp_path ~ [= * 4 5 * =] is false. BGP mask expressions can also contain integer expressions enclosed in parenthesis and integer variables, for example [= * 4 (1+2) a =]. You can also use ranges (e.g. [= * 3..5 2 100..200 * =]) and sets (e.g. [= 1 2 [3, 5, 7] * =]).
show route filter { if bgp_path ~ [ 31252 ] then accept; reject; }
show route filter { if net ~ 0.0.0.0/0 && net.len = 32 then accept; reject; }
# show all prefixes
show route all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment