cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6414
Views
0
Helpful
6
Replies

ios regular expression

aruldaspr
Level 1
Level 1

Hi Experts

can you please help me for the below as-path filter creation -IOS XR

 

I am AS-500 and i have peering with AS-200 (my customer ) .AS-200 have peering with there customers for example AS-20 ,100.
how can i created as filter TEST for sending all routes from my cutomer AS-200 to my uplink providers.need to consider as prepending from customer side


as-path-set TEST
ios-regex '^$',-----routes orginated in AS-500
ios-regex '^200',---routes orginated in AS-200
ios-regex '200+ .* (100|20)'- routes orginated in as 100 and as-20 ( as-200 customers)
end-set

 

Regards

 

1 Accepted Solution

Accepted Solutions

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello aruldaspr,

follow the document below that provides context for Route Policy Language in IOS XR

 

https://community.cisco.com/t5/service-providers-documents/asr9000-xr-understanding-and-using-rpl-route-policy-language/ta-p/3117050?dtid=osscdc000283

 

About the as-set to be configured to pass prefixes that are locally originated or coming from customer AS 200 or coming from AS200 but originated in AS200 customers ASes 100 or 20 you need to use the anchor characters.

Specifically "^" means beginning of the AS path attribute and "$" means end of the AS path attribute.

 

For example A route is originated by AS 100 if AS100 is the last in the AS path attribute and matches the regexp '_100$'

The special character "_" means a separator in the AS path like a space.

 

Let's review your proposed configuration

 

as-path-set TEST
ios-regex '^$',-----routes orginated in AS-500    ! empty AS path this is fine


ios-regex '^200',---routes orginated in AS-200   ! this line is wrong it matches every AS path starting with AS 200

the best formulation is

ios-regex '^200$'

but this does not handle AS path prepending performed by AS200

so you should add

ios-regex '^200_+.*(200_)+200$'
ios-regex '200+ .* (100|20)'- routes orginated in as 100 and as-20 ( as-200 customers)

I would see it as:

ios-regex '^200_+.*(100_|20_)+ (100|20)$'
end-set

 

to be noted you can also avoid to use the regular expression if you use specific match commands like

neighbor is     ! here you specify the peer AS AS 200 in your case

originates-from    ! here you specify AS 100 or AS 20

 

see the following reference

https://www.cisco.com/c/en/us/td/docs/routers/crs/software/crs-r6-4/routing/command/reference/b-routing-cr-crs-64x/b-routing-cr-crs-64x_chapter_01010.html?dtid=osscdc000283#ref_1116431

 

Hope to help

Giuseppe

 

 

 

 

View solution in original post

6 Replies 6

Martin L
VIP
VIP

 i assume u have access to bgp router of your customer AS-200, right?

Hello,

 

--> how can i created as filter TEST for sending all routes from my cutomer AS-200 to my uplink providers.need to consider as prepending from customer side

 

It is unclear what you are trying to do. Who are your uplink providers ?

Can you provide a schematic drawing of your topology including the ASs involved and what you try to filter going where ?

Hello Georg,

attaching diagram 

as-path-set TEST  is calling in a route-policy that is applied on AS500 out to uplink AS ( As 200 is transit customer for as 500 )

I need to announce all the routes originated in AS 200,20,100 to my uplinks .

 

Regards

 

 

 

 

 

 

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello aruldaspr,

follow the document below that provides context for Route Policy Language in IOS XR

 

https://community.cisco.com/t5/service-providers-documents/asr9000-xr-understanding-and-using-rpl-route-policy-language/ta-p/3117050?dtid=osscdc000283

 

About the as-set to be configured to pass prefixes that are locally originated or coming from customer AS 200 or coming from AS200 but originated in AS200 customers ASes 100 or 20 you need to use the anchor characters.

Specifically "^" means beginning of the AS path attribute and "$" means end of the AS path attribute.

 

For example A route is originated by AS 100 if AS100 is the last in the AS path attribute and matches the regexp '_100$'

The special character "_" means a separator in the AS path like a space.

 

Let's review your proposed configuration

 

as-path-set TEST
ios-regex '^$',-----routes orginated in AS-500    ! empty AS path this is fine


ios-regex '^200',---routes orginated in AS-200   ! this line is wrong it matches every AS path starting with AS 200

the best formulation is

ios-regex '^200$'

but this does not handle AS path prepending performed by AS200

so you should add

ios-regex '^200_+.*(200_)+200$'
ios-regex '200+ .* (100|20)'- routes orginated in as 100 and as-20 ( as-200 customers)

I would see it as:

ios-regex '^200_+.*(100_|20_)+ (100|20)$'
end-set

 

to be noted you can also avoid to use the regular expression if you use specific match commands like

neighbor is     ! here you specify the peer AS AS 200 in your case

originates-from    ! here you specify AS 100 or AS 20

 

see the following reference

https://www.cisco.com/c/en/us/td/docs/routers/crs/software/crs-r6-4/routing/command/reference/b-routing-cr-crs-64x/b-routing-cr-crs-64x_chapter_01010.html?dtid=osscdc000283#ref_1116431

 

Hope to help

Giuseppe

 

 

 

 

Dear Giuseppe,

 

Thank you

 

i will configure and update thank you for your support.

 

Regards

Aruldas

Dear Giuseppee,

Thans for your help

 

One more ,

 

I am in AS200 and my customer is AS300 , I need to accept and advertise  all the prefixes from AS300 ( including AS300 routes and its customer AS routes not only AS300 directly connected customers routes, from all AS behind  AS300 Customers )

 

ios-regex ^300_

 

how we can create bgp regular expression for this

Review Cisco Networking for a $25 gift card