The vpn-target evpn command configures the export or import VPN target extended community attribute when a VPN instance address family advertises routes to an EVPN instance.
The undo vpn-target command deletes the VPN target extended community attribute from a VPN instance address family.
By default, no export or import VPN target extended community attribute list is configured for a VPN instance address family.
vpn-target vpn-target &<1-8> [ both | export-extcommunity | import-extcommunity ] evpn
undo vpn-target { all | vpn-target &<1-8> [ both | export-extcommunity | import-extcommunity ] [ evpn ] }
Parameter | Description | Value |
---|---|---|
vpn-target | Adds a VPN target to the VPN target extended community attribute list of the VPN instance address family. The forms of VPN targets are as follows:
|
- |
both | Adds a VPN target to the import or export VPN target extended community attribute list of the VPN instance address family. If keywords both, export-extcommunity,and import-extcommunityare not specified, both is used. | - |
export-extcommunity | Adds a VPN target to the export VPN target extended community attribute list of the VPN instance address family. | - |
import-extcommunity | Adds a VPN target to the import VPN target extended community attribute list of the VPN instance address family. | - |
evpn | Specifies a VPN target for determining whether a route can be added to the routing table of an EVPN instance. | - |
all | Deletes all the VPN targets of the VPN instance address family. | - |
VPN instance view, VPN instance IPv4 address family view, VPN instance IPv6 address family view
Usage Scenario
When you configure a VPN instance on a device, you must run the vpn-target evpn command to configure a VPN target attribute of EVPN routes for the address family of the VPN instance.
The VPN target controls route learning of EVPN routes. A VPN target attribute is either an import one or an export one. An export VPN target is carried in a EVPN route to be advertised to a remote MP-BGP peer. When receiving a EVPN route, a peer compares the received VPN target attribute with the import VPN target attribute to determine whether the EVPN route can be added to the routing table of the local VPN instance address family.
In the VXLAN deployed through BGP EVPN scenario, to add EVPN routes to the routing table of an VPN instance, run the vpn-target command to configure the corresponding VPN target.
Prerequisites
The route-distinguisher command have been run to configure the VPN instance RD.
Precautions
A VPN target configured using the vpn-target evpn 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 running the vpn-target evpn command.
After a VPN target is configured for the address family of a VPN instance, only the routes that match the VPN target are accepted by the address family of the VPN instance.
If all the VPN targets of the address family of a VPN instance are deleted using the undo vpn-target evpn command, all EVPN routes learned by the address family of the VPN instance from other VPN instances are deleted.
Multiple VPN targets can be configured for the address family of a VPN instance. The vpn-target evpn command can configure a maximum of eight VPN targets at a time. To configure more VPN targets in the VPN instance view, run the vpn-target evpn command multiple times. When EVPN routes are advertised between VPN instances, if one of the VPN targets carried in the EVPN routes matches the import VPN target of the address family of a local VPN instance, the routes are added to the routing table of the local VPN instance.
# Add 3:3 to the export VPN target EVPN list and 4:4 to the import VPN target evpn list of VPN instance 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 evpn [HUAWEI-vpn-instance-vrf1-af-ipv4] vpn-target 4:4 import-extcommunity evpn