cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
625
Views
0
Helpful
5
Replies

BGP question

itchampnz
Level 1
Level 1

Hi, I have a router running BGP with 2 peers.

From Peer A I receive e.g.

1.0.0.0/8

10.0.0.0/8

192.168.0.0/16

I want to advertise these to Peer B as:

1.0.0.0/9

1.128.0.0/9

10.0.0.0/9

10.128.0.0/9

192.168.0.0/17

192.168.128.0/17

etc - get the picture... :)

PLease tell me how I can achieve that. Everything I tried had failed. I used aggregate and prefix lists out etc, I could not get the routes to convert from a /8 to become 2 /9's.

Is it at possible ??

Many thanks

1 Accepted Solution

Accepted Solutions

Hello,

you could use BGP conditional route injection, which allows you to create of more-specific components when an aggregate exists. Your configuration would look like this:

router bgp 1

bgp inject-map SPECIFIC exist-map AGGREGATE

!

route-map AGGREGATE permit 10

match ip address prefix-list ROUTE_1

match ip route-source prefix-list ROUTE_SOURCE_1

!

route-map AGGREGATE permit 20

match ip address prefix-list ROUTE2

match ip route-source prefix-list ROUTE_SOURCE_1

!

route-map AGGREGATE permit 30

match ip address prefix-list ROUTE3

match ip route-source prefix-list ROUTE_SOURCE_1

!

route-map AGGREGATE permit 40

!

route-map SPECIFIC permit 10

set ip address prefix-list SPECIFIC_ROUTES_1

!

route-map SPECIFIC permit 20

set ip address prefix-list SPECIFIC_ROUTES_2

!

route-map SPECIFIC permit 30

set ip address prefix-list SPECIFIC_ROUTES_3

!

route-map SPECIFIC permit 40

!

ip prefix-list ROUTE1 permit 1.0.0.0/8

ip prefix-list ROUTE2 permit 10.0.0.0/8

ip prefix-list ROUTE3 permit 192.168.0.0/16

!

ip prefix-list SPECIFIC_ROUTES_1 permit 1.0.0.0/9

ip prefix-list SPECIFIC_ROUTES_1 permit 1.128.0.0/9

!

ip prefix-list SPECIFIC_ROUTES_2 permit 10.0.0.0/9

ip prefix-list SPECIFIC_ROUTES_2 permit 10.128.0.0/9

!

ip prefix-list SPECIFIC_ROUTES_3 permit 192.168.0.0/17

ip prefix-list SPECIFIC_ROUTES_3 permit 192.168.128.0/17

!

ip prefix-list ROUTE_SOURCE permit X.X.X.X/32

The IP address in the last prefix-list, ROUTE_SOURCE, must be the one of your BGP neighbor, that is, the neighbor the aggregate routes are coming from.

I hope I got this config right, it is late...

But this should inject the more specific routes into the local BGP RIB...

HTH,

GP

View solution in original post

5 Replies 5

sachins_shinde
Level 1
Level 1

Hi

Make sure that /9 routes must be present in BGP router's IGP or else disable the synchronisation.

let me know if this work ??

Sachin

johansens
Level 4
Level 4

Hi there,

AFAIK it's not possible to dynamically split a larger prefix into smaller prefixes as long as you are not the originator for the prefixes.

In other words, you'll have to insert the smaller prefixes manually and advertise them to Peer B, something like this (not tested, may contain errors):

router bgp 65000

neighbor 1.2.3.4 remote-as 65001

neighbor 1.2.3.4 route-map to-peer-a out

neighbor 2.3.4.5 remote-as 65002

neighbor 2.3.4.5 route-map to-peer-b out

network 1.0.0.0 mask 255.128.0.0

network 1.128.0.0 mask 255.128.0.0

network 10.0.0.0 mask 255.128.0.0

network 10.128.0.0 mask 255.128.0.0

network 192.168.0.0 mask 255.255.128.0

network 192.168.128.0 mask 255.255.128.0

!

ip route 1.0.0.0 255.128.0.0 1.2.3.4

ip route 1.128.0.0 255.128.0.0 1.2.3.4

ip route 10.0.0.0 255.128.0.0 1.2.3.4

ip route 10.128.0.0 255.128.0.0 1.2.3.4

ip route 192.168.0.0 255.255.128.0 1.2.3.4

ip route 192.168.128.0 255.255.128.0 1.2.3.4

!

ip prefix-list to-peer-b seq 10 permit 1.0.0.0/9

ip prefix-list to-peer-b seq 20 permit 1.128.0.0/9

ip prefix-list to-peer-b seq 30 permit 10.0.0.0/9

ip prefix-list to-peer-b seq 40 permit 10.128.0.0/9

ip prefix-list to-peer-b seq 50 permit 192.168.0.0/17

ip prefix-list to-peer-b seq 60 permit 192.168.128.0/17

!

route-map to-peer-b permit 10

match ip prefix-list to-peer-b

!

route-map to-peer-a deny 10

match ip prefix-list to-peer-b

!

route-map to-peer-a permit 20

!

Did it help? If so, please rate it.

Hello,

you could use BGP conditional route injection, which allows you to create of more-specific components when an aggregate exists. Your configuration would look like this:

router bgp 1

bgp inject-map SPECIFIC exist-map AGGREGATE

!

route-map AGGREGATE permit 10

match ip address prefix-list ROUTE_1

match ip route-source prefix-list ROUTE_SOURCE_1

!

route-map AGGREGATE permit 20

match ip address prefix-list ROUTE2

match ip route-source prefix-list ROUTE_SOURCE_1

!

route-map AGGREGATE permit 30

match ip address prefix-list ROUTE3

match ip route-source prefix-list ROUTE_SOURCE_1

!

route-map AGGREGATE permit 40

!

route-map SPECIFIC permit 10

set ip address prefix-list SPECIFIC_ROUTES_1

!

route-map SPECIFIC permit 20

set ip address prefix-list SPECIFIC_ROUTES_2

!

route-map SPECIFIC permit 30

set ip address prefix-list SPECIFIC_ROUTES_3

!

route-map SPECIFIC permit 40

!

ip prefix-list ROUTE1 permit 1.0.0.0/8

ip prefix-list ROUTE2 permit 10.0.0.0/8

ip prefix-list ROUTE3 permit 192.168.0.0/16

!

ip prefix-list SPECIFIC_ROUTES_1 permit 1.0.0.0/9

ip prefix-list SPECIFIC_ROUTES_1 permit 1.128.0.0/9

!

ip prefix-list SPECIFIC_ROUTES_2 permit 10.0.0.0/9

ip prefix-list SPECIFIC_ROUTES_2 permit 10.128.0.0/9

!

ip prefix-list SPECIFIC_ROUTES_3 permit 192.168.0.0/17

ip prefix-list SPECIFIC_ROUTES_3 permit 192.168.128.0/17

!

ip prefix-list ROUTE_SOURCE permit X.X.X.X/32

The IP address in the last prefix-list, ROUTE_SOURCE, must be the one of your BGP neighbor, that is, the neighbor the aggregate routes are coming from.

I hope I got this config right, it is late...

But this should inject the more specific routes into the local BGP RIB...

HTH,

GP

Thanks. johansens I had already done what you suggested as a workaround prior to posting her first. You are correct in that it works, the issue is tho it takes away the concept of dynamic routing as statics are now in there.

GP, I am going to run your suggestion up in the lab, thank you for your time so far and I will post back in a day or 2 with results.

Thanks guys

GP, works a treat, thanks !!!!!!

My next hurdle is whether or not I want to go down the path of 2 route maps per subnet.

Thanks

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:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco