11-12-2023 09:09 PM
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.
11-12-2023 09:42 PM
@manvik hi, this is possible.
use BGP distribute-list list with ACL. check below sample
https://networklessons.com/bgp/bgp-extended-access-list-filtering
11-12-2023 09:48 PM
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.
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
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.
11-13-2023 12:21 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide