Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The latter method is much faster and less resource-intensive than the string matching approach.

...

As an example, very basic AS Path filter that matchers ASN 1234 anywhere in the middle of the AS-path:

Code Block
languageros
/routing/filter/rule/add 
chain=myChain rule="if (bgp-as-path .1234.) {accept}"


Supported Operators


OperatorDescriptionExampleExample ExplainedExample Matches
^Represents the beginning of the path^1234 will math AS-path starting with ASN 1234
$Represents the end of the path1234$will match AS-path of origin ASN 1234
*Zero or more occurrences of the  listed ASN^1234*$will math Null as-path or as-path where ASN 1234 may or may not appear multiple times

Math:

1234

1234 1234 1234

Null path

No Match:

1234 5678

+One or more occurrences of the listed ASN1234+will match AS-path where ASN 1234 appears at least once

Match:

1234

3 1234 6

No match:

12345 678

-Represents the range

?Zero or one occurrence of the listed ASN^1234? 5678will match AS-path that may or may not start with ASN 1234 appearing once.

Match:

5678

1234 5678

No match:

1234 1234 5678

12345 5678

.One occurrence of any ASN^.$ will match any AS-path with length of one.

Match:

12345

45678

No match:

1234 5678

|Match one of two ASNs on each side^(1234|5678) will match AS-path starting with ASN 1234 or 5678

Match:

1234

5678

1234 5678

No Match:

91011

[ ]

Represents the set of AS numbers where one AS number from the list must match. It is also possible to reference the pre-defined num-sets from 

num-sets with [[numset_name]] 

^[1234 5678 1-100]will match AS-path that starts with 1234 or 5678 or from the range of 1 to 100

Match:

1234

99

5678

No Match:

101

()

Group of regexp terms to match^(1234$|5678)will match AS-path that starts and ends with 1234 or AS-path that starts with 5678

Match:

1234

5678 9999

No Match:

1234 5678

...