Previous section   Next section

Recipe 8.6 Redistributing External Routes into OSPF

8.6.1 Problem

You want OSPF to distribute routes from another routing protocol.

8.6.2 Solution

The redistribute configuration command allows you to redistribute routes from another dynamic routing protocol into an OSPF process:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#router ospf 55
Router1(config-router)#redistribute eigrp 11 subnets   
Router1(config-router)#end
Router1#

8.6.3 Discussion

Redistributing external routes from another routing protocol is similar to redistributing static routes, as we did in Recipe 8.5. In the above example, all of the routes that this router learns through EIGRP process number 11 will be propagated into OSPF as Type 2 external routes. Also, as shown in the following output from the show ip protocols command, every route will be redistributed because we also included the subnets keyword. If we had not included this keyword, OSPF would only redistribute classful summary routes from EIGRP:

Router1#show ip protocols 
Routing Protocol is "ospf 55"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 172.25.25.1
  It is an area border and autonomous system boundary router
  Redistributing External Routes from,
    static with metric mapped to 40, includes subnets in redistribution
    eigrp 11, includes subnets in redistribution
  Number of areas in this router is 3. 3 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    10.0.0.0 0.255.255.255 area 2
    172.20.0.0 0.0.255.255 area 100
    0.0.0.0 255.255.255.255 area 0
  Routing Information Sources:
    Gateway         Distance      Last Update
    172.25.1.7           110      00:06:24
    172.25.1.1           110      1d15h
    172.25.1.3           110      00:06:24
  Distance: (default is 110)
Router1#

If you prefer, you can redistribute routes from the foreign routing protocol as Type 1 external routes. To do this, you need to specify the metric-type keyword in the redistribute command:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#router ospf 55               
Router1(config-router)#redistribute eigrp 11 subnets metric 35 metric-type 1
Router1(config-router)#end
Router1#

You can also do some rather interesting things when redistributing OSPF routes into another protocol. For example, you might choose to only redistribute internal routes to the foreign routing protocol:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#router eigrp 11
Router1(config-router)#redistribute ospf 55 match internal
Router1(config-router)#end
Router1#

There are several other options for this match keyword. You could just as easily choose to match only external Type 1 routes as follows:

Router1(config-router)#redistribute ospf 55 match external type 1

You can also combine types to allow you to redistribute both internal and external Type 1 routes, but not external Type 2:

Router1(config-router)#redistribute ospf 55 match internal match external type 1

This match option on the redistribute command is much easier than configuring a route map. But, if you require still greater control and flexibility, route maps are the best choice. This is particularly true if you want to handle routing tags in a special way. For a discussion of using route maps while redistributing routes between protocols, please refer to Recipe 8.13 on OSPF route tagging.

8.6.4 See Also

Recipe 8.5; Recipe 8.13


  Previous section   Next section
Top