BGP 001 – Route Advertisement from Indirect Sources
We have a topology like below. R1 and R2 have BGP neighborship. R1 have 1 static route to R3 and 1 OSPF route to R4. We want to see the prefixes on R2.

Configurations on R1 like below;
IOU1# sh run | inc "some lines of I want to show"
ip route 192.168.0.3 255.255.255.255 13.13.13.3
!
ip access-list standard ACL_001
10 permit 192.168.0.4
!
route-map MAP_001 permit 1
match ip address ACL_001
!
router ospf 1
router-id 192.168.0.1
network 14.14.14.1 0.0.0.0 area 0
network 192.168.0.1 0.0.0.0 area 0
!
router bgp 65100
bgp log-neighbor-changes
neighbor 12.12.12.2 remote-as 65200
!
address-family ipv4
network 192.168.0.1 mask 255.255.255.255
redistribute static
redistribute ospf 1 route-map MAP_001
neighbor 12.12.12.2 activate
exit-address-family
!
IOU1#sh ip route | inc 192.168.0
192.168.0.0/32 is subnetted, 3 subnets
C 192.168.0.1 is directly connected, Loopback0
S 192.168.0.3 [1/0] via 13.13.13.3
O 192.168.0.4 [110/11] via 14.14.14.4, 00:00:37, Ethernet0/1
I want to talk about ALC_001 and MAP_001. In the neighborship between R1 and R4, I also have the OSPF prefix 14.14.14.0/24, which is used between R1 and R4. However, I do not want to advertise it to R2, so I filtered it out.
Configurations on R2;
IOU2#sh run | sec bgp
router bgp 65200
bgp log-neighbor-changes
neighbor 12.12.12.1 remote-as 65100
!
address-family ipv4
neighbor 12.12.12.1 activate
exit-address-family
!
IOU2#sh ip bgp ipv4 unicast | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 192.168.0.1/32 12.12.12.1 0 0 65100 i
*> 192.168.0.3/32 12.12.12.1 0 0 65100 ?
*> 192.168.0.4/32 12.12.12.1 11 0 65100 ?On R2, as shown above, when I receive a route from a directly connected neighbor, its origin is āiā, which means IGP. Other networks that I receive through redistribution have an origin of ā?ā, which means incomplete. Another point I want to highlight is that the prefix I receive from OSPF has a metric of 11.
In a later post, I will address how to redistribute only the specific neighbor I want. With the method I used here, I believe it will redistribute to all neighbors.
There are two ways to do that; First one is just using route-map permit and deny. Second one is tagging OSPF routes. Let’s try first one. To do it I added some lines to connect R5. All BGP config and new topology are below.

router bgp 65100
bgp log-neighbor-changes
neighbor 12.12.12.2 remote-as 65200
neighbor 15.15.15.5 remote-as 65300
!
address-family ipv4
network 192.168.0.1 mask 255.255.255.255
redistribute static
neighbor 12.12.12.2 activate
neighbor 15.15.15.5 activate
exit-address-familyNow let’s try to check if R5 received all redistributed prefixes.
IOU5#sh bgp ipv4 unicast | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 192.168.0.1/32 15.15.15.1 0 0 65100 i
*> 192.168.0.3/32 15.15.15.1 0 0 65100 ?
*> 192.168.0.4/32 15.15.15.1 11 0 65100 ?Yes, we see all. Now on R1 let’s add the lines below.
ip prefix-list PREFIX_TO_R5 seq 5 permit 192.168.0.1/32
!
route-map FILTER_R5 permit 10
match ip address prefix-list PREFIX_TO_R5
!
router bgp 65100
neighbor 15.15.15.5 remote-as 65300
!
address-family ipv4
neighbor 15.15.15.5 route-map FILTER_R5 outNow let’s try to check if R5 received just the R1 loopback address.
IOU5#sh bgp ipv4 unicast | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 192.168.0.1/32 15.15.15.1 0 0 65100 iThat’s it.
Now, let’s try to tag OSPF prefix and redistribute tagged prefixes. On my device , it couldn’t be supported tagging in route-map. Maybe I will try later on another platform.