vpn-target

Function

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.

Format

vpn-target vpn-target &<1-8> [ both | export-extcommunity | import-extcommunity ]

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

Parameters

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:
  • 16-bit AS number: a 32-bit user-defined number, for example, 1:3. The AS number ranges from 0 to 65535. The user-defined number ranges from 0 to 4294967295. The AS number and the user-defined number cannot both be 0. That is, a VPN target cannot be 0:0.

  • 32-bit IP address: a 16-bit user-defined number, for example, 192.168.122.15:1. The IP address ranges from 0.0.0.0 to 255.255.255.255. The user-defined number ranges from 0 to 65535.

  • Integral 4-byte AS number:2-byte user-defined number, for example, 65537:3. An AS number ranges from 65536 to 4294967295. A user-defined number ranges from 0 to 65535. The AS number and user-defined number cannot be both 0s. That is, a VPN target cannot be 0:0.

  • 4-byte AS number in dotted notation:2-byte user-defined number, for example, 0.0:3 or 0.1:0. A 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 and from 0 to 65535, respectively. A user-defined number ranges from 0 to 65535. The AS number and user-defined number cannot be both 0s. That is, a VPN target cannot be 0.0:0.

-
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. -

Views

VPN instance view, VPN instance IPv4 address family view or VPN instance IPv6 address family view

Default Level

2: Configuration level

Usage Guidelines

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.

Example

# 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

Huawei Proprietary and Confidential
Copyright © Huawei Technologies Co., Ltd.