Hello Hussein,
That is no problem. You advertise the network with the network command and then use route-maps to filter what you need.
Here’s R1 advertising to R2:
R1#show ip bgp neighbors 192.168.12.2 advertised-routes
BGP table version is 4, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 i
Total number of prefixes 1
And to R3:
R1#show ip bgp neighbors 192.168.13.3 advertised-routes
BGP table version is 4, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 i
*> 2.2.2.2/32 192.168.12.2 0 0 2 i
Total number of prefixes 2
If you want to filter 1.1.1.1/32 from being advertised to R3, do something like this:
R1(config)#ip prefix-list R1_L0 permit 1.1.1.1/32
R1(config)#route-map TO_R3 deny 10
R1(config-route-map)#match ip address prefix-list R1_L0
R1(config)#route-map TO_R3 permit 20
R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.13.3 route-map TO_R3 out
And it’s gone:
R1#show ip bgp neighbors 192.168.13.3 advertised-routes
BGP table version is 4, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 2.2.2.2/32 192.168.12.2 0 0 2 i
Total number of prefixes 1
Hope this helps!
Rene