This article presents details of configuration needed to import the following types of routes in and out of the routing instances from virtual routers (VR):
How to import routes from various routing instances to other routing instances, including the default routing instance.
The setup in this article uses a routing instance (type: Virtual Router (VR)) and the default instance for the route import functions. There are three different examples along with reasons to use one or the other:
[edit] root@ipd-fw# show routing-options rib-groups { To-Instance-Inet { import-rib [ inet.0 VR-Test1.inet.0 ]; } }
VR-Test1 { instance-type virtual-router; interface fe-0/0/4.0; routing-options { interface-routes { rib-group inet To-Instance-Inet; } } }
run show route
root@ipd-fw# run show route inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.10.10.0/30 *[Direct/0] 01:15:06 > via ge-0/0/1.0 10.10.10.1/32 *[Local/0] 01:15:06 Local via ge-0/0/1.0 13.13.13.0/30 *[Direct/0] 00:00:14 > via fe-0/0/4.0 13.13.13.1/32 *[Local/0] 00:00:14 Local via fe-0/0/4.0 VR-Test1.inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 13.13.13.0/30 *[Direct/0] 01:15:06 > via fe-0/0/4.0 13.13.13.1/32 *[Local/0] 01:15:06 Local via fe-0/0/4.0
root@idp-fw# show routing-options interface-routes { rib-group inet To-Instance-Inet; }
VR-Test1.inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 11.11.11.0/30 *[OSPF/10] 01:11:24, metric 2 > to 10.10.10.2 via ge-0/0/1.0 12.12.12.0/30 *[OSPF/10] 01:11:24, metric 2
To import these routes to the table inet.0, two methods can be used:
This method uses the routing policies to import the routes from any routing instance.
root@idp-fw# show policy-options policy-statement accept-all { term 1 { from { instance VR-Test1; protocol ospf; } then accept; } term 2 { then reject; } }
[edit] root@ipd-fw# show routing-options instance-import accept-all;
This imports all the OSPF routes from VR (VR-Test1) to the inet.0 table. To verify, run the command of this example, showing how 11.11.11.0/30 and 12.12.12.0/30, which are OSPF routes, have been imported in the inet.0 table:
[edit] root@ipd-fw# run show route inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[Static/5] 00:46:40 > to 10.10.10.2 via ge-0/0/1.0 10.10.10.0/30 *[Direct/0] 02:01:32 > via ge-0/0/1.0 10.10.10.1/32 *[Local/0] 02:01:32 Local via ge-0/0/1.0 11.11.11.0/30 *[OSPF/10] 01:57:50, metric 2 > to 10.10.10.2 via ge-0/0/1.0 12.12.12.0/30 *[OSPF/10] 01:57:50, metric 2 > to 10.10.10.2 via ge-0/0/1.0 13.13.13.0/30 *[Direct/0] 00:46:40 > via fe-0/0/4.0 13.13.13.1/32 *[Local/0] 00:46:40 Local via fe-0/0/4.0 224.0.0.5/32 *[OSPF/10] 05:25:17, metric 1 MultiRecv VR-Test1.inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 11.11.11.0/30 *[OSPF/10] 01:11:24, metric 2 > to 10.10.10.2 via ge-0/0/1.0 12.12.12.0/30 *[OSPF/10] 01:11:24, metric 2 > to 10.10.10.2 via ge-0/0/1.0 13.13.13.0/30 *[Direct/0] 01:15:06 > via fe-0/0/4.0 13.13.13.1/32 *[Local/0] 01:15:06 Local via fe-0/0/4.0 224.0.0.5/32 *[OSPF/10] 04:38:51, metric 1 MultiRecv
Control and filter the type and prefix list of the routes you want to import using the option under the routing policy.
Using rib-groups:
This method is useful when you want to import a route from the default table inet.0. Observe these points when using this method:
Note that it is not mandatory to have only two tables. Any number of tables to which you want to import the routing information can be included at the trailing end.
[edit] root@ipd-fw# commit [edit routing-instances VR-Test1 protocols] 'ospf' rib-group To-Instance-Inet: primary routing table does not match instance VR-Test1 error: configuration check-out failed
routing-options { rib-groups { To-Instance-Inet { import-rib [ VR-Test1.inet.0 inet.0 ]; } } }
routing-instance { VR-Test1 { instance-type virtual-router; interface ge-0/0/1.0; protocols { ospf { rib-group To-Instance-Inet; area 0.0.0.0 { interface ge-0/0/1.0; } } } } }
root@ipd-fw# run show route inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 11.11.11.0/30 *[OSPF/10] 00:14:15, metric 2> to 10.10.10.2 via ge-0/0/1.012.12.12.0/30 *[OSPF/10] 00:14:15, metric 2> to 10.10.10.2 via ge-0/0/1.013.13.13.0/30 *[Direct/0] 01:30:05 > via fe-0/0/4.0 13.13.13.1/32 *[Local/0] 01:30:05 Local via fe-0/0/4.0 224.0.0.5/32 *[OSPF/10] 01:30:05, metric 1 MultiRecv VR-Test1.inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.10.10.0/30 *[Direct/0] 01:30:19 > via ge-0/0/1.0 10.10.10.1/32 *[Local/0] 01:30:19 Local via ge-0/0/1.0 11.11.11.0/30 *[OSPF/10] 00:14:29, metric 2> to 10.10.10.2 via ge-0/0/1.012.12.12.0/30 *[OSPF/10] 00:14:29, metric 2> to 10.10.10.2 via ge-0/0/1.0224.0.0.5/32 *[OSPF/10] 01:30:19, metric 1 MultiRecv
The static routes from the routing instances, either VR or default instance, can be imported into other VRs. This example imports a static route from the inet.0 table to the VR-Test1.inet.0 table. Here, VR-Test1 is a routing-instance (Type : Virtual-Router).
[edit] root@ipd-fw# show routing-options static { rib-group To-Instance-Inet; route 0.0.0.0/0 next-hop 10.10.10.2; } rib-groups { To-Instance-Inet { import-rib [ inet.0 VR-Test1.inet.0 ]; } }
Verify by checking the routing table.
[edit] root@ipd-fw# run show route inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[Static/5] 00:01:29> to 10.10.10.2 via ge-0/0/1.010.10.10.0/30 *[Direct/0] 01:00:29 > via ge-0/0/1.0 10.10.10.1/32 *[Local/0] 01:00:29 Local via ge-0/0/1.0 VR-Test1.inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[Static/5] 00:01:42> to 10.10.10.2 via ge-0/0/1.011.11.11.0/30 *[OSPF/10] 00:57:00, metric 2 > to 10.10.10.2 via ge-0/0/1.0 12.12.12.0/30 *[OSPF/10] 00:57:00, metric 2 > to 10.10.10.2 via ge-0/0/1.0 13.13.13.0/30 *[Direct/0] 01:00:42 > via fe-0/0/4.0