From: Geert Nijs (geert.nijs@simac.be)
Date: Tue Jun 15 2004 - 10:36:31 GMT-3
I have tested the expression on IOS 12.2(23a) and it works:
R4#sh ip bgp
BGP table version is 7, local router ID is 200.0.0.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -
internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 200.0.0.2/32 150.50.24.2 0 0 100 100 100
i
*> 200.0.0.5/32 150.50.24.2 0 100 100 100
30 30 30 30 60 40 i
*> 200.0.0.6/32 150.50.24.2 0 100 100 100
30 30 30 30 i
*> 200.0.0.9/32 150.50.24.2 0 100 100 100
30 30 30 30 60 i
R4#sh ip bgp regexp ^100(_100)*(_([0-9]+)(_\3)*)?$
BGP table version is 7, local router ID is 200.0.0.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -
internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 200.0.0.2/32 150.50.24.2 0 0 100 100 100
i
*> 200.0.0.6/32 150.50.24.2 0 100 100 100
30 30 30 30 i
=============================================
The \3 references the 3th parameter between ()
so in the regular expression: ^100_(200)_(300)_(400)$
\1 = 200
\2 = 300
\3 = 400
The regular expression: ^100(_100)*(_([0-9]+)(_\3)*)?$
can be read in "normal" English as:
^100 beginning with AS100
(_100)* followed by 0 or more times AS100
(xxxxxxxx)?$ OPTIONALLY (0 or 1 times) followed by everything between
brackets
between brackets we have:
_([0-9]+) any AS number (watch the parantesis!)
(_\3)* followed by 0 or more times this SAME AS number
\1 matches _100
\2 optionally matches anything after the "100s"
AS
\3 matches the AS number in ([0-9]+)
I think there are other forms of regular expressions that accomplish the
same......
Regards,
Geert
-----Oorspronkelijk bericht-----
Van: Alexander Arsenyev (GU/ETL)
[mailto:alexander.arsenyev@ericsson.com]
Verzonden: maandag 14 juni 2004 19:20
Aan: Geert Nijs; ccielab@groupstudy.com
Onderwerp: RE: AS PATH
Hello Geert,
This regexp does not work as expected, at least in IOS 12.0(21ST) - the
most recent one for 7500 I have.
The testbed setup is:
(as20,routerid 172.16.0.22)C2611<---eBGP--->C7507(as10,routerid
172.16.0.2)
C2611 injects 5 routes: 1.1.1.1/32, 1.1.2.2/32, 1.1.3.3/32, 1.1.4.4/32,
1.1.5.5/32 into AS10.
The BGP table on C7507 looks like:
C7507#sh ip bgp ne 172.16.0.22 routes
BGP table version is 4697, local router ID is 172.16.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i -
internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 1.1.1.1/32 172.16.0.22 0 0 20 20 20 i
* 1.1.2.2/32 172.16.0.22 0 0 20 20 20 30
i
* 1.1.3.3/32 172.16.0.22 0 0 20 20 20 30
30 30 i
* 1.1.4.4/32 172.16.0.22 0 0 20 20 20 30
40 40 i
*> 1.1.5.5/32 172.16.0.22 0 0 20 20 20 30
40 40 i
Total number of prefixes 5
When I try to use Your regexp (adapted, AS20 instead of AS100) I get:
C7507#sh ip bgp regexp ^20(_20)*(_([0-9]+)(_\3)*)?$
BGP table version is 4697, local router ID is 172.16.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i -
internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 1.1.1.1/32 172.16.0.22 0 0 20 20 20 i
* 1.1.2.2/32 172.16.0.22 0 0 20 20 20 30
i
C7507#
Not much joy apart from neighbor routes (prepended) and its directly
connected Customer (without prepend)...
Comments anyone?
Thanks//BR
Alex
-----Original Message-----
From: Geert Nijs [mailto:geert.nijs@simac.be]
Sent: 14 June 2004 17:04
To: Alexander Arsenyev (GU/ETL); ccielab@groupstudy.com
Subject: RE: AS PATH
The regular expression to match AS 100 and any directly connected AS,
including AS-path-prepending is:
^100(_100)*(_([0-9]+)(_\3)*)?$
Regards,
Geert
-----Oorspronkelijk bericht-----
Van: nobody@groupstudy.com [mailto:nobody@groupstudy.com] Namens
Alexander Arsenyev (GU/ETL)
Verzonden: maandag 14 juni 2004 16:13
Aan: ccielab@groupstudy.com
Onderwerp: RE: AS PATH
Actually (10)+ in Cisco regexp means 10 or 1010, not 10_10_10_... Please
remember that AS number is 2 bytes long so there is no such thing as
AS 101010.
To match neighbor AS number with prepends and its direct customers (no
prepends) use ^(AS#_)+[0-9]*$ I've tried to develop AS path regexp which
matches neighbor AS with prepends and its direct customers with prepends
but no luck so far. The trick is that this regexp should match only 2
different AS numbers in AS Path while ([0-9]+_)* matches ANY number of
different AS numbers in AS path because regexp are "greedy" (I think).
HTH,
Cheers
Alex
-----Original Message-----
From: nobody@groupstudy.com [mailto:nobody@groupstudy.com]On Behalf Of
Scott Morris
Sent: 12 June 2004 14:36
To: 'Richard Dumoulin'; ccielab@groupstudy.com
Subject: RE: AS PATH
If you want to take into account the pre-pending of an ACL, you would
associate the "+" character, which is "one or more of the preceding
value". Don't forget to create a character class though with ().
If you put 10+ by itself, that only treats the "0" as "one or more", so
10, 100, 1000, 10000 would match.
If you do (10)+ that will treat "10" as the thing to repeat. So whether
my as-path has 10 or 10 10 10 10 10 doesn't matter.
HTH,
Scott Morris, CCIE4 (R&S/ISP-Dial/Security/Service Provider) #4713,
CISSP, JNCIP, et al. IPExpert CCIE Program Manager IPExpert Sr.
Technical Instructor swm@emanon.com/smorris@ipexpert.net
http://www.ipexpert.net
-----Original Message-----
From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf Of
Richard Dumoulin
Sent: Saturday, June 12, 2004 9:19 AM
To: 'ccielab@groupstudy.com'
Subject: AS PATH
Some time ago, someone posted a link where an example of as-path
access-list which embraced a neighbor AS plus its directed customers was
shown.
This acl did take into account prepending from those AS's.
If anyone conserves this post would he send it again please ? I 've
searched the archives but in vane,
Thanks
--Richard
**********************************************************************
Any opinions expressed in the email are those of the individual and not
necessarily the company. This email and any files transmitted with it
are confidential and solely for the use of the intended recipient. If
you are not the intended recipient or the person responsible for
delivering it to the intended recipient, be advised that you have
received this email in error and that any dissemination, distribution,
copying or use is strictly prohibited.
If you have received this email in error, or if you are concerned with
the content of this email please e-mail to:
e-security.support@vanco.co.uk
The contents of an attachment to this e-mail may contain software
viruses which could damage your own computer system. While the sender
has taken every reasonable precaution to minimise this risk, we cannot
accept liability for any damage which you sustain as a result of
software viruses. You should carry out your own virus checks before
opening any attachments to this e-mail.
**********************************************************************
This archive was generated by hypermail 2.1.4 : Sat Jul 03 2004 - 19:40:40 GMT-3