Protocol-Independent Routing · Topic 3 of 4
Routing Instances, RIB Groups and Filter-Based Forwarding
Learn Junos routing instances, instance types and tables, RIB groups and filter-based forwarding with a forwarding instance for the JNCIS-SP JN0-364.
- 6 min
- The default instance is
masterwith tableinet.0; other instances use<name>.inet.0. virtual-routergives a separate table and protocols without VPN signaling;vrfis for Layer 3 VPNs;forwardingis for FBF.- A RIB group copies routes into several tables; the first
import-ribtable is the primary.
What it is
A routing instance is a separate set of routing tables, interfaces and protocol settings inside one router. The default instance is called master and uses inet.0. Each extra instance gets its own tables, named <instance>.inet.0 for IPv4.
A RIB group copies routes from one protocol into more than one routing table. Filter-based forwarding (FBF) uses a firewall filter to send selected packets to a routing instance with a different forwarding decision, so traffic is routed by source address, port or other fields, not only by destination.
How it works
Instance types
| Instance type | Purpose |
|---|---|
virtual-router | Separate routing table and protocols, no VPN signaling; like a router inside the router |
vrf | Layer 3 VPN instance with route distinguisher and route targets |
forwarding | Holds routes only; no interfaces; used for filter-based forwarding |
virtual-switch | Layer 2 bridging instance with its own bridge domains |
vpls, l2vpn, evpn | Layer 2 VPN services |
no-forwarding | Separates routing information without a separate forwarding table |
Configuring 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/3.0
user@router# set routing-instances CUST-A routing-options static route 0.0.0.0/0 next-hop 10.50.0.1
The interface now belongs to CUST-A. Its direct and local routes land in CUST-A.inet.0, not inet.0. An interface can belong to only one instance.
Many operational commands need the instance named:
user@router> show route table CUST-A.inet.0
user@router> ping 10.50.0.1 routing-instance CUST-A
user@router> show route instance
user@router> show ospf neighbor instance CUST-A
RIB groups
A RIB group is defined under routing-options rib-groups with an import-rib list. The first table in the list is the primary table, the one the protocol normally writes to. The other tables receive copies.
user@router# set routing-options rib-groups IF-TO-CUST import-rib [ inet.0 CUST-A.inet.0 ]
user@router# set routing-options interface-routes rib-group inet IF-TO-CUST
This copies every interface route in the master instance into CUST-A.inet.0 as well. An import-policy on the RIB group can limit which routes are copied.
RIB groups can be applied in several places:
| Applied to | Hierarchy |
|---|---|
| Interface routes | routing-options interface-routes rib-group inet <name> |
| Static routes | routing-options static rib-group <name> |
| OSPF | protocols ospf rib-group <name> |
| IS-IS | protocols isis rib-group inet <name> |
| BGP | protocols bgp family inet unicast rib-group <name> |
Filter-based forwarding
FBF has four parts. Each one must be present.
- A
forwardinginstance with its own route, usually a static default route. - A RIB group that copies interface routes into the forwarding instance, so its next hop resolves.
- A firewall filter whose
then routing-instanceaction sends matching packets to the instance. - The filter applied as an input filter on the interface where the traffic arrives.
user@router# set routing-instances ISP-A instance-type forwarding
user@router# set routing-instances ISP-A routing-options static route 0.0.0.0/0 next-hop 172.16.1.1
user@router# set routing-options rib-groups FBF-GROUP import-rib [ inet.0 ISP-A.inet.0 ]
user@router# set routing-options interface-routes rib-group inet FBF-GROUP
user@router# set firewall family inet filter SPLIT term SALES from source-address 10.10.10.0/24
user@router# set firewall family inet filter SPLIT term SALES then routing-instance ISP-A
user@router# set firewall family inet filter SPLIT term DEFAULT then accept
user@router# set interfaces ge-0/0/2 unit 0 family inet filter input SPLIT
Packets from 10.10.10.0/24 arriving on ge-0/0/2 are looked up in ISP-A.inet.0 and leave through 172.16.1.1. All other packets match term DEFAULT, are accepted and use inet.0 as usual.
The final then accept term is essential. Without it, every packet that does not match the FBF term hits the implicit discard at the end of the filter, and the whole LAN loses connectivity.
Verifying FBF
| Command | What to check |
|---|---|
show route table ISP-A.inet.0 | The default route and the copied direct routes are present |
show firewall filter SPLIT | Counters, if the term has a count action |
show interfaces filters | The filter is applied to ge-0/0/2.0 in the input direction |
traceroute <destination> source 10.10.10.1 | The path from a matching source, if the router owns that address |
Common mistakes
No RIB group for interface routes. The forwarding instance has a static default route to 172.16.1.1, but its table has no direct route to that subnet, so the next hop cannot be resolved and the route stays inactive.
Applying the filter as an output filter. FBF must change the lookup before forwarding, so the filter goes on the ingress interface as filter input.
Putting interfaces in a forwarding instance. A forwarding instance has no interfaces. It only holds routes.
Order matters in import-rib. The first table is the primary table, and for routes learned in the master instance it must be inet.0; the instance tables come after it.
What to remember for the exam
- The default instance is
masterwith tableinet.0; other instances use<name>.inet.0. virtual-routergives a separate table and protocols without VPN signaling;vrfis for Layer 3 VPNs;forwardingis for FBF.- A RIB group copies routes into several tables; the first
import-ribtable is the primary. - Apply RIB groups to interface routes with
routing-options interface-routes rib-group inet <name>. - FBF needs a forwarding instance, a RIB group, a filter with
then routing-instanceand an input filter on the ingress interface. - End an FBF filter with an accept term, or unmatched traffic is discarded.
- Use
routing-instance <name>withpingandtracerouteto test inside an instance.
Check yourself
In an FBF design, why is a RIB group needed for interface routes?
The forwarding instance must have the direct routes to resolve its static next hop, and the RIB group copies them from
inet.0.A RIB group lists
import-rib [ inet.0 VR1.inet.0 ]. Which table is the primary?inet.0, because the first table in the list is the primary table.An FBF filter has only a term that sends one subnet to the forwarding instance. What happens to traffic from other subnets on that interface?
It is dropped by the implicit discard at the end of the filter, so a final accept term is required.
Topic 3 of 4 in Protocol-Independent Routing
Test yourself on Protocol-Independent Routing
The full Juniper JNCIS-SP JN0-364 question bank has 860 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.