BGP regexp

Answered Question
Feb 14th, 2007

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

I have this problem too.
0 votes
Correct Answer by CSCO10892433 about 9 years 7 months ago

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

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
CSCO10892433 Thu, 02/15/2007 - 02:17

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

Danilo Dy Thu, 02/15/2007 - 02:32

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.

Correct Answer
CSCO10892433 Thu, 02/15/2007 - 03:09

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

Actions

This Discussion