cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6087
Views
15
Helpful
7
Replies

ip as-path access-list question

johnelliot6
Level 2
Level 2

Hi,

Can someone please help me with an as-path acl regex?

We are peering with a customer, and accepting one(or more) of there AS's(Example below using AS "1234")

ip as-path access-list 30 permit ^1234(_1234)*$

The customer wants to start advertising a new range to us, and also a new AS (They are peering with there client)

So resultant AS path will be "1234 new_as"  (But can be any number of the 2 AS's, so could be "1234 1234 new_as new_as" etc)

Hope someone can assist

Cheers

7 Replies 7

Abzal
Level 7
Level 7

Hi,

Configuration seems ok. Either you can use:

ip as-path access-list 30 permit ^1234(_[0-9]+)+$
http://blog.ine.com/tag/as-path/

Abzal

Best regards,
Abzal

Thanks - So to permit AS 1234 and 5678 (And any number of prepends), I could use:

^(_1234)+(_5678)$

Hi,

It really depends

if it is learned from AS1234 and next will be AS5678 (plus one or more prepends) then:

^1234(_5678)+$         --> e.g   AS 1234 -----  AS 5678 -----  AS 5678(one or more) ---- your AS     

^(1234)+(_5678)+$                 AS 1234  ----   AS 1234(one or more)  ----  AS 5678 ----  AS 5678(one or more) --- your AS

If these ASes located along the path:

^([0-9]+)+(_1234)+(_5678)+$

Above link is very useful have a look on it.

Hope it will help.

Best regards,
Abzal

Best regards,
Abzal

Thanks very much Abzal - much appreciated.

To confirm, the regex: 

^(1234)+(_5678)+$

would match AS paths such as:

1234

1234 1234

1234 5678

1234 5678 5678

...

Or would it also require a "_" in front of 1234?(To match one or more "1234")  i.e.

^(_1234)+(_5678)+$

Hi,

I've just tested it and required result gave only this access-list

^(1234)(_[1-4]+)?(_5678)?(_[5-8]+)?$

it will match

1234

1234 1234

1234 5678

1234 1234 5678

1234 1234 5678 5678

1234 5678 5678

Hope it will help.

Best regards,
Abzal

Best regards,
Abzal

[1-4]+  is not what you want, it matches 11, 111, 1113, 3322 etc. so any number of repetitions of any digits in the 1,2,3,4 interval

I would write

ip as-path access-list 30 permit ^1234(_1234)*(_5678)*$

HI,

why do we using as-path attributes ? can anyone explain.

Review Cisco Networking for a $25 gift card