Defining automatic route filtering

Each VRF is configured with import and export route targets. The export route target sets an extended community attribute number that is appended to all routes that are exported from the VRF. The import route target value sets a filter that determines the routes that are accepted into the VRF. Any route with a value in its import route-target contained in its extended attributes field matching the value in the VRFs import route target is accepted. Otherwise, the route is rejected. This process is referred to as automatic route filtering.

To define an import route target of 3:6 and an export route target of 3:8 for a VPN, enter the following commands.

        device(config-vrf)# route-target import 3:6 
device(config-vrf)# route-target export 3:8

Syntax: [no] route-target [ import | export | both ] route-target

This command associates a route target specified by the route-target variable with a specified VRF for control on routes.

The import parameter specifies that routes with route-target extended community attributes matching the specified route-target variable can be imported into the VRF where this command is configured.

The export parameter specifies the route-target extended community attributes that are attached to routes export from the specified VRF.

The both parameter specifies that both the import and export values apply to the specified route-target variable for the VRF where this command is configured. This is the default state. It applies when no specific value for this parameter is set.

The route-target variable specifies a target VRF extended community. Like a route distinguisher, it is either AS-relative or IP address-relative.