5.1 Routing & Forwarding Tables
Key Takeaways
- The main IPv4 unicast Routing Information Base (RIB) in Junos is inet.0; the Forwarding Information Base (FIB) is the forwarding copy installed in the Packet Forwarding Engine (PFE).
- The Routing Engine (RE) builds the RIB from all route sources, selects one active route per destination prefix, and copies only active routes into the FIB.
- Junos forwards packets using the longest-prefix match: the most specific matching prefix wins regardless of route preference.
- Use 'show route' for the RIB and 'show route forwarding-table' for the FIB; they can differ during convergence.
- Routing Fundamentals is roughly 18% of JNCIA-Junos, and table behavior questions appear throughout this domain.
Why Tables Matter on JNCIA-Junos
The Routing Fundamentals domain is roughly 18% of the JNCIA-Junos exam, and almost every routing question depends on understanding how Junos stores and uses routes. Junos cleanly separates the control plane, which decides routes, from the data plane, which forwards packets. Knowing which table answers which question is the single most reusable skill in this domain.
RIB vs FIB
The Routing Information Base (RIB) is the control-plane database of every route the device has learned, from every source. The main IPv4 unicast RIB in Junos is named inet.0. The Forwarding Information Base (FIB) is the data-plane copy used to actually forward packets; it lives in the Packet Forwarding Engine (PFE).
The Routing Engine (RE) owns the RIB. It gathers routes, runs the active-route selection algorithm, and then copies only the active routes into the FIB. The PFE never re-evaluates routes; it simply forwards based on the FIB the RE gave it.
| Attribute | RIB (inet.0) | FIB (forwarding table) |
|---|---|---|
| Plane | Control plane | Data plane |
| Owned by | Routing Engine (RE) | Packet Forwarding Engine (PFE) |
| Contents | All routes from all sources | Only active routes |
| Per destination | May hold many candidate routes | One forwarding entry |
| View command | show route | show route forwarding-table |
During convergence the two tables can briefly differ, because the RE selects a new active route before the updated FIB is fully programmed into the PFE. Exam questions often hinge on this distinction.
Common Junos RIBs
Junos uses many routing tables. The most exam-relevant ones are listed below; the table name encodes both the address family and the table number.
| Table | Purpose |
|---|---|
| inet.0 | IPv4 unicast routes (default IPv4 RIB) |
| inet6.0 | IPv6 unicast routes |
| inet.3 | MPLS path / label-switched-path egress routes |
| mpls.0 | MPLS label-switching (transit label) table |
| bgp.l3vpn.0 | Layer 3 VPN routes learned via BGP |
For JNCIA-Junos, focus on inet.0 and inet6.0. Routing instances create additional tables named like instance-name.inet.0.
Route Resolution and Longest-Prefix Match
When a packet arrives, the PFE looks up the destination IP address in the FIB and selects the longest-prefix match (LPM): the most specific prefix that contains the destination address. Longest match always wins on a per-packet forwarding decision, and it is independent of route preference.
Consider a FIB that contains all three of these routes:
0.0.0.0/0 -> next-hop 203.0.113.1 (default route)
10.0.0.0/8 -> next-hop 198.51.100.1
10.1.1.0/24 -> next-hop 198.51.100.9
A packet to 10.1.1.50 matches all three prefixes, but 10.1.1.0/24 is the longest (most specific) match, so the packet is forwarded to 198.51.100.9. A packet to 10.9.9.9 matches 10.0.0.0/8 and the default, so the /8 wins. A packet to 172.16.5.5 matches only 0.0.0.0/0, so it uses the default route.
Route resolution is the related process where Junos resolves an indirect next hop (for example a BGP next hop that is not directly connected) by looking it up recursively in the RIB until it finds a reachable forwarding next hop. If the next hop cannot be resolved, the route is not usable and is not installed as active.
Active Route Selection
When multiple routes exist for the same destination prefix, Junos must choose exactly one active route to install into the FIB. The decision order is:
- Lowest route preference (Junos administrative distance) wins first.
- If preference ties, the protocol's own tiebreakers apply (for example, lowest OSPF metric or BGP path selection).
- Junos can install multiple equal-cost paths for load balancing only when explicitly configured.
In show route output the active route is marked with a * and the word Active; inactive candidates are still listed but are not forwarded on. Remember the key contrast: longest-prefix match chooses between different prefixes at forwarding time, while route preference chooses between competing routes to the same prefix at selection time.
Reading show route Output
The primary command is show route. Useful variants you should recognize:
| Command | Shows |
|---|---|
| show route | All active routes in all RIBs |
| show route table inet.0 | Routes in a specific table |
| show route 10.1.1.0/24 | Best match for a destination/prefix |
| show route protocol static | Routes from one protocol |
| show route forwarding-table | The FIB programmed into the PFE |
A simplified entry looks like this:
10.1.1.0/24 *[Static/5] 1d 02:14:00
> to 198.51.100.9 via ge-0/0/1.0
Here * marks the active route, Static is the source protocol, 5 is the route preference, and > marks the selected forwarding next hop.
In Junos, which table is copied into the Packet Forwarding Engine (PFE) and used to forward transit traffic?
A Junos forwarding table contains 0.0.0.0/0, 172.16.0.0/16, and 172.16.8.0/24. To which prefix is a packet destined for 172.16.8.40 forwarded?
In 'show route' output, what does the asterisk (*) next to a route indicate?