How to understand BGP as-path regular expressions

Source: Internet
Author: User
Tags empty expression regular expression

^ Flags The beginning of an expression, and if this character is not used, there is no starting limit for default. For example: When using the permit ^254, the meaning is that the route that is connected to the local as is 254 is allowed. If you use the simple permit 254, then it is as long as the routing of as 254, all are allowed, in fact, and permit _254_ expression of the same meaning.

The $ flag is the end of an expression, and if this character is not used, there is no end to the default limit. For example, when the permit 254$ is used, the meaning is that the route originating from as 254 is all accepted, if permit 254, see above explanation.

? The flag matches one of the preceding characters, note: just match one character.? allow the preceding character to appear once or empty. such as: Permit 254[0-9]?$, then is only match originated from as 254/2540---2549 of the route, note? Replace with CTRL-V on the Cisco router.

* The logo matches one of the preceding characters, notice, and? The difference is, * allows the preceding characters to appear many times or is empty, but only allow the match to appear once or empty. such as: Permit 254[0-9]*$, then is only match originates from as 254/2540---25499999 ... the route if is permit 254[5-9], then is the match origin from as 254/2545-2549/ 25455-25459/254555-

254599. ......

The difference between + and * is that * can match null, but + must match a value to the line such as permit ^254+$, which is originated from 254 or 2544/25444 ... and permit ^254*$ can match the origin of as 25/254/25444.

A period. The flag matches any one character, including spaces, such as: when we use permit. *, the expression matches all routes.

_ represents a connector between two as, such as: Permit ^254_253_252$, representing a route entry originating from 252, after 253 and 254.

. Match any single character, including spaces

* Match the appearance of 0 or more modes

+ Match the appearance of one or more patterns

? Match the appearance of 0 or more patterns

^ Start of matching characters

$ match end of character

_ Match comma, opening brace, right brace, left parenthesis, right parenthesis

Cases:

C* matches the appearance of any number of C in a row, including not appearing C

c+ match the occurrence of one or more characters C in a row

Ca? B-Match CB or CAB

[Aa] matches a single character A or a,

[1-35-7] matches a single character that refers to 1,2,3,4,5,6,7

^[BB] matches rows that start with B or b

[2-5]$ matches the line ending with 2,3,4,5. The caret (^) in square brackets is used to reverse the meaning of a character

[^1-3] matches characters 0 and 4-9

Route meaning

^$ routing from this as Origin

^2_ all routes from the directly connected neighbors in as 2

^2$ originating from a neighbor route in AS2

_3_ routing contains as 3

{1 2} aggregating routes using the As-path option, forming aggregations from the routes as 1 and as

(65530) Federation with the counterpart form, which is in as 65530

The format of the As-path path filter is:

IP as-path access-list <#> permit < regular expressions >

IP as-path access-list <#> deny < regular expression >

The 1 ^254_[0-9]*_253$//////represents the origin of 253, the local connection is 254, and the middle has an arbitrary as

2 ^254_[0-9_]*_253$//////originated from 253, the local connection is 254, the middle includes multiple arbitrary as

3 ^254_[0-9]?_253$/////originated from 253, the local connection is 254, the middle includes a as,{as0-as9 or intermediate without as}

4 ^254_[0-9]+_253$/////originates from 253, the local connection is 254, and relative to 1, there must be one as, and 1 can only as254,as253

The 5 ^254_[0-9_]+253$/////originates from 253, the local connection is 254, and, in contrast, it must also pass through one as or more as, and 2 can only pass through as254,as253

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.