It is sometimes necessary to accommodate more complex network topologies such as independent RIP and OSPF clouds that must perform mutual redistribution. In this scenario, it is critically important to prevent potential routing loops by filtering routes. The router in Figure 14-4 is running both OSPF and RIP.

With the following commands, OSPF routes will be redistributed into RIP. You must specify the default metric to designate the cost of the redistributed route in RIP updates. All routes redistributed into RIP will have this default metric.
! passive interface subcommand from previous example is left out for clarity! router rip default-metric 10 network 130.10.0.0 redistribute ospf 109
It is a good practice to strictly control which routes are advertised when redistribution is configured. In the following example, a distribute-list out command causes RIP to ignore routes coming from the OSPF that originated from the RIP domain.
router rip distribute-list 10 out ospf 109 ! access-list 10 deny 130.10.8.0 0.0.7.255 access-list 10 permit 0.0.0.0 255.255.255.255
The full configuration for the router follows:
interface serial 0 ip add 130.10.62.1 255.255.255.0 ! interface serial 1 ip add 130.10.63.1 255.255.255.0 ! interface ethernet 0 ip add 130.10.8.1 255.255.255.0 ! interface tokenring 0 ip add 130.10.9.1 255.255.255.0 ! router rip default-metric 10 network 130.10.0.0 passive-interface serial 0 passive-interface serial 1 redistribute ospf 109 distribute-list 10 out ospf 109 ! router ospf 109 network 130.10.62.0 0.0.0.255 area 0 network 130.10.63.0 0.0.0.255 area 0 redistribute rip subnets distribute-list 11 out rip ! access-list 10 deny 130.10.8.0 0.0.7.255 access-list 10 permit 0.0.0.0 255.255.255.255 access-list 11 permit 130.10.8.0 0.0.7.255 access-list 11 deny 0.0.0.0 255.255.255.255
Because it is common for OSPF and RIP to be used together, it is important to use the practices described here in order to provide functionality for both protocols on an internetwork. You can configure autonomous system boundary routers that run both RIP and OSPF and redistribute RIP routes into the OSPF and vice versa. You can also create OSPF areas using area border routers that provide route summarizations. Use VLSM to conserve address space.