BGP AS Path Filter Example

Hi Mario,

The [0-9] means any number between 0 and 9, this means 0,1,2,3,4,5,6,7,8 and 9 are valid. The * means that we repeat the previous number 0 or multiple times. Basically this means any number from 0 to infinity matches. In our example we have 16 bit AS numbers so that means any AS number from 0 to 65535 will be matched.

The + is similar to the * but it means that we repeat the previous number 1 or multiple times. In practice, there’s a big difference between the two…for example:

When I use ^3257_[0-9]*$ then I’m matching everything that starts with AS 3257 with none or one AS behind it, which could be any number.

When I use ^3257_[0-9]+$ then I’m matching everything that starts with AS 3257 but there has to be one additional AS behind it, which could be any number.

The ? means that we repeat the previous number zero or one time, for example when you use [0-9]? it means that we try to match the previous value (anything between 0 and 9) but it’s optional.

Hope this helps! It takes some practice with looking glass servers to get the hang of this.

Rene

1 Like