Redistributing External Routes into OSPF

Problem

You want OSPF to distribute routes from another routing protocol.

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)#exit
Router1(config)#end
Router1#

One of the dangers when redistributing between routing protocols is that you will accidentally import more information than your routers can handle. In Version 12.3(2)T, Cisco added a feature to protect against this issue:

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)#redistribute maximum-prefix 1000 80
Router1(config-router)#exit
Router1(config)#end
Router1#

 

Discussion

Redistributing external routes from another routing protocol is similar to redistributing static routes, as we did in Recipe 8.5. In the example above, 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, because we also included the subnets keyword, every route will be redistributed. 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)#exit
Router1(config)#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, like this:

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)#exit
Router1(config)#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.15 on OSPF route tagging.

One of the potential dangers with route redistribution is the possibility of accepting too many routes from another network and overwhelming your network resources. This is a problem not only for router memory, but also for bandwidth because all of these external routes must be flooded throughout the OSPF network. To deal with this problem, Cisco introduced the redistribute maximum-prefix command in IOS Version 12.3(2)T.

In the Solution section of this recipe, we set the maximum number of redistributed routes to 1,000:

Router9(config)#router ospf 87
Router9(config-router)#redistribute eigrp 11 subnets 
Router9(config-router)#redistribute maximum-prefix 1000 80

Now this router will redistribute a maximum of 1,000 prefixes from all protocols. If any additional routes match redistribution rules, they will simply be ignored.

The final argument on this command specifies a warning threshold percentage. In this case, the value is 80 percent, or 800 total prefixes. If the number of redistributed prefixes rises above this threshold, the router will issue a syslog warning message.

To demonstrate this, we can introduce a large number of routes and watch what happens. When there are less than 800 redistribute routes, all of the routes are distributed normally:

Router9#show ip route sum
IP routing table name is Default-IP-Routing-Table(0)
IP routing table maximum-paths is 16
Route Source Networks Subnets Overhead Memory (bytes)
connected 0 1 72 136
static 0 0 0 0
eigrp 11 0 791 56952 107576
ospf 87 3 2 360 680
 Intra-area: 5 Inter-area: 0 External-1: 0 External-2: 0
 NSSA External-1: 0 NSSA External-2: 0
internal 6 6936
Total 9 794 57384 115328
Router9#

If we then introduce a few more EIGRP prefixes to be redistributed to exceed the 80% warning threshold, the router produces this message:

*Mar 1 15:01:51.583: %IPRT-4-REDIST_THR_PFX: Redistribution prefix threshold ha
s been reached "ospf 87" - 800 prefixes
Router9#show ip route summary
IP routing table name is Default-IP-Routing-Table(0)
IP routing table maximum-paths is 16
Route Source Networks Subnets Overhead Memory (bytes)
connected 0 1 72 136
static 0 0 0 0
eigrp 11 0 800 57600 108800
ospf 87 3 2 360 680
 Intra-area: 5 Inter-area: 0 External-1: 0 External-2: 0
 NSSA External-1: 0 NSSA External-2: 0
internal 6 6936
Total 9 803 58032 116552
Router9#

If we then increase this number beyond the configured maximum of 1,000, the router gives another message and refuses to accept any further prefixes, although it will continue to redistribute all of the prefixes that it has already seen:

*Mar 1 15:04:12.659: %IPRT-4-REDIST_MAX_PFX: Redistribution prefix limit has be
en reached "ospf 87" - 1000 prefixes

This message appears whenever the threshold is crossed. If you continue to add routes past the threshold, it will not appear again. If the number of prefixes drops below the threshold and then rises above it again, you will see the message again:

Router9#show ip route summary
IP routing table name is Default-IP-Routing-Table(0)
IP routing table maximum-paths is 16
Route Source Networks Subnets Overhead Memory (bytes)
connected 0 1 72 136
static 0 0 0 0
eigrp 11 0 1085 78120 147560
ospf 87 3 2 360 680
 Intra-area: 5 Inter-area: 0 External-1: 0 External-2: 0
 NSSA External-1: 0 NSSA External-2: 0
internal 6 6936
Total 9 1088 78552 155312
Router9#

Any downstream router will only see 1,000 redistributed prefixes originating on Router9:

Router3#show ip route summary
IP routing table name is Default-IP-Routing-Table(0)
Route Source Networks Subnets Overhead Memory (bytes)
connected 3 1 528 576
static 0 0 0 0
ospf 1 0 1002 64128 144288
 Intra-area: 2 Inter-area: 0 External-1: 0 External-2: 1000
 NSSA External-1: 0 NSSA External-2: 0
internal 6 6984
Total 9 1003 64656 151848
Router3#

 

See Also

Recipe 8.5; Recipe 8.15

Router Configuration and File Management

Router Management

User Access and Privilege Levels

TACACS+

IP Routing

RIP

EIGRP

OSPF

BGP

Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time

DLSw

Router Interfaces and Media

Simple Network Management Protocol

Logging

Access-Lists

DHCP

NAT

First Hop Redundancy Protocols

IP Multicast

IP Mobility

IPv6

MPLS

Security

Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications

Index



Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net