cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
741
Views
0
Helpful
4
Replies

BGP regexp

Danilo Dy
VIP Alumni
VIP Alumni

I need some help here as I can't point my finger to the right BGP regexp.

I have multiple upstream, according to the BGP routing table the best path to "AS5" is through upstream "B" (AS2) but I want it to be in upstream "A" (AS1). I'm planning to use local-preference so that it will propagate to all iBGP routers. From provider "A", AS5 is through the following path 1 3 4 5

I'm planning to use route-map in the interface to provider "A"

The configuration look like this;

!

router bgp 100

neighbor ip_address_of_provider_"A" route-map incoming in

!

ip as-path access-list 1 permit ^1_

ip as-path access-list 2 permit ???

!

route-map incoming permit 1

match as-path 1

set local-preference 100

! Here is the route-map for AS5

route-map incoming permit 2

match as-path 2

set local-preference 150

The regexp for AS5 is my problem. I don't want to put 1 3 4 5 as some AS my perform prepending. I also not sure if my route-map will work with two local-preference

Thanks in advance

1 Accepted Solution

Accepted Solutions

Hi, Medan

Please add one line to end of your route map like this

route-map incoming permit 1

match as-path 1

set local-preference 150

route-map incoming permit 2

This will make other routes not be filtered.

HTH

SSLIN

View solution in original post

4 Replies 4

CSCO10892433
Level 4
Level 4

Hi medan

If you are going to apply the route map on link to the provider A, since all the routes advertised by A(AS1) will always have as-path attribute beginning with 1, all routes will be permited by this route map, making the policy useless.What you should do is to match the routes with as-path attribute ending with 5. So change your as-path list as follows

ip as-path access-list 1 permit _5$

and set local-preference to 150 to the routes which match the above as-path list.This should make all paths to AS 5 prefer the way through provider A.

I can't understand what's your intention on the second as-path list.

HTH

SSLIN

Hi SSLIN,

Thank you for your reply.

Ignore the second as-path list. Its for the AS5, I put ??? because I can't figure out the regexp :)

So that means I will have the following;

!

router bgp 100

neighbor ip_address_of_provider_"A" route-map incoming in

!

ip as-path access-list 1 permit _5$

!

route-map incoming permit 1

match as-path 1

set local-preference 150

But this affects all other routes coming from AS1. From 200k prefixes, it goes down to 80 prefixes.

Hi, Medan

Please add one line to end of your route map like this

route-map incoming permit 1

match as-path 1

set local-preference 150

route-map incoming permit 2

This will make other routes not be filtered.

HTH

SSLIN

Hi SSLIN,

It works!

Thank you :)

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card