cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2715
Views
5
Helpful
6
Replies

Redistribute only /32 prefixes via BGP

Tauer Drumond
Level 1
Level 1

Hi all,

I have a simple topology, where R1 is connected to R2 with a BGP session between them.

On R1, I have a static route: 10.0.130.0 255.255.255.0 192.168.0.1

I just want send to R2 only prefixes 10.0.130.18/32 and 10.0.130.58/32, not all 10.0.130.0/24 network

Is there a way to accomplish that?

Thank you

6 Replies 6

willwetherman
Spotlight
Spotlight

Hi Tauer,

Yes, a simple way is to add static routes for the /32 networks in addition to the /24 and then advertise them into BGP using the network command.

For example:

ip route 10.0.130.0 255.255.255.0 192.168.0.1

ip route 10.0.130.18 255.255.255.255 192.168.0.1

ip route 10.0.130.58 255.255.255.255 192.168.0.1

router bgp 100

 network 10.0.130.18 mask 255.255.255.255

 network 10.0.130.58 mask 255.255.255.255

Hope that helps

Yaron Golan
Level 1
Level 1

Hi Tauer,

you can use the Null 0 Routes from the advertise router. 

and filter it by distribute list.

R1:

Static Routes:

ip route 10.0.130.18 255.255.255.255 null 0

ip route 10.0.130.58 255.255.255.255 null 0

ACL:

access-list 1 permit 10.0.130.18 0.0.0.0

access-list 1 permit 10.0.130.58 0.0.0.0

BGP:

router bgp 100

 network 10.0.130.18 mask 255.255.255.255

 network 10.0.130.58 mask 255.255.255.255

 network 10.0.130.0 mask 255.255.255.0

 neighbor R2 remote as x 

 neighbor R2 distribute-list 1 out

Thanks for the answer, but sorry, I forgot to mention... in this scenario, I can't use static routes.

In fact, I receive the prefix 10.0.130.0/24 via a routing protocol.

I'd like to advertise only 10.0.130.18/32 and 10.0.130.58/32 to R2

Sorry to describe the wrong scenario

You have to see the problem like this: BGP will not advertise something (network) that doesn't exist in your routing table. You need to have a specific subnet in your routing table, before it can be advertised through BGP.

Hi Yaron,

thanks for the answer.

Yes, I have this in mind... but I'm just trying to figure out if there's some workaround (wihtout using static routes)

I had no luck so far

Philip D'Ath
VIP Alumni
VIP Alumni

What about a different approach.  What you are describing to be is policy routing.

Why not just configure policy-routing on R2?