On Mon, 21 May 2001, ElephantChild wrote:
> On Mon, 21 May 2001, Tay Chee Yong wrote:
>
> > Hi all,
> >
> > I am suppose to accept the following routes from my peer AS123, which
has
> > peering with another AS (AS456). I was told to accept the following
routes
> > from them, but I don't really understand the regular expression. Can
anyone
> > please help to explain to me the following? And what does the "+" and
the
> > parenthese means in this AS-PATH.
> >
> > (_123)+(_456)+
> >
> > I am confused with the parenthese and the "+" sign. Please advise. Thank
you.
>
> *browsebrowsebrowse*
> http://www.cisco.com/univercd/cc/td/doc/product/software/ios113ed/113ed_cr/
> np1_r/1rbgp.htm#xtocid2382618
(rest snipped)
Sorry, folks, incomplete answer. I meant to add the URL for the actual
syntax description, then decided as I read it that it was a bit obscure
as an introduction to regular expressions. Anyway, here's my FMTYWTK
answer:
_ matches any character that separates individual ASNs in an AS path,
including the start or end of the AS path. So _123 ensures that the 123
in the regular expression won't match say, AS 4123. It could, however,
match AS 1234 if used by itself, but the rest of the expression will
take care of that.
+ matches at least one occurence, and perhaps more than one, of the
preceding character or sub-expression between (). So if your peer
indulges in AS path prepending, (_123)+ will take care of that by
matching 123 123 or 123 123 123 12345 as well as a single 123 or 1234.
The rest of the regular expression, and specifically the _ that starts
(_456)+, takes care of that, since it doesn't match the 4 in 1234 or
12345, but only the separator after the 3 of the final 123.
Now that I dissected your regular expression, I will say that IMHO, it's
more complex than what you need, and may still not do what you want in
some cases. Depending on what you want, you may use one of the
following:
- To match any AS path that contains ASNs 123 and 456 in that order, and
may contain any other ASN either before or after, but not between, use
_123_456_ (Note that this would still match 123 789 456 123 456, but
that path has a loop in it, and if your peer will feed you that kind
of paths, you have more serious trouble than just an unwanted 789.)
- To match any AS path that starts with one or more occurences of ASN
123, followed with one (at least) occurence of 456, possibly followed
by other ASNs, use ^(123_)+456_
- To match any AS path that starts with one or more occurences of ASN
123, possibly followed by one or more occurences of ASN 456, but
contains no other ASN, use ^(123_)+(456_)*$
--
"Someone approached me and asked me to teach a javascript course. I was
about to decline, saying that my complete ignorance of the subject made
me unsuitable, then I thought again, that maybe it doesn't, as driving
people away from it is a desirable outcome." --Me
Message Posted at:
http://www.groupstudy.com/form/read.php?f=7&i=5251&t=5234
--------------------------------------------------
FAQ, list archives, and subscription info: http://www.groupstudy.com/list/cisco.html
Report misconduct and Nondisclosure violations to [EMAIL PROTECTED]