Support Support Downloads Knowledge Base Case Manager My Juniper Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[Junos] What is the use of RIB groups and how are they used?

0

0

Article ID: KB16133 KB Last Updated: 14 Apr 2020Version: 6.0
Summary:

This article provides information on how a RIB group (Routing Information Base group) is used within the Junos OS software. For more information about the RIB concept in the Junos OS, refer to the Routing Table Features in Junos documentation page. See also the RIB Groups poster.

 

Symptoms:

The use of a RIB group (Routing Information Base group) in Junos OS software

 

Solution:

A RIB group is a template-like configuration, providing a way for a routing protocol to install routing information (routes, prefixes) into multiple Routing Tables that are defined in the Junos OS. A RIB group should be understood precisely as a "template". For a RIB group to take effect, it must first be both defined and applied within a specified routing protocol context.

A RIB group is defined by using the import-rib statement under the [edit routing-options rib-groups] configuration hierarchy:

routing-option {
    rib-groups {
        <rib-group name> {
            import-rib [ source-routing-table destination-routing-table1 destination-routing-table2 ......... ]
            import-policy policy-name;
        }
    }
}

Each RIB group specifies the source RIB where the routing information comes from and the list of all target RIBs where the routing information should be copied to. An example of a RIB group that is used to copy the content of the default IPv4 unicast routing table inet.0 into the RIB test.inet.0 (IPv4 unicast routing table defined within the routing-instance test) is provided below:

routing-options      {
    rib-groups  {
        RG-DEFAULT-TO-TEST { # RG name, suggesting copying of routes from the default routing-instance to routing-instance test
            import-rib [ inet.0 test.inet.0 ];
            import-policy PL-RG-DEFAULT-TO-TEST;    # Optional route filtering policy
        }
    }
}

policy-options {
    policy-statement PL-RG-DEFAULT-TO-TEST {
        term interfaces {
            from {
                protocol direct;
                route-filter 198.18.1.0/24 orlonger;
            }
            to rib test.inet.0;
            then accept;
        }
        then reject;
    }
}

An optional policy controls which routes are being copied. If omitted, all routes from the source RIB are copied into all destination RIBs. Having a policy is useful, especially if one source RIB is copied into multiple destination RIBs, in which case prefixes being copied may be controlled by using the "to" control within the policy statement. For instance:

routing-options      {
    rib-groups  {
        RG-DEFAULT-TO-VRs { # Copy prefixes from default routing instance to all virtual routers
            import-rib [ inet.0 VR-A.inet.0 VR-B.inet.0 ];
            import-policy PL-RG-DEFAULT-TO-VRs;    # Optional route filtering policy
        }
    }
}

policy-options {
    policy-statement PL-RG-DEFAULT-TO-VRs {
        term VR-A {
            from {
                protocol direct;
                route-filter 198.18.1.0/24 orlonger;
            }
            to rib VR-A.inet.0;
            then accept;
        }
        term VR-B {
            from {
                protocol direct;
                route-filter 198.18.2.0/24 orlonger;
            }
            to rib VR-B.inet.0;
            then accept;
        }
        then reject;
    }
}

The export-rib and import-rib statements under the [edit routing-options rib-groups rib-group-name] configuration hierarchy tell the RIB group what to do with the route information, with respect to the RIBs. In general, when speaking of exporting or importing routing information in Junos OS, the reference point is always the RIB. In other words, routes are always:

  • Imported into the RIB (from external sources, e.g. various routing protocols - direct, static, IS-IS, OSPF, BGP ...)

  • Exported from the RIB (towards the routing protocols)

This has an impact on the export-rib and import-rib statements as well:

  • import-rib: Tells the router into which routing tables to import information from various routing protocols. Routing information may be imported into multiple RIBs, hence the import-rib statement may reference multiple RIBs.

  • export-rib: Tells the router from which routing tables to export routing information into the RIB. Unlike the previous command, only one table can be used as a source of routing information. This knob is seldom used.

The RIB group, which is defined solely at the [edit routing-options rib-group] configuration hierarchy, does not have any effect on the routing process until it is applied within the proper routing protocol context. For instance, to apply the above defined RIB group to the routes derived from directly connected interfaces belonging to the master (default) routing instance (protocol 'direct'), refer the RIB group at the [edit routing-options interface-routes] configuration hierarchy:

routing-options {
    interface-routes {
        rib-group inet RG-DEFAULT-TO-TEST;  # Instruct the routing process to copy directly connected routes from inet.0 to test.inet.0
    }
}

The command above is applied under the interface route configuration within the default (master) routing instance, because the source of the routing information (RIB inet.0) is a part of the default routing instance. Only one single RIB group may be applied within the routing protocol configuration context of a routing instance. For instance, only one RIB group is accepted at the [edit routing-options interface-routes rib-group inet] (same holds for inet6) configuration hierarchy.

Likewise, to instruct the routing process to copy routes learned via the IS-IS protocol in the default (master) routing instance, from inet.0 to test.inet.0 (apply the above defined RIB Group), use the following configuration:

protocols   {
    isis {
        rib-group RG-DEFAULT-TO-TEST;
    }
}

Sometimes, it is also required to copy routes from a non-default routing-instance (e.g. virtual-router, vrf, etc) into the default (master) routing instance. The following RIB group defines that direction:

routing-options      {
    rib-groups  {
        RG-TEST-TO-DEFAULT { # RG name, suggesting copying of routes from routing-instance test to the default routing instance
            import-rib [ test.inet.0 inet.0 ];
        }
    }
}

Again, for this RIB group to take effect, it must be applied within the correct routing protocol configuration context. Since routes in the RIB test.inet.0 are defined within the routing-instance test, the proper routing protocol configuration context is the routing protocol configuration within the routing instance test, that is:

routing-instances {
    test {
        instance-type virtual-router;             # Can be any routing-instance type, expect no-forwarding
        routing-options {
            interface-routes {
                rib-group inet RG-TEST-TO-DEFAULT;  # Copies interface routes (protocol direct) from test.inet.0 into inet.0
            }
        }
        protocols {
            ospf {
                rib-group RG-TEST-TO-DEFAULT;       # Copies OSPF routes from test.inet.0 into inet.0
            }
        }
    }
}

To check the effect of those commands, use the standard show route commands, for example:

user@router> show route 198.18.1.0/24

inet.0: 86430 destinations, 173908 routes (86430 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
198.18.1.0/30      *[Direct/0] 19w3d 22:29:27
                    > via ae0.123
198.18.1.4/30      *[Direct/0] 19w3d 22:29:27
                    > via ae0.125
test.inet.0: 8811 destinations, 15489 routes (8811 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
198.18.1.0/24      *[Direct/0] 06:51:39
                    > via ae0.123
198.18.1.4/30      *[Direct/0] 19w3d 22:29:27
                    > via ae0.125
100.100.100.100/32 *[Direct/0] 19w3d 22:29:27
  > via lo0.0

As seen below, the route is present in both RIBs. The export/import information can be obtained by using show route detail as shown below:

user@router> show route detail
inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden)
100.100.100.100/32 (1 entry, 0 announced)
        *Direct Preference: 0
                Next hop type: Interface, Next hop index: 0
                Address: 0xb6220f0
                Next-hop reference count: 2
                Next hop: via lo0.0, selected
                State: <Active Int>
                Local AS:   100
                Age: 4d 5:50:46
                Validation State: unverified
                Task: IF
                AS path: I
                Secondary Tables: test.inet.0

test.inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden)

100.100.100.100/32 (1 entry, 1 announced)
        *Direct Preference: 0
                Next hop type: Interface, Next hop index: 0
                Address: 0xb6220f0
                Next-hop reference count: 2
                Next hop: via lo0.0, selected
                State: <Secondary Active Int>
                Local AS:   100
                Age: 2:11
                Validation State: unverified
                Task: IF
                Announcement bits (1): 1-KRT
                AS path: 100 I
                Primary Routing Table inet.0

 

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search