Re: BGP Regular Expression - logic help

From: James (james@towardex.com)
Date: Mon Jul 12 2004 - 18:46:39 GMT-3


> I think ^4_[0-9]*$
>
> will not match routes originated in AS4
>
> It will try to match the "_" character (i just tested in on
> 'route-server.ip.att.net' !! Nice Tip)
>
> sh ip bgp reg-exp ^7018_[0-9]*$ will not match 7018 routes

Hmmmm... You sure? :P It is important to note that [0-9] denotes an ASN in
the path. The tail _ can match either ASN_<IGP|EGP|INCMP> or ASN_ASN.

-J

route-server>sh ip bgp reg _27552_[0-9]*$
BGP table version is 1762977, local router ID is 12.0.1.28
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network Next Hop Metric LocPrf Weight Path
* 65.116.132.0/24 12.123.37.250 0 7018 209 27552 i
* 12.123.13.241 0 7018 209 27552 i
* 12.123.17.244 0 7018 209 27552 i
* 12.123.21.243 0 7018 209 27552 i
* 12.123.133.124 0 7018 209 27552 i
* 12.123.134.124 0 7018 209 27552 i
* 12.123.45.252 0 7018 209 27552 i
* 12.123.137.124 0 7018 209 27552 i
... etc

route-server>sh ip bgp reg ^7018_[0-9]*$
... scroll a few times closely ...
* 12.0.0.0 12.123.21.243 0 7018 i
   Network Next Hop Metric LocPrf Weight Path
* 12.123.9.241 0 7018 i
* 12.123.45.252 0 7018 i
* 12.123.134.124 0 7018 i
* 12.123.5.240 0 7018 i
* 12.123.137.124 0 7018 i
* 12.123.41.250 0 7018 i
* 12.123.133.124 0 7018 i
* 12.123.37.250 0 7018 i
* 12.123.142.124 0 7018 i
* 12.123.145.124 0 7018 i
* 12.123.199.239 0 7018 i
* 12.123.25.245 0 7018 i
* 12.123.196.111 0 7018 i
* 12.123.29.249 0 7018 i
* 12.123.33.249 0 7018 i
* 12.123.1.236 0 7018 i
* 12.123.17.244 0 7018 i
* 12.123.139.124 0 7018 i
...

-- 
James Jun                                            TowardEX Technologies, Inc.
Technical Lead                        Network Design, Consulting, IT Outsourcing
james@towardex.com                  Boston-based Colocation & Bandwidth Services
cell: 1(978)-394-2867           web: http://www.towardex.com , noc: www.twdx.net
On Mon, Jul 12, 2004 at 11:40:49PM +0200, Geert Nijs wrote:
> 
> 
> Better is:
> 
> ^7018(_[0-9]+)?$		: this optionally allows one extra AS
> number after 7018
> 
> 
> REgards,
> Geert
> 
> 
> 
> 
> 
> 
> 
>   and 'sh ip bgp reg <REGEX>'
> 
> -----Oorspronkelijk bericht-----
> Van: nobody@groupstudy.com [mailto:nobody@groupstudy.com] Namens James
> Verzonden: maandag 12 juli 2004 4:43
> Aan: Adel Abouchaev
> CC: 'group study'
> Onderwerp: Re: BGP Regular Expression - logic help
> 
> 
> > I think it is  ^(.+_)*4(_.+)?$
> > 
> > because ^4_[0-9]*$ will not match 3 2 1 4, or 3 2 1 4 5. This will 
> > only
> 
> _4_[0-9]*$
> 
> > 
> > I think + is more appropriate here than *, since AS number must have 
> > at
> > least one digit in it.
> 
> + requires minimum object match
> 4_[0-9]+$ will match:
>  4 1 IGP
>  4 3 IGP
>  4 101 IGP
>  etc.
> 
> and will not match:
>  4 IGP
> 
> a good way to test out your regex is:
>   telnet route-views.oregon-ix.net or route-server.ip.att.net
> 
>   and 'sh ip bgp reg <REGEX>'
> 
> -J
> 
> 
> > 
> > Cheers,
> > 
> > Adel Abouchaev
> > CCIE# 12037
> > www.netmasterclass.net
> > 
> > 
> > 
> > Joe Deleonardo wrote:
> > 
> > >D'OH! Light just went on.
> > >
> > >The * refers to what's inside the [ ]
> > >
> > >I was thinking it meant something more like ([0-9]*)*
> > >
> > >Cool! Thanks! That helped a lot!
> > >
> > >Cheers,
> > >
> > >Joe
> > >
> > >
> > >-----Original Message-----
> > >From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf 
> > >Of James
> > >Sent: Sunday, July 11, 2004 5:45 PM
> > >To: Joe Deleonardo
> > >Cc: 'group study'
> > >Subject: Re: BGP Regular Expression - logic help
> > >
> > > 
> > >
> > >>It seems like ^4_[0-9]?$ would be what we should use to get "Only 
> > >>Networks Originated from AS 4, and ASs Directly Attached to AS 4" 
> > >>No?
> > >>   
> > >>
> > >
> > >I believe ^4_[0-9]*$ should do your needs..
> > >
> > > 
> > >
> > >>So what do you guys think? Am I over thinking this? Yes ^4_[0-9]*$ 
> > >>will
> > >>   
> > >>
> > >get
> > > 
> > >
> > >>you what you want but it seems like, you'll also get more then AS 4 
> > >>and
> > >>   
> > >>
> > >it's
> > > 
> > >
> > >>directly attached networks.
> > >>   
> > >>
> > >
> > >Hmm..? This seems to do it just fine. _[0-9]* means either match one 
> > >more asn after 4, or match nothing after 4. I know it's a bit 
> > >confusing :)
> > >
> > >output of.. sh ip bgp reg _701_[0-9]*$
> > >*> 6.1.0.0/16       63.239.36.245         1923    100      0 209 701
> 668 i
> > >*> 6.2.0.0/22       63.239.36.245         1923    100      0 209 701
> 668 i
> > >*> 6.3.0.0/18       63.239.36.245         1923    100      0 209 701
> 668 i
> > >*> 6.4.0.0/16       63.239.36.245         1923    100      0 209 701
> 668 i
> > >*> 6.5.0.0/19       63.239.36.245         1923    100      0 209 701
> 668 i
> > >*> 6.8.0.0/20       63.239.36.245         1923    100      0 209 701
> 668 i
> > >*> 6.9.0.0/20       63.239.36.245         1923    100      0 209 701
> 668 i
> > >*> 6.10.0.0/15      63.239.36.245         1923    100      0 209 701
> 668 i
> > >*> 6.14.0.0/15      63.239.36.245         1923    100      0 209 701
> 668 i
> > >*> 12.0.17.0/24     63.239.36.245         1923    100      0 209 701
> 26990 
> > >i
> > >*> 12.1.235.0/24    63.239.36.245         1923    100      0 209 701
> 15184 
> > >i
> > >*> 12.3.54.0/24     63.239.36.245         1923    100      0 209 701
> 25938 
> > >i
> > >*> 12.3.80.0/22     63.239.36.245         1923    100      0 209 701
> 10998 
> > >i
> > >*> 12.3.217.0/24    63.239.36.245         1923    100      0 209 701
> 16666 
> > >i
> > >etc etc etc...
> > >
> > >
> > > 
> > >
> > >>You know if I had the choice of Cisco improving on any one thing - 
> > >>this would be it. There's got to be an easier way to catch this 
> > >>mouse.
> > >>   
> > >>
> > >
> > >JUNOS as-path matching is a heck of a lot easier..
> > >
> > >-J
> > >
> > > 
> > >
> > >>Thanks in advance!
> > >>
> > >>Joe
> > >>
> > >>[GroupStudy removed an attachment of type application/ms-tnef which 
> > >>had a
> > >>   
> > >>
> > >name of winmail.dat]
> > > 
> > >
> > >>____________________________________________________________________
> > >>___
> > >>Please help support GroupStudy by purchasing your study materials
> from:
> > >>http://shop.groupstudy.com
> > >>
> > >>Subscription information may be found at:
> > >>http://www.groupstudy.com/list/CCIELab.html
> > 
> > ______________________________________________________________________
> > _
> > Please help support GroupStudy by purchasing your study materials
> from:
> > http://shop.groupstudy.com
> > 
> > Subscription information may be found at:
> > http://www.groupstudy.com/list/CCIELab.html
> 
> -- 
> James Jun                                            TowardEX
> Technologies, Inc.
> Technical Lead                        Network Design, Consulting, IT
> Outsourcing
> james@towardex.com                  Boston-based Colocation & Bandwidth
> Services
> cell: 1(978)-394-2867           web: http://www.towardex.com , noc:
> www.twdx.net
> 
> _______________________________________________________________________
> Please help support GroupStudy by purchasing your study materials from:
> http://shop.groupstudy.com
> 
> Subscription information may be found at: 
> http://www.groupstudy.com/list/CCIELab.html
> #####################################################################################
> This e-mail and any attached files are confidential and may be legally privileged. 
> If you are not the addressee, any disclosure, reproduction, copying, distribution, 
> or other dissemination or use of this communication is strictly prohibited. 
> If you have received this transmission in error please notify Simac immediately 
> and then delete this e-mail. 
> 
> Simac has taken all reasonable precautions to avoid virusses in this email. 
> Simac does not accept liability for damage by virusses, for the correct and complete 
> transmission of the information, nor for any delay or interruption of the transmission, 
> nor for damages arising from the use of or reliance on the information.
> 
> All e-mail messages addressed to, received or sent by Simac or Simac employees 
> are deemed to be professional in nature. Accordingly, the sender or recipient of 
> these messages agrees that they may be read by other Simac employees than the official 
> recipient or sender in order to ensure the continuity of work-related activities 
> and allow supervision thereof.
> #####################################################################################


This archive was generated by hypermail 2.1.4 : Sun Aug 01 2004 - 10:11:53 GMT-3