From: Gustavo Novais (gustavo.novais@novabase.pt)
Date: Thu Sep 22 2005 - 09:31:09 GMT-3
I think you didnt understand... The doubt is between ^123_[0-9]* or
^123(_[0-9]+)?$
The first, not having a space inside the brackets only allows numbers
meaning you match only ^123 ANY DIGIT$ but no spaces.
Scott, the objective of the question was to match AS XX and its directly
connected neighbors ONLY, not any routes coming from neighbor AS 123.
-----Original Message-----
From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf Of
Ralph
Sent: quinta-feira, 22 de Setembro de 2005 13:22
To: swm@emanon.com
Cc: Gustavo Novais; simon@harttel.com; DSchulz@dpsciences.com;
syv@911networks.com; ccileigh@gmail.com; ccielab@groupstudy.com
Subject: Re: RE: BGP Reg Exp
Hi Guys:
I thought the original question on this thread was to match routes
matching AS 123 and ONLY its directly connected neighbor ASs (just one
level).
I like the ^123(_[0-9]+)?$ solution. the "+" only matches 1 or more
occurence of numbers 0 - 9, while the "?" will match 0 or 1 occurence of
anything in bracket. Example is 123 OR 123 55 or 123 125 or 123 788.
Using an "*" instead of a "?" will permit longer AS paths like 123 222
455 333 not just 123 222 alone. That is zero or more occurence of
anything in bracket.
Ralph.
-----Original Message-----
From: "Scott Morris" <swm@emanon.com>
To: "'Gustavo Novais'" <gustavo.novais@novabase.pt>, "'simon hart'"
<simon@harttel.com>, "'Schulz, Dave'" <DSchulz@dpsciences.com>,
<syv@911networks.com>, "'Leigh Harrison'" <ccileigh@gmail.com>
Date: Thu, 22 Sep 2005 07:53:16 -0400
Subject: RE: BGP Reg Exp
You all overthink this stuff with regular expressions a LOT!
If you are looking for something that simply you learned from AS 123 and
don't care what follows it, you can just as easily do:
^123
The GREP functionality here is JUST MATCHING TEXT. You don't need all
the fancy crap behind it unless it makes you feel better, or unless you
have a need to give rules to the following information.
From a real-live route-server:
route-views.on>sh ip bgp regexp ^852
BGP table version is 1055882, local router ID is 154.11.63.86 Status
codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 3.0.0.0 154.11.63.85 0 852 3356
701
703 80 i
*> 4.0.0.0 154.11.63.85 0 852 3356 i
*> 4.21.104.0/24 154.11.63.85 0 852 3561
7018
26207 26207 26207 26207 i
*> 4.21.112.0/23 154.11.63.85 0 852 3561
7018
26207 26207 26207 26207 i
*> 4.21.130.0/23 154.11.63.85 0 852 3561
7018
26207 26207 26207 26207 i
*> 4.21.153.0/24 154.11.63.85 0 852 3561
7018
26207 26207 26207 26207 i
*> 4.23.112.0/22 154.11.63.85 0 852 174
21889 i
*> 4.23.180.0/24 154.11.63.85 0 852 6128
30576
i
*> 4.36.118.0/24 154.11.63.85 0 852 174
21889 i
*> 4.36.200.0/21 154.11.63.85 0 852 3561
3549
14135 i
*> 4.67.64.0/22 154.11.63.85 0 852 3491
11608
19281 i
*> 6.1.0.0/16 154.11.63.85 0 852 3356
701
668 i
*> 6.2.0.0/22 154.11.63.85 0 852 3356
701
668 i
route-views.on>
And the list goes on. All the matches meet the criteria given: The
AS-Path Begins with the first three characters 123. You don't have to
specify anything beyond that, because you aren't caring. So match what
is asked for, and don't stress out about the + or * or ? Or whatever may
come next, 'cause you'll match it anyway.
In the meantime, it's been fun to watch, but I think you guys stress
yourselves out too much over what began as a simple question.
Scott
PS. Take some time, go to Google and find a BGP Lookingglass server.
Telnet to it, and play around with the "show ip bgp regexp (expression)"
command until your heart is content that you know how it works.
-----Original Message-----
From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf Of
Gustavo Novais
Sent: Thursday, September 22, 2005 5:31 AM
To: simon hart; Schulz, Dave; syv@911networks.com; Leigh Harrison
Cc: Cisco certification
Subject: RE: BGP Reg Exp
Why not use ^123_[0-9]* instead of + and the extra line?
Since the * matches the chars 0 or more times, and the _ char is not
included within [0-9] that would match either ^123$ or ^123_456$ or
^123_65535$ If in doubt of your as-path list you can always do sh ip bgp
regexp to see what matches or not.
Gustavo
-----Original Message-----
From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf Of
simon hart
Sent: quinta-feira, 22 de Setembro de 2005 7:45
To: Schulz, Dave; syv@911networks.com; Leigh Harrison
Cc: Cisco certification
Subject: RE: BGP Reg Exp
Dave,
this was the original answer that I gave:
The Reg Exp you are probably looking for is
^123(_[0-9]+)?$
Which transpires as
^ begins with 123
()? anything within the brackets can occur either no times or once
()?$ so now it will end with either 0 occurrence within the bracket or
one occurrence
[0-9)+ match 1 or more sequence of the numbers 0 to 9
Thus ^123(_[0-9]+)?$ will give you the directly attached AS and there
directly attached clients
A tip for when you doing the lab. The Doc CD has a section regular
expressions within the configuration guide, Part 1 Cisco IOS User Guide,
Using the Command-Line Interface
http://www.cisco.com/univercd/cc/td/doc/product/software/ios122/122cgcr/
ffun
_c/ffcprt1/fcf001.htm#1002051
HTH Simon
-----Original Message-----
From: nobody@groupstudy.com [mailto:nobody@groupstudy.com]On Behalf Of
Schulz, Dave
Sent: 22 September 2005 02:28
To: syv@911networks.com; Leigh Harrison
Cc: Cisco certification
Subject: RE: BGP Reg Exp
Leigh -
I didn't see a follow up on your question. But I believe that if you
want to have the AS123 and it's neighbors, you will need to two lines:
ip as-path access-list 1 permit ^123
ip as-path access-list 1 permit ^123_[0-9]+
Dave Schulz,
Email: dschulz@dpsciences.com
-----Original Message-----
From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf Of
syv@911networks.com
Sent: Sunday, September 18, 2005 5:33 PM
To: Leigh Harrison
Cc: Cisco certification
Subject: Re: BGP Reg Exp
Leigh Harrison wrote:
> All,
>
> If I wanted to allow a neighboring AS(123) and his directly connected
> AS's to be seen as routes to me, could this be written as:
>
> ip as-path access-list 1 permit ^123_[0-9]*$
http://www.911networks.com/pages/cisco/bgp/regular-expressions.php
> OR
> ip as-path access-list 1 permit ^123_.*$ OR ip as-path access-list 1
> permit ^.+_[0-9]*$ OR ip as-path access-list 1 permit ^.+_.*$ OR ip
> as-path access-list 1 permit ^[0-9]+_[0-9]*$ OR ip as-path access-list
> 1 permit ^[0-9]+_.*$
>
> Could someone have a quick look and let me know if that would be the
> same thing ? I think I'm getting there!! The only niggle in the back
> of my mind is ^123_.*$ (for example), would I need a "+" after the 123
?
>
> Many thanks,
> LH
>
>
This archive was generated by hypermail 2.1.4 : Sun Oct 02 2005 - 14:40:16 GMT-3