0% found this document useful (0 votes)
310 views

BGP Regular Expressions Examples

Regular expressions are used to manipulate and filter BGP routes. The document provides examples of regular expression patterns that match different aspects of BGP autonomous system paths, such as matching prefixes from a directly connected or transit autonomous system, or prefixes where the autonomous system is performing path prepending. It also lists the special characters used in regular expressions for matching prefixes originating from BGP confederation peers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
310 views

BGP Regular Expressions Examples

Regular expressions are used to manipulate and filter BGP routes. The document provides examples of regular expression patterns that match different aspects of BGP autonomous system paths, such as matching prefixes from a directly connected or transit autonomous system, or prefixes where the autonomous system is performing path prepending. It also lists the special characters used in regular expressions for matching prefixes originating from BGP confederation peers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

BGP Regular Expressions

Examples
Regular Expressions are used often for BGP route manipulation or filtering. In
this article well take a look at some useful regular expressions. First lets
take a look at the different characters that we can use:

Characters
? repeats the previous character one or zero times.
* repeats the previous character zero or many times.
+ repeats the previous character one or more times.
^ matches the beginning of a string.
$ matches the end of a string.
[] is a range.
_ matches the space between AS numbers or the end of the AS PATH list.
\\ is an escape character. Youll need this for BGP confederations.

Examples
^$
^51_

matches an empty AS PATH so it will match all prefixes from the local
AS.
matches prefixes from AS 51 that is directly connected to our AS.

_51_

matches prefixes that transit AS 51.

_51$

matches prefixes that originated in AS 51, the $ ensures that its the
beginning of the AS PATH.

^([09]+)_51

matches prefixes from AS 51 where AS 51 is behind one of our


directly connected ASes.

^51_([09]+)

matches prefixes from the clients of directly connected AS 51.

^(51_)+([0- matches prefixes from the clients of directly connected AS 51, where
9]+)
AS 51 might be doing AS PATH prepending.
^51_([09]+_)+

matches prefixes from the clients of directly connected AS 51, where


the clients might be doing AS PATH prepending.

^\65200\) matches prefixed from confederation peer 65200.

If you need some practice for these, I would suggest to use a BGP looking
glass server.
Got some more useful BGP regular expressions? please let me know!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy