Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Example: Exporting Specific Routes from One Routing Table Into Another Routing Table

This example shows how to duplicate specific routes from one routing table into another routing table within the same routing instance.

Requirements

No special configuration beyond device initialization is required before configuring this example.

Overview

This example uses the auto-export statement and the rib-group statement to accomplish the goal of exporting specific routes from one routing table to another.

Consider the following points:

  • When auto-export is configured in a routing instance, the vrf-import and vrf-export policies are examined. Based on the route target and community information in the policies, the auto-export function performs route leaking among the local routing instance inet.0 tables.
  • You can use the rib-group statement if it is necessary to import routes into tables other than instance.inet.0. If a RIB group is used, the RIB group's export-rib and import-policy statements are not used. Only the import-rib statement is used. To use a RIB group with auto-export, the routing instance should specify explicit vrf-import and vrf-export policies. The vrf-import and vrf-export policies can be extended to contain additional terms to filter routes as needed for the RIB group.

In this example, access-internal routes are added into the vpna.inet.0 routing table. The access-internal routes are also duplicated into the vpna.inet.2 routing table.

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

set interfaces fe-1/3/1 vlan-taggingset interfaces fe-1/3/1 unit 0 vlan-id 512set interfaces fe-1/3/1 unit 0 family inet address 10.168.100.3/24set interfaces lo0 unit 0 family inet address 192.168.3.3/32set routing-options rib-groups rib-group-vpna-access-internal import-rib vpna.inet.2set routing-options autonomous-system 63000set policy-options policy-statement vpna-export term a from protocol bgpset policy-options policy-statement vpna-export term a then community add vpna-commset policy-options policy-statement vpna-export term a then acceptset policy-options policy-statement vpna-export term b from protocol access-internalset policy-options policy-statement vpna-export term b then acceptset policy-options policy-statement vpna-export term c then rejectset policy-options policy-statement vpna-import term a from protocol bgpset policy-options policy-statement vpna-import term a from community vpna-commset policy-options policy-statement vpna-import term a then acceptset policy-options policy-statement vpna-import term b from instance vpnaset policy-options policy-statement vpna-import term b from protocol access-internalset policy-options policy-statement vpna-import term b then acceptset policy-options policy-statement vpna-import term c then rejectset policy-options community vpna-comm members target:63000:100set routing-instances vpna instance-type vrfset routing-instances vpna interface fe-1/3/1.1set routing-instances vpna route-distinguisher 100:1set routing-instances vpna vrf-import vpna-importset routing-instances vpna vrf-export vpna-exportset routing-instances vpna routing-options auto-export family inet unicast rib-group rib-group-vpna-access-internalset routing-instances vpna protocols bgp group bgp-vpna type externalset routing-instances vpna protocols bgp group bgp-vpna family inet multicastset routing-instances vpna protocols bgp group bgp-vpna peer-as 100set routing-instances vpna protocols bgp group bgp-vpna neighbor 10.0.0.10

Configuring Specific Route Export Between Routing Tables

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

To configure the device:

  1. Configure the interfaces.
    [edit interfaces fe-1/3/1]user@host# set vlan-tagginguser@host# set unit 0 vlan-id 512user@host# set unit 0 family inet address 10.168.100.3/24[edit interfaces lo0 unit 0]user@host# set family inet address 192.168.3.3/32
  2. Configure the routing policy that specifies particular routes for import into vpna.inet.0 and export from vpna.inet.0.
    [edit policy-options policy-statement vpna-export]user@host# set term a from protocol bgpuser@host# set term a then community add vpna-commuser@host# set term a then acceptuser@host# set term b from protocol access-internaluser@host# set term b then acceptuser@host# set term c then reject[edit policy-options policy-statement vpna-import]user@host# set term a from protocol bgpuser@host# set term a from community vpna-commuser@host# set term a then acceptuser@host# set term b from instance vpnauser@host# set term b from protocol access-internaluser@host# set term b then acceptuser@host# set term c then reject[edit policy-options]user@host# set community vpna-comm members target:63000:100
  3. Configure the routing instance.
    [edit routing-instances vpna]user@host# set instance-type vrfuser@host# set interface fe-1/3/1.1user@host# set route-distinguisher 100:1user@host# set vrf-import vpna-importuser@host# set vrf-export vpna-export

    The vrf-import and vrf-export statements are used to apply the vpna-import and vpna-export routing policies configured in 2.

  4. Configure the RIB group, and import routes into the vpna.inet.2 routing table.
    [edit routing-options]user@host# set rib-groups rib-group-vpna-access-internal import-rib vpna.inet.2
  5. Configure the auto-export statement to enable the routes to be exported from one routing table into another.
    [edit routing-options]user@host# set auto-export family inet unicast rib-group rib-group-vpna-access-internal
  6. Configure BGP.
    [edit routing-instances vpna protocols bgp group bgp-vpna]user@host# set type externaluser@host# set family inet multicastuser@host# set peer-as 100user@host# set neighbor 100.0.0.10
  7. Configure the autonomous system (AS) number.
    [edit routing-options]user@host# set autonomous-system 63000

Results

From configuration mode, confirm your configuration by entering the show interfaces, show policy-options, show routing-options, and show routing-instances commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.

user@host# show interfaces
fe-1/3/1 {vlan-tagging;unit 0 {vlan-id 512;family inet {address 10.168.100.3/24;}}}
lo0 {unit 0 {family inet {address 192.168.3.3/32;}}}
user@host# show policy-options
policy-statement vpna-export {term a {from {protocol bgp;}then {community add vpna-comm;accept;}}term b {from protocol access-internal;then accept;}term c {then reject;}}
policy-statement vpna-import {term a {from {protocol bgp;community vpna-comm;}then accept;}term b {from {instance vpna;protocol access-internal;}then accept;}term c {then reject;}}
community vpna-comm members target:63000:100;
user@host# show routing-options
rib-groups {rib-group-vpna-access-internal {import-rib vpna.inet.2;}}
autonomous-system 63000;
user@host# show routing-instances
vpna {instance-type vrf;interface fe-1/3/1.1;route-distinguisher 100:1;vrf-import vpna-import;vrf-export vpna-export;routing-options {auto-export {family inet {unicast {rib-group rib-group-vpna-access-internal;}}}}protocols {bgp {group bgp-vpna {type external;family inet {multicast;}peer-as 100;neighbor 100.0.0.10;}}}}

If you are done configuring the device, enter commit from configuration mode.

Verification

Confirm that the configuration is working properly by running the show table route vpna.inet.0 and show route table vpna.inet.2 commands.

Published: 2013-07-23

Published: 2013-07-23