Course contentsShow
← Linux
Lesson 1135 of 1,81910. Network Administration and Kernel StacksFree lesson

Route Redistribution between Protocols

Manage path cost and preference when merging different dynamic routing domains.

In this lesson, you will learn how to bridge disparate routing domains by injecting routes from one dynamic protocol into another while maintaining control over path selection.

The Redistribution Challenge

When you use FRR (Free Range Routing) to manage multiple protocols—like OSPF for internal subnets and BGP for external connectivity—they exist in separate silos. A router running both does not automatically share reachability information between them. Route redistribution is the process of taking routes learned via one protocol (e.g., OSPF) and re-advertising them into another (e.g., BGP).

The primary risk here is route feedback or suboptimal routing. Because each protocol uses a different metric (OSPF uses "cost" based on bandwidth, while BGP uses "attributes"), simply dumping routes into a new protocol can lead to routing loops or "black holes" where traffic bounces between domains.

Controlling Preference and Cost

To manage this, you must define the Administrative Distance (or "distance" in FRR terminology). This value determines the trustworthiness of a routing source. If a router learns about the same destination via both BGP and OSPF, the protocol with the lower administrative distance wins.

When redistributing, you should explicitly set the metric to ensure the receiving domain understands the cost of the path. In FRR, you configure this within your daemon configuration (ospfd.conf or bgpd.conf):

router ospf
 redistribute bgp metric 20
!
router bgp 65000
 redistribute ospf route-map OSPF-TO-BGP
!
route-map OSPF-TO-BGP permit 10
 set metric 100

In this example, we inject OSPF routes into BGP but apply a route-map to force a specific metric. This prevents the receiving BGP neighbors from blindly trusting the internal OSPF cost, which might be meaningless to them. Always use route maps to filter which prefixes are redistributed; redistributing everything by default is a common cause of network instability.

Avoiding Loops

When redistributing between two points, a route might exit one protocol and re-enter it at another gateway. Always tag redistributed routes and use those tags as filters in your route maps to deny prefixes that have already passed through your boundary, effectively breaking the circular path.

Key Takeaway: Route redistribution allows protocols to talk to each other, but requires manual metric assignment and route filtering to prevent suboptimal paths and routing loops.