Configuring MPLS VPN
Route Target Rewrite
Finding Feature Information
Your software release may not support all the features documented in this module. For the latest caveats and feature information, see Bug Search Tool and the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the feature information table at the end of this module.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to http://www.cisco.com/go/cfn. An account on Cisco.com is not required.
Prerequisites for MPLS VPN Route Target Rewrite
Restrictions for MPLS VPN Route Target Rewrite
Route Target Rewrite can only be implemented in a single AS topology.
Information About MPLS VPN Route Target Rewrite
Route Target Replacement Policy
Routing policies for a peer include all configurations that may impact inbound or outbound routing table updates. The MPLS VPN Route Target Rewrite feature can influence routing table updates by allowing the replacement of route targets on inbound and outbound Border Gateway Protocol (BGP) updates. Route targets are carried as extended community attributes in BGP Virtual Private Network IP Version 4 (VPNv4) updates. Route target extended community attributes are used to identify a set of sites and VPN routing and forwarding (VRF) instances that can receive routes with a configured route target.
You can configure the MPLS VPN Route Target Rewrite feature on provider edge (PE) devices.
The figure below shows an example of route target replacement on PE devices in an Multiprotocol Label Switching (MPLS) VPN single autonomous system topology. This example includes the following configurations:
-
PE1 is configured to import and export RT 65000:1 for VRF Customer A and to rewrite all inbound VPNv4 prefixes with RT 65000:1 to RT 65000:2.
-
PE2 is configured to import and export RT 65000:2 for VRF Customer B and to rewrite all inbound VPNv4 prefixes with RT 65000:2 to RT 65000:1.

Route Maps and Route Target Replacement
The MPLS VPN Route Target Rewrite feature extends the Border Gateway Protocol (BGP) inbound/outbound route map functionality to enable route target replacement. The set extcomm-list delete command entered in route-map configuration mode allows the deletion of a route target extended community attribute based on an extended community list.
How to Configure MPLS VPN Route Target Rewrite
Configuring a Route Target Replacement Policy
Perform this task to configure a route target (RT) replacement policy for your internetwork.
If you configure a provider edge (PE) device to rewrite RT x to RT y and the PE has a virtual routing and forwarding (VRF) instance that imports RT x , you need to configure the VRF to import RT y in addition to RT x .
Applying the Route Target Replacement Policy
Perform the following tasks to apply the route target replacement policy to your network:
Associating Route Maps with Specific BGP Neighbors
Verifying the Route Target Replacement Policy
Configuration Examples for MPLS VPN Route Target Rewrite
- Examples: Configuring Route Target Replacement Policies
- Examples: Applying Route Target Replacement Policies
Examples: Configuring Route Target Replacement Policies
This example shows the route target (RT) replacement configuration of a Provider Edge (PE) device that exchanges Virtual Private Network Version 4 (VPNv4) prefixes with another Provider Edge (PE) device. The route map extmap is configured to replace RTs on inbound updates. Any incoming update with RT 65000:2 is replaced with RT 65000:1.
! ip extcommunity-list 1 permit rt 65000:2 ! route-map rtrewrite permit 10 match extcommunity 1 set extcomm-list 1 delete set extcommunity rt 65000:1 additive !
This example shows the use of the route-map configuration continue command when you need to apply more than one replacement rule on an update. In this example, an incoming update with RT 7777:222222222 is replaced with RT 65000:2. Without the continue 20 command, route-map evaluation would stop when a match on sequence 10 is made. With the continue 20 command, route-map evaluation continues into sequence 20 even if a match occurs in sequence 10.
! ip extcommunity-list 2 permit rt 7777:222222222 ip extcommunity-list 3 permit rt 2:2 ip extcommunity-list 4 permit rt 20000:111 ! route-map extmap1 permit 10 match extcommunity 2 continue 20 set extcomm-list 2 delete set extcommunity rt 65000:2 additive ! route-map extmap1 permit 20 match extcommunity 3 continue 30 set extcomm-list 3 delete ! route-map extmap1 permit 30 match extcommunity 4 set extcomm-list 4 delete !
![]() Note | The route-map configuration continue command is not supported on outbound route maps. |
Examples: Applying Route Target Replacement Policies
Examples: Associating Route Maps with Specific BGP Neighbor
This example shows the association of route map extmap with a Border Gateway Protocol (BGP) neighbor. The BGP inbound route map is configured to replace route targets (RTs) on incoming updates.
router bgp 1 address-family vpnv4 neighbor 2.2.2.2 route-map rtrewrite in
This example shows the association of the same route map with the outbound BGP neighbor. The route map is configured to replace RTs on outgoing updates.
router bgp 1 address-family vpnv4 neighbor 2.2.2.2 route-map rtrewrite out

Feedback