The vpn-target command configures the export or import VPN target extended community attribute for the VPN instance address family.
The undo vpn-target command deletes the setting.
By default, no export or import VPN target extended community list is configured for the VPN instance address family.
vpn-target vpn-target &<1-8> [ both | export-extcommunity | import-extcommunity ]
undo vpn-target { all | vpn-target &<1-8> [ both | export-extcommunity | import-extcommunity ] }
Only the following switch models support this command:
S5720-EI, S5720-HI, S5720I-SI, S5720S-SI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5730-HI, S5730S-EI, S5730-SI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6720S-SI, S6720-SI, S6730-H, S6730S-H, S6730-S, and S6730S-S
The S5720I-SI, S5720S-SI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5730S-EI, S5730-SI, S6720S-SI, and S6720-SI only support the VPN instance view and VPN instance IPv4 address family view.
Parameter | Description | Value |
---|---|---|
vpn-target |
Specifies the VPN target extended community attribute to be added to the VPN target extended community list of the VPN instance address family. The forms of VPN targets are as follows:
|
- |
both |
Adds the VPN target extended community attribute to the export and import VPN target extended community lists of the VPN instance address family. If none of both, export-extcommunity, or import-extcommunity is specified, both is adopted by default. |
- |
export-extcommunity |
Adds the VPN target extended community attribute to the export VPN target extended community lists of the VPN instance address family. |
- |
import-extcommunity |
Adds the VPN target extended community attribute to the import VPN target extended community lists of the VPN instance address family. |
- |
all |
Delete all the VPN targets of the VPN instance IPv4 address family. |
- |
VPN instance view, VPN instance IPv4 address family view, 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 IPv6 route to be advertised to a remote MP-BGP peer. After receiving a VPNv4 or IPv6 route, an MP-BGP peer compares the received export VPN target with the local import VPN target to determine whether the VPNv4 or IPv6 route can be added to the routing table of the local VPN instance enabled with the IPv4 or IPv6 address family.
Prerequisites
The route-distinguisher command has been executed to set the RD of the VPN instance.
Precautions
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.
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 IPv6 routes matches the import VPN target of the IPv4 or IPv6 address family of a local VPN instance, the routes will be added to the routing table of the local VPN instance.
# Add 3:3 to the export VPN target extended community list and 4:4 to the import VPN target extended community list of the VPN instance named vrf1.
<HUAWEI> system-view [HUAWEI] ip vpn-instance vrf1 [HUAWEI-vpn-instance-vrf1] ipv4-family [HUAWEI-vpn-instance-vrf1-af-ipv4] route-distinguisher 100:1 [HUAWEI-vpn-instance-vrf1-af-ipv4] vpn-target 3:3 export-extcommunity [HUAWEI-vpn-instance-vrf1-af-ipv4] vpn-target 4:4 import-extcommunity