Protocol Independent Routing · Topic 2 of 4
Routing Instances and RIB Groups
Learn Junos routing instances, instance types, instance routing tables and RIB groups with import-rib, and how routes are copied between tables.
- 5 min
- The master instance table is
inet.0; an instance table isNAME.inet.0. no-forwardingis the default instance type. Knowvirtual-router,forwardingandvrf.ping,tracerouteandshow routeneedrouting-instanceortableto look inside an instance.
What it is
A routing instance is a separate copy of the routing and forwarding tables on one router. Each instance has its own interfaces, its own routes and its own protocol configuration, so overlapping address space can live on one device without mixing.
The default, global table set is called the master instance. Its IPv4 unicast table is inet.0. A RIB group is a way to copy routes from one routing table into other tables, so a route learned in one place can also exist in another.
How it works
Instance types
The instance type is set with instance-type.
| Type | Use |
|---|---|
no-forwarding | The default type; separates routes, does not forward traffic by itself |
virtual-router | A separate router with its own interfaces, tables and protocols, no VPN features |
forwarding | Used for filter-based forwarding; holds only forwarding information |
vrf | Layer 3 VPN instance; needs a route distinguisher and VRF targets |
virtual-switch | Layer 2 instance with its own VLANs and bridge domains |
l2vpn, vpls, evpn | Layer 2 service instances |
For JN0-352 the types you must tell apart are virtual-router, forwarding and vrf. A virtual-router has no route distinguisher, a vrf does.
Creating a virtual router
user@router# set routing-instances CUST-A instance-type virtual-router
user@router# set routing-instances CUST-A interface ge-0/0/1.0
user@router# set routing-instances CUST-A routing-options static route 0.0.0.0/0 next-hop 10.1.1.254
user@router# set routing-instances CUST-A protocols ospf area 0.0.0.0 interface ge-0/0/1.0
An interface belongs to one instance only. Routing protocols for that instance are configured inside the instance, under routing-instances CUST-A protocols.
Instance routing tables
Table names carry the instance name. The master instance uses inet.0. The instance CUST-A uses CUST-A.inet.0. Operational commands must name the instance or the table, otherwise they show the master instance.
user@router> show route table CUST-A.inet.0
user@router> show route instance
user@router> show route instance CUST-A detail
user@router> ping 10.1.1.254 routing-instance CUST-A
user@router> traceroute 10.1.1.254 routing-instance CUST-A
Other common tables in the master instance are inet6.0 (IPv6 unicast) and inet.3 (MPLS next hops).
RIB groups
A RIB group is configured under [edit routing-options rib-groups] and has an import-rib list of tables. The first table in the list is the primary table; routes are copied into every other table in the list as well.
user@router# set routing-options rib-groups LEAK-TO-A import-rib [ inet.0 CUST-A.inet.0 ]
A RIB group does nothing until it is applied to something that produces routes. The common places are:
| Applied under | Routes copied |
|---|---|
routing-options interface-routes rib-group inet LEAK-TO-A | Direct (interface) routes |
routing-options static rib-group LEAK-TO-A | Static routes |
protocols ospf rib-group LEAK-TO-A | Routes learned by that OSPF instance |
user@router# set routing-options interface-routes rib-group inet LEAK-TO-A
user@router# set routing-options static rib-group LEAK-TO-A
An optional import-policy inside the RIB group filters which routes are copied.
Why interface routes matter
A copied static or learned route has a next hop. That next hop must be resolvable in the destination table. If you copy a static route that points at 192.168.1.1 into another instance, you must also copy the interface route for 192.168.1.0/24 there, or the copied route stays hidden.
When a leaked route does not show up as active in the second table, run show route hidden table CUST-A.inet.0. A hidden route with an unresolved next hop usually means the interface routes were not copied.
Monitoring
show route instance lists each instance with its type, its interfaces and its tables. show route table <name> shows the routes. show route forwarding-table table <name> shows what the Packet Forwarding Engine uses.
Common mistakes
Forgetting to name the instance in ping and show route. Without routing-instance or table, the command uses the master instance and gives the wrong answer.
Assuming a RIB group copies everything. It copies only what the application point produces: interface routes, static routes or one protocol's routes.
Putting the destination table first in import-rib. The first table is the primary. Put inet.0 first when inet.0 is the table that owns the routes.
Mixing up virtual-router and vrf. A virtual router needs no route distinguisher and has no MPLS VPN export. A vrf instance needs route-distinguisher and vrf-target.
An interface can be in only one instance. Moving it to an instance removes it from inet.0, and anything that relied on it in the master table stops working.
What to remember for the exam
- The master instance table is
inet.0; an instance table isNAME.inet.0. no-forwardingis the default instance type. Knowvirtual-router,forwardingandvrf.ping,tracerouteandshow routeneedrouting-instanceortableto look inside an instance.- A RIB group is defined under
routing-options rib-groupswithimport-rib; the first table listed is the primary. - A RIB group must be applied (
interface-routes,staticor a protocol) to copy anything. - Copied routes need their next hops to resolve, so copy interface routes too.
show route instancesummarizes all instances.
Check yourself
Which table does the instance CUST-A use for IPv4 unicast routes?
CUST-A.inet.0.In
import-rib [ inet.0 CUST-A.inet.0 ], which table is the primary?inet.0, because the first table in the list is the primary table.A static route copied by a RIB group is hidden in the second table. What is the likely cause?
The next hop is not resolvable there, usually because the interface routes were not copied into that table.
Topic 2 of 4 in Protocol Independent Routing
Test yourself on Protocol Independent Routing
The full Juniper JNCIS-ENT JN0-352 question bank has 846 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.