14

could anyone tell me what ip as-path access-list 100 deny .+_.+_.+_.+_.+_.+_.+_.+_.+_.+_.+_.+ stands for?!

I searched over the internet for the meaning of this regular expression, but I was unable to find any info.

Mike Pennington
  • 29,876
  • 11
  • 78
  • 152
ipermo
  • 275
  • 2
  • 9

2 Answers2

18

Every time you see .+_, that regular expression represents a single BGP autonomous system. This as-path list denies BGP as paths equal to or longer than 12 paths long.

The regular expression works because . represents any character, + is a wild card which optionally repeats the previous character an unlimited number of times, and _ represents the space between the autonomous system paths. For more information, refer to the Cisco IOS Regular Expression guide, or this INE BGP Regular Expressions blog.

Mike Pennington
  • 29,876
  • 11
  • 78
  • 152
  • Hello Mike, thank you for your help and clarification. Very useful. Best regards. – ipermo Sep 16 '13 at 12:31
  • you are most welcome good luck with your project – Mike Pennington Sep 16 '13 at 12:37
  • 1
    As additional info, IOS has long supported 'bgp maxas-limit n' to make it easier to restrict AS-path size, however it is obviously global, while as-path ACL you can call more surgically. – ytti Sep 16 '13 at 13:26
-1

It'll be matching 12 AS-path list. But, I think a more appropriate way of matching it would be ^[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+$, because the expression you mentioned might just match any character ie. special characters and alphabets included.

rchard2scout
  • 103
  • 3
bull
  • 1
  • 1
    AS-path regular expression are not 'normal' regular expressions, it's already a given that only numbers can be used. – Teun Vink May 09 '15 at 08:47
  • 1
    I'm not completely sure this would work the way the OP needs it to. `[0-9]+[0-9]+` doesn't account for the space between autonomous system paths. In plain terms, it says to match 0-9 (`[0-9]`) an infinite amount of times (`+`) followed directly by another set of infinite 0-9 sets (`[0-9]+`). – Ryan Foley May 09 '15 at 15:07