Routing Fundamentals · Topic 1 of 4
Traffic Forwarding, Routing and Forwarding Tables
Learn Junos traffic forwarding for JNCIA-Junos JN0-106: inet.0 and other routing tables, reading show route, and how the forwarding table differs.
- 6 min
- Forwarding uses the longest match on the destination address.
inet.0= IPv4 unicast,inet6.0= IPv6 unicast,inet.3= MPLS next hops for BGP,mpls.0= labels.*marks the active route;>marks the next hop in use.
What it is
A router forwards a packet by looking at its destination IP address, finding the best matching route and sending the packet to that route's next hop. Each router along the path makes its own decision, hop by hop.
Junos OS keeps two kinds of tables for this. The routing table on the Routing Engine holds every route learned from every source. The forwarding table holds only the active routes, and the Packet Forwarding Engine uses its copy to forward packets.
How it works
Traffic forwarding concepts
For each packet the router:
- Reads the destination IP address.
- Finds all routes in the forwarding table that contain that address.
- Chooses the longest match, the route with the longest prefix length.
- Sends the packet out the interface toward that route's next hop.
If no route matches and there is no default route (0.0.0.0/0), the packet is dropped. The router decrements the TTL on each hop, so a packet in a loop eventually expires.
Junos routing tables
Junos OS keeps separate routing tables for different kinds of routes. The exam expects you to know the main names.
| Table | Holds |
|---|---|
inet.0 | IPv4 unicast routes |
inet6.0 | IPv6 unicast routes |
inet.3 | MPLS path information, used by BGP to resolve next hops |
mpls.0 | MPLS label switching information |
inet.1 | IPv4 multicast forwarding cache |
inet.2 | Routes used for multicast reverse path checks |
A routing instance has its own tables named after it, such as VR1.inet.0 for an instance called VR1.
Reading show route
user@router> show route
inet.0: 6 destinations, 7 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 01:12:40
> to 10.1.1.2 via ge-0/0/0.0
10.1.1.0/24 *[Direct/0] 01:15:02
> via ge-0/0/0.0
10.1.1.1/32 *[Local/0] 01:15:02
Local via ge-0/0/0.0
172.16.0.0/16 *[Static/5] 00:05:30
> to 10.1.3.2 via ge-0/0/2.0
[OSPF/10] 00:40:11, metric 2
> to 10.1.1.2 via ge-0/0/0.0
...
| Field | Meaning |
|---|---|
inet.0: 6 destinations, 7 routes | Six prefixes, seven routes in total, because one prefix has two routes |
* | The active route for the prefix |
[OSPF/10] | The source protocol and its preference |
01:12:40 | How long the route has been in the table |
> | The next hop actually used |
metric 2 | The protocol metric |
Configuring an address on an interface creates two routes: a Direct route for the subnet and a Local route for the device's own /32 address.
In the example, 172.16.0.0/16 has two routes. The static route has preference 5, which beats OSPF at 10, so the static route is active and is listed first. The OSPF route stays in the table as a backup and becomes active if the static route is removed or its next hop becomes unreachable.
Routing vs. forwarding tables
| Routing table | Forwarding table | |
|---|---|---|
| Lives on | Routing Engine | Built on the RE, copied to the PFE |
| Contains | All routes from all sources, active and inactive | Only active routes and their next hops |
| Built by | rpd, from protocols, static routes and interfaces | The RE, from the active routes |
| Used for | Choosing the best route, advertising routes | Forwarding each packet |
| View with | show route | show route forwarding-table |
Equal cost paths and load balancing
The routing table can hold several equal-cost next hops for one prefix. By default, Junos OS installs only one of them in the forwarding table. To install all of them, you export a load-balancing policy to the forwarding table:
user@router# set policy-options policy-statement LB then load-balance per-packet
user@router# set routing-options forwarding-table export LB
Despite the keyword per-packet, current hardware balances traffic per flow, so packets of one session stay on one path.
A worked example
A router has these routes in inet.0: 0.0.0.0/0 via 10.1.1.2, 10.0.0.0/8 via 10.1.2.2 and 10.20.0.0/16 via 10.1.3.2. A packet for 10.20.4.1 matches all three.
The longest match is /16, so the packet goes to 10.1.3.2. A packet for 10.99.0.1 matches the /8 and the default route, so it goes to 10.1.2.2. A packet for 192.0.2.1 matches only the default route.
How the exam asks about this
- "Which table holds IPv6 unicast routes?" →
inet6.0. - "What does the asterisk mean in
show route?" → The active route for that prefix. - "How many next hops does Junos OS install by default for equal-cost paths?" → One, unless a load-balancing policy is exported to the forwarding table.
Common mistakes
Using preference to pick between different prefixes. Preference only chooses between routes to the same prefix. Between different prefixes, the longest match always wins.
Thinking the forwarding table holds every route. It holds only active routes. Inactive routes stay in the routing table as backups.
Assuming equal-cost load balancing is on by default. Junos OS installs one next hop per prefix until you export a load-balance per-packet policy to the forwarding table.
What to remember for the exam
- Forwarding uses the longest match on the destination address.
inet.0= IPv4 unicast,inet6.0= IPv6 unicast,inet.3= MPLS next hops for BGP,mpls.0= labels.*marks the active route;>marks the next hop in use.- An interface address creates a Direct route and a Local /32 route.
- Routing table = all routes on the RE; forwarding table = active routes, copied to the PFE.
The summary line X destinations, Y routes tells you at once whether any prefix has more than one route. If Y is larger than X, some prefixes have backup routes.
Check yourself
A packet for 10.20.4.1 matches 10.0.0.0/8 and 10.20.0.0/16. Which route is used?
10.20.0.0/16, because the longest match wins regardless of preference.
Which routes are copied into the forwarding table?
Only the active route for each prefix, with its next hop.
What two routes does an interface address of 10.1.1.1/24 create?
A Direct route for 10.1.1.0/24 and a Local route for 10.1.1.1/32.
Topic 1 of 4 in Routing Fundamentals
Test yourself on Routing Fundamentals
The full Juniper JNCIA-Junos JN0-106 question bank has 1,155 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.