From: BRZYSKI, ADAM E (SWBT) (ab1723@xxxxxxx)
Date: Wed Nov 14 2001 - 16:52:35 GMT-3
Note that you are using the expression incorrectly all together. The
following is a definition of a range which is expressed by []:
You can specify a range of single-character patterns to match against a
string. For example, you can create a regular expression that matches a
string containing one of the following letters: a, e, i, o, and u. One and
only one of these characters must exist in the string for pattern matching
to succeed. To specify a range of single-character patterns, enclose the
single-character patterns in square brackets ([ ]). The order of characters
within the brackets is not important. For example, [aeiou] matches any one
of the five vowels of the lowercase alphabet, while [abcdABCD] matches any
one of the first four letters of the lowercase or uppercase alphabet.
this is per
http://www.cisco.com/univercd/cc/td/doc/product/software/ios121/121cgcr/dial
_r/drdapp/drdrapre.htm
Pay particular attention to the following: "One and only one of these
characters must exist in the string for pattern matching to succeed"
Furthermore:
You can reverse the matching of the range by including a caret (^) at the
start of the range. The following example matches any letter except the ones
listed:
[^a-dqsv]
this is again per
http://www.cisco.com/univercd/cc/td/doc/product/software/ios121/121cgcr/dial
_r/drdapp/drdrapre.htm
When you type [^^1_123] or [^^1 123] you are not really matching the entire
sting. you are only looking for "one and only one of these characters" to
match. Note that the _ "underbar" matches a comma (,), left brace ({),
right brace (}), left parenthesis, right parenthesis, the beginning of the
input string, the end of the input string, or a space. Where a space simply
matches a space. Depending on your topology you may be successful in
filtering out the routes you want to see by what you are doing. However
keep this information in the back of your mind because your method may not
product the same results every time.
The best way to filter BGP routes aside from the AS path attribute is to use
the community attribute. I think that using community strings to do this
kind of filtering is much cleaner. It requires a little more configuration
however the community attribute can make your life much easier. I would say
that most ISP's use this attribute for most of their policy decisions.
Hope this helps!
Adam Brzyski
Design Engineer II
CCIE #8082, NNCDE
-----Original Message-----
From: Krake, Kris [mailto:KKrake@aegonusa.com]
Sent: Tuesday, November 13, 2001 4:54 PM
To: BRZYSKI, ADAM E (SWBT); ccielab@groupstudy.com
Subject: RE: BGP regular expression help
Thanks for the clarification. Tremendous help.
Going back to the original question now that that makes sense. I want to
look at a very large bgp routing table and want to separate what I'm
learning from one AS from another. I normally go through and issue a ip bgp
regexp command to so. A majority of my routes come from one as and then a
smaller amount of routes come from 3 others. What I would like to do is
issue the regexp command so that I can all routes not coming from the larger
AS. We'll call that AS1 for the sake of argument. How would I write a
regexp to show me all the routes NOT advertised to me by AS1. I have
researched and the ^ when preceeded by the [ is the logical not. I need the
logical not for the string starting with 1. I attempted [^^1] (not starting
with 1) and ^[^1] (starting with NOT 1). Neither appears to work.
Curiously my original question posed a little more....how do I show the
string for NOT advertised by 1 and 123 prior to that (BGP table would show 1
123). I attempted [^^1_123] and ^[^1_123] and that did not work. Per
advice from the group I tried [^^1 123] (no underscore) and it worked.
Following that logic I tried [^^1 ] which did not work...also tried
[^^1_]...didn't work either.
Can someone explain to me for the NOT(AS1 AS123) scenario:
1) Why does the "space" work and not the _ in the following expression [^^1
123]
2) Why doesn't the same logic appear to apply when I just want NOT(AS1 )
Thanks...
Kris
-----Original Message-----
From: BRZYSKI, ADAM E (SWBT) [mailto:ab1723@sbc.com]
Sent: Monday, November 12, 2001 3:57 PM
To: Krake, Kris; ccielab@groupstudy.com
Subject: RE: BGP regular expression help
Note the following
^ means begins with
$ means ends with
Keep in mind how the AS path is formed by BGP. Each time a BGP update
transverses from a particular AS to another AS the AS number of the exiting
AS is added to the AS path attribute. Boy that sentence is a mouthful. I
hope I did not confuse you. In case I did lets do an example. Lets say
that a route originated in AS 1 and has gotten propagated to AS 10 through
the following topology:
AS1-AS5-AS6-AS10
Within AS10 when looking at the BGP table you should see the following AS
path for all updates that originated in AS1
6 5 1
Note that the originating AS is the left most number. With that said the
definitions above for ^ and $ are given from the perspective of what is
displayed in the BGP table. However in reality that perspective is reverse
of how the BGP process constructs the AS path attribute. Look at the
following examples
.* any
^$ Local AS
^1$ Only from AS 1
^6_ Received directly from AS 6
_1$ Originated from 100
_5_ via AS 5
Look at the following link for more help
http://www.cisco.com/univercd/cc/td/doc/product/atm/c8540/12_0/13_19/cmd_ref
/appc.htm#xtocid68796
Note the following command is very useful in checking the validity of your
regular expressions
show ip bgp regexp (regular expression)
Adam Brzyski
Design Engineer II
CCIE #8082, NNCDE
-----Original Message-----
From: Krake, Kris [mailto:KKrake@aegonusa.com]
Sent: Monday, November 12, 2001 2:12 PM
To: BRZYSKI, ADAM E (SWBT); ccielab@groupstudy.com
Subject: RE: BGP regular expression help
I am more interested in the show ip bgp regexp command to go through the bgp
route table. Therefore I need the logical not in the regular expression.
As for the expressions below: I know I'm green on regexp's but doesn't the
"^" mean originate. I would have thought the opposite of what you stated
below.
-----Original Message-----
From: BRZYSKI, ADAM E (SWBT) [mailto:ab1723@sbc.com]
Sent: Monday, November 12, 2001 2:48 PM
To: ccielab@groupstudy.com
Subject: RE: BGP regular expression help
ip as-path access-list 1 deny _123_1$
ip as-path access-list 1 permit .*
note that the access-list above will filter out any updates that originated
in AS 1 and directly went through AS 123
ip as-path access-list 1 deny ^1_123_
ip as-path access-list 1 permit .*
note that this access-list will filter out any updates that have arrived
into the local AS directly through AS 1 and 123.
In order for the filters to work they need to be applied to a neighbor
statement within your BGP configuration.
Hope this helps.
Adam Brzyski
Design Engineer II
CCIE #8082, NNCDE
-----Original Message-----
From: Krake, Kris [mailto:KKrake@aegonusa.com]
Sent: Monday, November 12, 2001 1:26 PM
To: ccielab@groupstudy.com
Subject: BGP regular expression help
How would you write the regular expression for the following:
all paths NOT starting with the 1 123 pattern (AS 1 followed by AS 123)
I know that ^1_123 would show me those patterns with 1 123 but I need the
opposite of that (logical not)...
I have tried ^[^1_123] and [^^1_123]
Thanks for guidance...
Kris
This archive was generated by hypermail 2.1.4 : Fri Jun 21 2002 - 06:45:15 GMT-3