Sub topic 15
Redistributing Routes Between Sources
This chapter assumes you know how a routing table works, how administrative distance and metrics rank routes, and how to read basic Cisco IOS configuration. Redistribution is a small topic in this tutorial, so this chapter covers the working model and the common mistakes.
What redistribution does
A router can learn routes from several sources: connected networks, static routes, OSPF, RIP, BGP. Each routing protocol keeps its own database and only advertises routes it knows about. A static route is not in the OSPF database, so OSPF will not advertise it to neighbors.
Redistribution copies routes from one source into another routing protocol. The router that does this is called a boundary router. It sits between two routing domains, or between a protocol and a set of static routes.
Typical reasons to redistribute:
- A branch uses static routes, and the core runs OSPF. The core needs to learn the branch prefixes.
- Two networks merge, and one runs RIP while the other runs OSPF.
- An OSPF network must advertise a default route to its internal routers.
Why metrics and distance matter
Protocols measure cost differently. RIP counts hops and OSPF uses link cost, so a RIP metric means nothing to OSPF. When a route is redistributed, the boundary router assigns it a new metric, either a value you configure or a protocol default. The original metric is lost.
Administrative distance still applies on every router that hears the route. OSPF marks redistributed routes as external (type E2 by default), with an administrative distance of 110. The ranking logic is the same as in the earlier chapter on administrative distance.
Example: static routes into OSPF
The boundary router has a static route to the branch and runs OSPF toward the core.
! Cisco IOS: static route to the branch network
ip route 10.2.0.0 255.255.0.0 192.168.1.2
router ospf 1
router-id 1.1.1.1
network 10.1.0.0 0.0.255.255 area 0
! Copy static routes into OSPF with a fixed metric of 20
redistribute static metric 20 subnetsThe subnets keyword matters. Without it, OSPF redistributes only classful networks, and a prefix such as 10.2.0.0/16 may be left out. On a core router, show ip route ospf then lists 10.2.0.0/16 with the code O E2.
To advertise a default route into OSPF, use default-information originate instead. It injects 0.0.0.0/0 when the router itself has a default route.
Common errors
- Forgetting the metric or
subnetskeyword. Routes are missing or get an unexpected cost. - Routing loops from two-way redistribution. If you redistribute A into B and B into A on more than one boundary router, a route can travel back to where it started. The router may then prefer the copy it just advertised, depending on administrative distance.
- Suboptimal paths. The metric was reset, so the core cannot tell a near branch from a far one.
- Redistributing too much. Sending a full BGP table into an IGP can overload the routers.
Checking the result
Verify on both sides. On the boundary router, run show ip route 10.2.5.7 to confirm the static route is present. On a core router, run show ip route ospf to see the external route and its metric. If the route is missing, check the redistribution line first.
Exercise
A boundary router has a static route to 10.2.0.0/16. You add redistribute static under OSPF, but core routers do not learn the route. Name one likely cause and the fix.
Show answer
The subnets keyword is missing, so OSPF redistributes only classful networks and skips 10.2.0.0/16. Change the line to redistribute static metric 20 subnets. Then check show ip route ospf on a core router.
Exercise
Why can two-way redistribution between RIP and OSPF at two boundary routers cause a loop?
Show answer
Each boundary router can take a route from one protocol, reset its metric, and advertise it into the other. The other boundary router may hear that copy and send it back. Because the original metric is lost, neither router knows the route came from the domain it is advertising into. Tags or route filters stop this.