cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
702
Views
0
Helpful
2
Replies

routing table prefers the longest match..I want to modify this behavior.

nikhil.kulkarni
Level 1
Level 1

Hi Folks,

For some requirements I need to block some routes into our network. To give you a example say I want to block 1.1.0.0 /16 in my network, I have done so by adding a static Null route on our ISP facing router.

Now the drawback for this solution really comes on when I see a route matching a specific prefix being learnt by BGP, example 1.1.1.0 /24 being learnt and not being blocked.

What could be the recommendation to achieve this?

Regards,

Nikhil Kulkarni.

2 Replies 2

cadet alain
VIP Alumni
VIP Alumni

Hi,

let's suppose you want to block 1.1.1.0/24 learned via BGP:

ip prefix-list BLOCK_PREF deny 1.1.1.0/24

ip prefix-list BLOCK_PREF permit 0.0.0.0/0 le 32

router bgp xxx

neighbor x.x.x.x  prefix-list in

do clear ip bgp neighbor x.x.x.x in

Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Nikhil,

Hello Nikhil,

you need to implement route filtering in the inbound receiving direction.

Following your example if you want to be sure that your router will not accept any specific route within address block 1.1.0.0/16 you can use a prefix-list like

ip prefix-list UNWANTED_ROUTES  permit 1.1.0.0/16 le 32

route-map  INBOUND  deny 10

match ip address prefix UNWANTED_ROUTES

! next empty route-map block to allow all other routes

route-map INBOUND permit 20

router bgp

neigh x.x.x.x route-map INBOUND in

For each address-block you want no component route to be accepted you will add a line to prefix-list UNWANTED_ROUTES like

ip prefix-list UNWANTED_ROUTES  A.B:C:D/len  le 32

Hope to help

Giuseppe

Review Cisco Networking for a $25 gift card