cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
572
Views
12
Helpful
7
Replies

Route-map and match command to different things

Matt qomat
Level 1
Level 1

Hi,

I wonder if anyone can help with my concern. Let's say we have 100 subnets. I want to prepend only half of them. So I'll build a route-map applyed on BGP neighbor matching the prefix-list of all those subnets and setting a prepend. But how to prepend only half of them? doing match one prefix-list and than match the other I think has and in between so set prepend will match both. Please help

7 Replies 7

royalblues
Level 10
Level 10

Create a seperate prefix-list for the subnets u need to do as prepend and configure a route-map

something like this

R1

router bgp 1

no synchronization

bgp log-neighbor-changes

network 1.0.0.0

network 2.0.0.0

neighbor 10.10.10.2 remote-as 2

neighbor 10.10.10.2 prefix-list out out

neighbor 10.10.10.2 route-map prepend out

no auto-summary

ip prefix-list prependlist seq 10 permit 1.0.0.0/8

route-map prepend permit 10

match ip address prefix-list prependlist

set as-path prepend 1 1 1 1

route-map prepend permit 20

R2

router bgp 2

no synchronization

bgp log-neighbor-changes

neighbor 10.10.10.1 remote-as 1

no auto-summary

R2#sh ip bgp

BGP table version is 13, local router ID is 10.10.10.2

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path

*>1.0.0.0 10.10.10.1 0 0 1 1 1 1 1 i

*> 2.0.0.0 10.10.10.1 0 0 1 i

HTH

Narayan

So if you have let say 3 subnets and you want them all advertise but only two of them to prepand. Based on your notes I thought about

route-map prepend permit 10

match ip address prefix-list prependlist

set as-path prepend 1111

route-map prepend permit 20

match ip address prefix-list 3rdsubnet

So that should prepned all the subnets from prependlist and send clear 3rd, right?

No need to match anything under the second route map

route-map prepend permit 10

match ip address prefix-list prependlist

set as-path prepend 1111

route-map prepend permit 20

will do .. include only the subnets that u want to have as path prepends as part of prefix-lists

Narayan

Hi,

Can the same be achieved just using an access list in the route-map like

route-map prepend permit 10

match ip address 3

set as-path prepend 1111

route-map prepend permit 20

ip access-list 3 permit X.X.X.X

if we dont have to add anything under route-map prepend permit 20 then why are doing this command exactly

thanks in advance

subra

Subra

If you dont add the 2md route-map command, it will only send out the prefixes that match the list and filter everythign else

The 2nd map actually will ensure all the other prefixes which are not to be prepended to be matched and advertised.

use of prefix-lists are more beneficial as it uses CIDR notation

HTH

Narayan

But I also have subnets that I do not want to advertise. So its not like all other will not be prepended. I guess i do need match those that will not be prepended so that site act as originator.

Yes thats correct..

Create a sperate prefix-list and match them under the 2nd route-map but do not add any set command

Narayan

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