cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
847
Views
1
Helpful
3
Replies

BGP - exclude a network from learning

manvik
Level 3
Level 3

My other other end BGP peer advertises a lot of network, including my side local network. I want my end device to exclude one network from learning (like 192.168.2.0/24).

Are there any BGP commands for this.

 

3 Replies 3

@manvik hi, this is possible.

use BGP distribute-list list with ACL. check below sample

https://networklessons.com/bgp/bgp-extended-access-list-filtering

Please rate this and mark as solution/answer, if this resolved your issue
Good luck
KB

M02@rt37
VIP
VIP

Hello @manvik,

To exclude a specific network from being advertised or learned, you can use a route map or an access list to filter the routes.

For Advertisement (Outbound):

access-list 1 deny 192.168.2.0 0.0.0.255
access-list 1 permit any

route-map exclude-network permit 10
match ip address 1

Apply the route-map in outbound:

router bgp <your-BGP-AS>
neighbor <peer-IP> route-map exclude-network out

For Learning (Inbound):

access-list 2 deny 192.168.2.0 0.0.0.255
access-list 2 permit any

route-map exclude-network-in permit 10
match ip address 2

Apply the route-map in inbound:

router bgp <your-BGP-AS>
neighbor <peer-IP> route-map exclude-network-in in

--These configurations will exclude the 192.168.2.0/24 network from being advertised to or learned from your BGP peer.

 

 

 

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

local network meaning it re-advertise this prefix to you?
if yes the BGP drop this prefix automatic since your AS include in your prefix AS-path attribute. 

if NOT that case then you need Inbound 
ip prefix-list mhm 10 deny 192.168.2.0/24 
ip prefix-list mhm 20 permit 0.0.0.0/0 

route-map mhm permit 10 
match ip add prefix-list mhm

router bgp xx
neighbor x.x.x.x route-map mhm IN 

that what you need 

Thanks A Lot
MHM