BGP regular expression for 4-byte AS numbers

Hi;

 

I'm working on a topology and trying to test regular expression. I have used 4-bytes AS numbers and have written the regular expression as this:

 

ip as-path access 2 permit ^[1-9]+$

 

I want to permit the routes that are local to the neighboring ASs (I mean the routes with only one AS in AS_PATH). I applied it to the neighbors with filter-list command but it blocked all the routes from the neighbors. regarding to the fact that I have used 4-buyes AS numbers on routers, the BGP routes are shown like this on devices:

 

*   15.15.15.5/32    9.9.9.1                                0 19661100 32768500 i

*>                   11.11.11.1                             0 19661100 32768500 i

* i                  5.5.5.2                  0    100      0 400 32768500 i

 

if the as numbers shown above were in decimal values, the regular expression should worked fine, but it didn't. I suppose that writing regular expression for 4-byte AS numbers must be different. how can I achieve my goal in this scenario?

anyway if there is a good article about using regular expression for 4-byte AS numbers, please let me know. tnx a lot. 

Comments

  • There has to be something wrong in your configuration, or you did not do a route-refresh after applying the filter. Between 2-byte and 4-byte AS number there is a single difference, that the 4-byte AS number can be displayed with or without the '.' by using command "bgp asnotation dot". If you choose to display the '.' and want to match on that AS number you need to match on the '.' as well in your regex.

  • You should be able to test your regexp with show ip bgp regexp <expression>.

  • Hi Timaz and All,

    ip as-path access 2 permit ^[1-9]+$

    Don't the anchors: ^ and $

    Limit the list to match but single ASN?  

    bgp table entries all appear to have 2 ASNs in AS Path

  • Hi Timaz and All,

    ip as-path access 2 permit ^[1-9]+$

    Don't the anchors: ^ and $

    Limit the list to match but single ASN?  

    bgp table entries all appear to have 2 ASNs in AS Path

     

    yes! I need to permit just the networks originated inside the neigboring ASs. this regular expression must work, but it doesn't. maybe I'm using 4-byte AS numbers and there should be a trick somewhere. 

  • Hi Timaz and All,

    Got it.  I'm getting old and sometimes miss the point.   Looks like a great Lab problem![:)]

    Will study tonight.//RandyB

  • following the example in my previous topic, I faced with another example of this. I had some networks in my BGP table and want to aggregate them into one summary route: 8.0.0.0/5. 
    my subnets in my BGP table are as follows, for clarity, I deleted unrelevant parts of the output, so only networks and AS-PATH information are shown as follows:

    9.9.9.5/32----19661100 i
    10.10.10.5/32----32768 i
    11.11.11.5/32----19661100 i
    12.12.12.1/32----19661100 i
    12.12.12.2/32----19661100 i
    12.12.12.3/32----19661100 i
    12.12.12.4/32----19661100 i
    12.12.12.5/32----19661100 i
    12.12.12.6/32----19661100 i
    12.12.12.7/32----19661100 i
    12.12.12.8/32----19661100 i
    12.12.12.9/32----19661100 i
    12.12.12.10/32---19661100 i
    12.12.12.11/32---19661100 i
    12.12.12.12/32---19661100 i
    13.13.13.5/32----19661100 32768500 i
    15.15.15.5/32----19661100 32768500 i


    I wrote these commands on the aggregating router:

    router bgp 200.200
    aggregate-address 8.0.0.0 248.0.0.0 as-set advertise-map ADV_MAP
    !
    route-map ADV_MAP permit 10
    match as-path 3
    !
    ip as-path access-list 3 permit _19661100_
    ip as-path access-list 3 permit _32768500_


    but again the router does not produce any aggregate route based on the advertised-map that has written. I think this problem relates to the regular expression about 4-bytes as numbers. because I have used 4-bytes AS numbers throughout my topology, I should find a solution to this issue. any ideas?

  • Hi Timaz and All,

    Your commands look appropriate and correct.  I used same commands with 15.3(1) IOL and had success.

    using your commands:

    1)  R6#show ip as-path-access-list

    AS path access list 7

        permit ^[0-9]+$

    AS path access list 67

        permit 458759 589833

    R6#

    2)  called by:

    R6#show route-map

    route-map BGP_R7_IN, permit, sequence 10

      Match clauses:

        as-path (as-path filter): 7 67

      Set clauses:

      Policy routing matches: 0 packets, 0 bytes

    neighbor 67.0.0.7 route-map BGP_R7_IN in

    3)  Got matches for:

    R6#show ip bgp route-map BGP_R7_IN


    <snip>

         Network          Next Hop            Metric LocPrf Weight Path

     *>  7.7.7.7/32       67.0.0.7                 0             0 458759 i

     *>  9.9.9.9/32       67.0.0.7                               0 458759 589833 i

    R6#

    ******

    Please re-check config; check on INE lab routers.  Thank you for your post.

    I still have to check prefix aggregation using IOS 15.3(1) IOL.  



    Also, ASN4 with Communities.  And ASN4 talker with ASN2 talker; how does that work?//RandyB
Sign In or Register to comment.