Note: This exercise was done using Juniper model mx2008
Also worth noting is that implementing routing between routing-instances using policy-options can only work for instance-type “virtual-router” and doesn’t work for instance-type “vrf”. Instance-type virtual-router in juniper is similar to Cisco’s VRF-lite and is used to create separate routing tables within a single device and provides logical separation of routing instances. On the other hand, Instance-type vrf is primarily used in MPLS/VPN architectures and allows the creation of Virtual Routing and Forwarding (VRF) instances, which are used to isolate customer traffic in a service provider network. Therefore in instance-type vrf
, routes are typically exchanged using MP-BGP and controlled by route-targets. The import and export of routes are managed through these route-targets rather than traditional policy statements. That said, here is a procedure to help you implement the routing between the instances effectively and verify the configuration through connectivity tests.
Objective:
- InstanceA: Route
10.10.10.0/24
needs to be learned in InstanceB. - InstanceB: Route
192.168.0.0/24
needs to be learned in InstanceA.
Step 1: Define Export Policy Statements
a) Create Export Policy for InstanceA to InstanceB
set policy-options policy-statement EXPORT_TO_B term 1 from instance Instance_A
set policy-options policy-statement EXPORT_TO_B term 1 from route-filter 10.10.10.0/24 exact
set policy-options policy-statement EXPORT_TO_B term 1 then accept
Comment: This policy exports the route 10.10.10.0/24
from InstanceA to InstanceB.
b) Create Export Policy for InstanceB to InstanceA
set policy-options policy-statement EXPORT_TO_A term 1 from instance Instance_B
set policy-options policy-statement EXPORT_TO_A term 1 from route-filter 192.168.0.0/24 exact
set policy-options policy-statement EXPORT_TO_A term 1 then accept
Comment: This policy exports the route 192.168.0.0/24
from InstanceB to InstanceA.
Step 2: Define Import Policy Statements
a) Create Import Policy for InstanceA from InstanceB
set policy-options policy-statement IMPORT_FROM_B term 1 from instance Instance_B
set policy-options policy-statement IMPORT_FROM_B term 1 from route-filter 192.168.0.0/24 exact
set policy-options policy-statement IMPORT_FROM_B term 1 then accept
Comment: This policy imports the route 192.168.0.0/24
from InstanceB into InstanceA.
b) Create Import Policy for InstanceB from InstanceA
set policy-options policy-statement IMPORT_FROM_A term 1 from instance Instance_A
set policy-options policy-statement IMPORT_FROM_A term 1 from route-filter 10.10.10.0/24 exact
set policy-options policy-statement IMPORT_FROM_A term 1 then accept
Comment: This policy imports the route 10.10.10.0/24
from InstanceA into InstanceB.
Step 3: Apply the Export/Import Policies to the Respective Routing Instances
a) Configure Instance_A
set routing-instances Instance_A routing-options instance-export EXPORT_TO_B
set routing-instances Instance_A routing-options instance-import IMPORT_FROM_B
Comment: This applies the export policy EXPORT_TO_B
and the import policy IMPORT_FROM_B
to Instance_A.
b) Configure Instance_B
set routing-instances Instance_B routing-options instance-export EXPORT_TO_A
set routing-instances Instance_B routing-options instance-import IMPORT_FROM_A
Comment: This applies the export policy EXPORT_TO_A
and the import policy IMPORT_FROM_A
to Instance_B.
Step 4: Create Loopback Interfaces for Testing
a) Create Loopback Interface in Instance_A
set routing-instances Instance_A interfaces lo0 unit 10 family inet address 10.10.10.1/32
Comment: This creates a loopback interface lo0.10
with IP 10.10.10.1/32
in Instance_A.
b) Create Loopback Interface in Instance_B
set routing-instances Instance_B interfaces lo0 unit 20 family inet address 192.168.0.1/32
Comment: This creates a loopback interface lo0.20
with IP 192.168.0.1/32
in Instance_B.
Step 5: Verification
a) Verify Routing Tables
show route table Instance_A.inet.0
show route table Instance_B.inet.0
Comment: Ensure that the routes are correctly imported and exported between the instances.
b) Test Connectivity
ping routing-instance Instance_A 192.168.0.1
ping routing-instance Instance_B 10.10.10.1
Comment: Verify that Instance_A
can ping the loopback interface lo0.20
in Instance_B
and vice versa.