6.1 Routing Concepts, RIB vs FIB, and Route Preference
Key Takeaways
Lower route preference selects between eligible sources for the same prefix.
Longest-prefix match selects among installed prefixes for a packet.
SR OS defaults include static 5, OSPF internal 10, and BGP 170.
IS-IS external preferences differ: Level 1 is 160 and Level 2 is 165.
ECMP can program multiple next hops for one prefix.
Separate route selection from packet lookup
A router needs two decisions at different times. The control plane chooses usable routes for each destination prefix. The forwarding plane then matches each packet to the most specific installed prefix. Route preference and longest-prefix match therefore solve different problems.
A route describes a destination prefix, a source such as static or OSPF, and forwarding information. A directly connected prefix comes from an operational local interface. A remote prefix points toward another router or a transport mechanism. The mere presence of configuration does not establish that the route is active or that the neighbor will forward traffic successfully.
RIB, protocol databases, and FIB
Routing protocols maintain their own information. OSPF's Link-State Database describes topology; BGP maintains received paths and attributes. These are not identical to the system's selected IP routes.
The Routing Information Base (RIB) represents control-plane routes. The routing table manager compares eligible routes and selects active forwarding choices. The Forwarding Information Base (FIB) is optimized for packet lookup and contains programmed actions and resolved next hops derived from those choices.
An inactive candidate can remain available for later use without forwarding packets now. With Equal-Cost Multipath (ECMP), several eligible next hops can be programmed for one prefix. “Best route” therefore does not always mean exactly one physical outgoing link.
Preference for the same prefix
Suppose a static route and OSPF both offer 10.20.0.0/16. They describe the same destination range, so the router compares route-source preference. In SR OS, a lower preference is preferred. Defaults can be changed for configurable sources, so use values supplied by a question or the actual configuration.
| Source | Default SR OS preference |
|---|---|
| Direct | 0 |
| Static | 5 |
| OSPF internal | 10 |
| IS-IS Level 1 internal | 15 |
| IS-IS Level 2 internal | 18 |
| OSPF external | 150 |
| IS-IS Level 1 external | 160 |
| IS-IS Level 2 external | 165 |
| BGP | 170 |
Both internal and external BGP use the BGP route preference by default; do not import another vendor's administrative-distance table. A static route with preference 5 normally wins against an eligible internal OSPF route with preference 10 for the identical prefix. If that static route becomes ineligible, selection can promote the OSPF candidate.
Preference is an administrative selection rule, not a measurement of latency, security, or actual path bandwidth. Lower preference does not make a path physically faster or automatically trustworthy.
Metrics inside a protocol
A routing protocol also chooses between its own candidate paths. OSPF adds configured interface costs along a path. SR OS supports an explicit metric and reference-bandwidth-based behavior when configured; do not assume a universal Cisco-style bandwidth formula applies to every SR OS interface by default.
Consider R1 reaching R4 through two paths. Through R2 the outgoing costs are 10 and 15, totaling 25. Through R3 the costs are 5 and 30, totaling 35. With other route-type conditions equal, OSPF prefers cost 25. This is an example calculation using stated costs, not a claim about default link metrics.
An OSPF cost of 25 cannot be directly compared with a RIP hop count of 2 or an IS-IS metric of 20. Their units and protocol rules differ. Route-source preference resolves the relevant competition across sources for the same prefix.
Longest-prefix match during forwarding
After routes are installed, a packet's destination can match several different prefixes. The FIB chooses the longest matching prefix, regardless of those prefixes' route-source preferences.
| Installed prefix | Source | Next hop |
|---|---|---|
0.0.0.0/0 | Static | 192.0.2.1 |
10.0.0.0/8 | Static | 192.0.2.5 |
10.20.0.0/16 | OSPF | 192.0.2.9 |
10.20.4.0/24 | BGP | 192.0.2.13 |
A packet for 10.20.4.7 uses the /24 BGP route, even though static routes have a lower default preference. A packet for 10.20.9.7 uses the /16 OSPF route. A packet for 203.0.113.8 uses the default route. These are different prefix matches, not preference ties.
The order in which the routes were configured does not determine this result. If no installed prefix matches, including no default, forwarding fails. Error reporting depends on ICMP rules, policy, rate limits, and return reachability.
ECMP and operational verification
When several eligible paths have equal selection properties and ECMP is enabled, the router can distribute flows among next hops. A stable flow hash helps avoid routine per-packet reordering, but traffic is not guaranteed to divide evenly by bytes. Different flow sizes and hash collisions can produce uneven utilization.
Use show router route-table for selected route information and the appropriate protocol display for candidate details. A BGP path can be accepted by BGP yet lose to a lower-preference route in the main table. Conversely, a route can be selected while neighbor resolution or a downstream return route is broken.
When a question gives several routes, work in this order: identify which candidates can be active for each exact prefix, list the installed prefixes, then match the packet's destination. This prevents mixing control-plane preference with packet-time specificity.
Primary reference
Nokia route-preference reference, checked October 20, 2026. The table identifies the relevant SR OS defaults; always inspect configured overrides and platform support.
A usable static route with default preference 5 and an internal OSPF route with default preference 10 offer the identical prefix. Which is preferred under these values?
OSPF because it is dynamic
The static route because its numerical preference is lower
The route configured last
Neither can be installed
A router's FIB contains three routes: 192.168.0.0/16 learned via a static route (Preference 5), 192.168.1.0/24 learned via OSPF (Preference 10), and 192.168.1.128/28 learned via BGP (Preference 170). When the router receives an IP packet destined for IP address 192.168.1.130, how is the packet forwarded?
It is forwarded using the static route (192.168.0.0/16) because static routes have the lowest preference (5)
It is forwarded using the OSPF route (192.168.1.0/24) because OSPF is an interior gateway protocol with a balanced metric
It is dropped because conflicting routing sources cause a routing loop in the FIB
It is forwarded using the BGP route (192.168.1.128/28) because 192.168.1.128/28 has the longest prefix match (/28) covering the destination
Which distinction between RIB and FIB is correct?
The RIB represents control-plane routes; the FIB holds programmed forwarding decisions, potentially including multiple ECMP next hops
The RIB only stores Ethernet FCS values
The FIB calculates every OSPF topology update in software
The RIB contains only multicast and the FIB only management sessions
Sections you finish are checked off in the contents.