vpn-target (MPLS-L2VPN instance view)

Function

The vpn-target command configures VPN targets for an MPLS L2VPN instance.

The undo vpn-target command deletes the VPN targets of an MPLS L2VPN instance.

By default, no VPN targets are configured for an MPLS L2VPN instance.

Format

vpn-target { vpn-target } &<1-16> [ both | import-extcommunity | export-extcommunity ]

undo vpn-target { all | { vpn-target } &<1-16> } [ both | import-extcommunity | export-extcommunity ]

Parameters

Parameter Description Value
vpn-target

Specifies a VPN target.

A VPN target can be in any of the following formats:

  • 2-byte AS number:4-byte user-defined number, such as 1:3. The AS number is an integer ranging from 0 to 65535, and the user-defined number is an integer ranging from 0 to 4294967295. The AS and user-defined numbers cannot be both 0s. Specifically, the extended community attribute cannot be 0:0.
  • 4-byte IP address:2-byte user-defined number, such as 192.168.122.15:1. The IP address ranges from 0.0.0.0 to 255.255.255.255, and the user-defined number ranges from 0 to 65535.
  • 4-byte AS number:2-byte user-defined number, such as 65537:3. The AS number ranges from 65536 to 4294967295, and the user-defined number ranges from 0 to 65535. The AS and user-defined numbers cannot be both 0s. Specifically, the extended community attribute cannot be 0:0.
  • 4-byte AS number in dotted notation:2-byte user-defined number, such as 0.0:3 or 0.1:0. The 4-byte AS number in dotted notation is in the format of x.y, where x and y are integers that range from 0 to 65535. The user-defined number also ranges from 0 to 65535. The AS and user-defined numbers cannot be both 0s. Specifically, the extended community attribute cannot be 0.0:0.
both

Indicates both the import and export VPN targets.

-

import-extcommunity

Indicates the import VPN target.

-

export-extcommunity

Indicates the export VPN target.

-

all

Deletes all VPN targets.

-

Views

MPLS-L2VPN instance view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
l2vpn write

Usage Guidelines

Usage Scenario

BGP VPWS uses VPN targets to control route exchange among nodes:

  • When advertising routes to other PEs according to an MPLS L2VPN instance, a PE adds the export VPN target to these routes.
  • When receiving routes from other PEs, a PE uses import VPN targets to determine whether to import these routes to the corresponding MPLS L2VPN instance.

Prerequisites

An RD has been configured using the route-distinguisher route-distinguisher command for the MPLS L2VPN instance.

Configuration Impact

Two PEs can communicate only if the import VPN target of one PE matches the export VPN target of the other PE.

Precautions

If none of both, export-extcommunity, and import-extcommunity is specified, both is used by default.

Example

# Configure VPN targets in the format of "4-byte AS number:2-byte user-defined number" for an MPLS L2VPN instance named vpn3.
<HUAWEI> system-view
[~HUAWEI] mpls l2vpn
[*HUAWEI-l2vpn] quit
[*HUAWEI] mpls l2vpn vpn3 encapsulation vlan
[*HUAWEI-mpls-l2vpn-vpn3] vpn-target 65537:30
# Configure VPN targets in the format of "4-byte AS number in dotted notation:2-byte user-defined number" for an MPLS L2VPN instance named vpn2.
<HUAWEI> system-view
[~HUAWEI] mpls l2vpn
[*HUAWEI-l2vpn] quit
[*HUAWEI] mpls l2vpn vpn2 encapsulation vlan
[*HUAWEI-mpls-l2vpn-vpn2] vpn-target 16.20:30
# Delete all the VPN targets of an MPLS L2VPN instance named vpn1.
<HUAWEI> system-view
[~HUAWEI] mpls l2vpn
[*HUAWEI-l2vpn] quit
[*HUAWEI] mpls l2vpn vpn1 encapsulation vlan
[*HUAWEI-mpls-l2vpn-vpn1] undo vpn-target all
# Delete some VPN targets of an MPLS L2VPN instance named vpn1.
<HUAWEI> system-view
[~HUAWEI] mpls l2vpn
[*HUAWEI-l2vpn] quit
[*HUAWEI] mpls l2vpn vpn1 encapsulation vlan
[*HUAWEI-mpls-l2vpn-vpn1] undo vpn-target 100:100 import-extcommunity
[*HUAWEI-mpls-l2vpn-vpn1] undo vpn-target 200:200 export-extcommunity
# Configure the import and export VPN targets of an MPLS L2VPN instance named vpn1 as 100:100 and 200:200, respectively.
<HUAWEI> system-view
[~HUAWEI] mpls l2vpn
[*HUAWEI-l2vpn] quit
[*HUAWEI] mpls l2vpn vpn1 encapsulation vlan
[*HUAWEI-mpls-l2vpn-vpn1] vpn-target 100:100 import-extcommunity
[*HUAWEI-mpls-l2vpn-vpn1] vpn-target 200:200 export-extcommunity
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >