This simulation has RIP and OSPF doing route redistribution with a loop. I used route maps for several things 1.) rip-into-ospf
route-map rip-into-ospf deny 10 match tag 110 ! route-map rip-into-ospf permit 20 set tag 120 ! route-map rip-into-ospf permit 30
This prevents OSPF routes tagged 110 (OSPF AD) from returning into OSPF from RIP. It tags all RIP routes with 120 (RIP AD). This prevents the loop from happening on the RIP side.
I added in a few extra items to take care of sub-optimal routing from RIP to OSPF.
route-map ospf-into-rip permit 1 match ip address 105 set metric 2 set tag 110 ! route-map ospf-into-rip permit 2 match ip address 5 set metric 2 set tag 110 ! route-map ospf-into-rip permit 5 match ip address 104 set metric 3 set tag 110 ! route-map ospf-into-rip permit 7 match ip address 4 set metric 3 set tag 110 ! route-map ospf-into-rip deny 10 match tag 120 ! route-map ospf-into-rip permit 20 set tag 110 ! route-map ospf-into-rip permit 30 ! ! access-list 4 permit 192.168.4.0 0.0.0.255 access-list 5 permit 192.168.5.0 0.0.0.255 access-list 104 permit ip any 192.168.4.0 0.0.0.255 access-list 105 permit ip any 192.168.5.0 0.0.0.255 I created two access lists for paths on iosv-2. For completeness, I did both standard and extended ACLs. You could use either.
iosv-1 to 192.168.4.0 / 24 has two costs, going through iosv-2, hop count is 3 and going through iosv-4, hop count is 1. Because of RIP, the hop counts both show up as 1 causing a sub-optimal route to happen. When I placed the two ACLs and permit 5 and permit 7, the extra route disappears from the RIP tables. You need to shut down the interface to have the route with metric of 3 appear.
iosv-1 to 192.168.5.0 / 24 has two equal routes, for fun I created a rule that set both to metric of 2 hops on iosv-2 and iosv-4.
A similar set of route-maps and ACLs are on both iosv-2 and iosv-4 because they are both RIP and OSPF.