The vpn-target command configures a VPN target for the IPv4 or IPv6 address family of a VPN instance.
The undo vpn-target command cancels the VPN target of the IPv4 or IPv6 address family of a VPN instance.
By default, the VPN target of the IPv4 or IPv6 address family of a VPN instance is null.
vpn-target vpn-target &<1-8> [ both | export-extcommunity | import-extcommunity ]
undo vpn-target { all | vpn-target &<1-8> [ both | export-extcommunity | import-extcommunity ] }
| Parameter | Description | Value |
|---|---|---|
| vpn-target | Adds the VPN target extended community attribute to
the export or import VPN target extended community list. The VPN target
can be expressed in any of the following formats:
|
- |
| both | Specifies the extended community attributes of the received and the sent routing information. | - |
| export-extcommunity | Specifies the extended community attributes carried in routing information to be sent. | - |
| import-extcommunity | Specifies the extended community attributes carried in routing information to be received. | - |
VPN instance view, VPN instance IPv4 address family view or VPN instance IPv6 address family view
Usage Scenario
If a VPN instance is configured on a PE, the vpn-target command must be used to configure a VPN target for the IPv4 or IPv6 address family of the VPN instance.
The VPN target controls route learning between VPN sites. A VPN target may be either an import VPN target or an export VPN target. An export VPN target is contained in a VPNv4 or VPNv6 route to be advertised to a remote MP-BGP peer. After receiving a VPNv4 or VPNv6 route, an MP-BGP peer compares the received export VPN target with the local import VPN target to determine whether the VPNv4 or VPNv6 route can be added to the routing table of the local VPN instance enabled with the IPv4 or VPNv6 address family.
Prerequisites
The route-distinguisher command is run to configure an RD for the VPN instance enabled with the IPv4 or IPv6 address family.
Configuration Impact
A VPN target configured using the vpn-target command will not overwrite any previously configured VPN target. If the number of configured VPN targets has reached the maximum limit, no VPN target can be added by using the vpn-target command.
After a VPN target is configured for the IPv4 or IPv6 address family of a VPN instance, only the routes that match the VPN target will be accepted by the IPv4 or IPv6 address family of the VPN instance.
If all the VPN targets of the IPv4 or IPv6 address family of a VPN instance are deleted using the undo vpn-target command, all routes learned by the IPv4 or IPv6 address family of the VPN instance from other VPN instances will be deleted.
Precautions
Multiple VPN targets can be configured for the IPv4 or IPv6 address family of a VPN instance. One vpn-target command can configure a maximum of eight VPN targets at a time. If you want to configure more VPN targets in the VPN instance IPv4 or IPv6 address family view, run the vpn-target command multiple times. When VPN routes are advertised between VPN instances, if one of the VPN targets carried in the VPNv4 or VPNv6 routes matches the import VPN target of the IPv4 or VPNv6 address family of a local VPN instance, the routes will be added to the routing table of the local VPN instance.
# Add 3:3 and 4:4 to the export VPN target list and the import VPN target list for the IPv4 address family of the VPN instance named vrf1.
<sysname> system-view
[sysname] ip vpn-instance vrf1
[sysname-vpn-instance-vrf1] ipv4-family
[sysname-vpn-instance-vrf1-af-ipv4] route-distinguisher 100:1
[sysname-vpn-instance-vrf1-af-ipv4] vpn-target 3:3 export-extcommunity
[sysname-vpn-instance-vrf1-af-ipv4] vpn-target 4:4 import-extcommunity
# Add 5:5 to both the export VPN target list and import VPN target list of the IPv4 address family of the VPN instance named vrf1.
<sysname> system-view
[sysname] ip vpn-instance vrf1
[sysname-vpn-instance-vrf1] ipv4-family
[sysname-vpn-instance-vrf1-af-ipv4] route-distinguisher 100:1
[sysname-vpn-instance-vrf1-af-ipv4] vpn-target 5:5 both