We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 651 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

426 Sign Ups in the last 30 days

100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!


Forum Replies

  1. Hi Rene,

    Great topic! However, I am having trouble understanding the following expressions: ^3257_[0-9]$
    Ok, so far I understand that the ^3257 is the start of the AS path, so this would be a directly connected AS. I also understand that _ represents any AS paths after 3257 and you would have to define the $ expression to define the last AS path to match on, otherwise all AS paths after 3257 would be considered.
    However, i don’t get the [0-9]
    at all…Can you clarify this by also using the + and ? in substitution for the *?
    I read your BGP Regular Expression topi

    ... Continue reading in our forum

  2. Hi Mario,

    The [0-9] means any number between 0 and 9, this means 0,1,2,3,4,5,6,7,8 and 9 are valid. The * means that we repeat the previous number 0 or multiple times. Basically this means any number from 0 to infinity matches. In our example we have 16 bit AS numbers so that means any AS number from 0 to 65535 will be matched.

    The + is similar to the * but it means that we repeat the previous number 1 or multiple times. In practice, there’s a big difference between the two…for example:

    When I use ^3257_[0-9]*$ then I’m matching everything that starts with AS 3

    ... Continue reading in our forum

  3. Hi Rene,

    Need your expertise on this one… I have a regex script to filter prep-pended AS’s. The issue is when I test it with the “sh ip bgp regexp” cmd; no pre-pended routes are tagged (rightly fully so, because they aren’t configured yet…). So my thought is the script is functional, but when I apply the access list w/ as-path filter all of my routes disappear…

    R1#sh ip bgp | B Net
    Network Next Hop Metric LocPrf Weight Path
    *> 0 32768 i
    *> 0 0 200 i
    *> 0 200 300 i
    *> 0 200 300 400 i
    ... Continue reading in our forum

  4. Hi Jon,

    This regex seems to be valid, I tested it on a looking glass server (routeserver.sunrise.ch):

    RS_AS6730>show ip bgp regexp ^([0-9]+)(_\1)+$
    BGP table version is 1413944297, local router ID is
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
    r RIB-failure, S Stale, m multipath, b backup-path, x best-external
    Origin codes: i - IGP, e - EGP, ? - incomplete
    Network Next Hop Metric LocPrf Weight Path
    *>i1.9.0.0/16 20 80 0 4788 4788 4788 i
    * i 20 80 0 4788 4788 4788 i
    ... Continue reading in our forum

  5. Hi @cradlepoint,

    It is possible to mix route-maps, filter-lists, distribute-lists etc. but it’s better to stick to a single route-map.

    The route-map can do everything you want and it allows you to keep everything in one place. If you want to match on an AS path and set the local preference for those routes, you can do something like this:

    ip as-path access-list 1
     permit ^46435_[0-9]*$
    route-map filter-and-local-pref permit 10
      match as-path 1
     set local-preference 200
    neighbor x.x.x.x route-map filter-and-local-pref in

    Without the empty permit 20 stateme

    ... Continue reading in our forum

25 more replies! Ask a question or join the discussion by visiting our Community Forum