使用 CLI 创建和修改 ExpressRoute 线路的对等互连Create and modify peering for an ExpressRoute circuit using CLI

本文介绍如何使用 CLI 在资源管理器部署模型中创建和管理 ExpressRoute 线路的路由配置/对等互连。This article helps you create and manage routing configuration/peering for an ExpressRoute circuit in the Resource Manager deployment model using CLI. 还可以检查状态,以及更新、删除和取消预配 ExpressRoute 线路的对等互连。You can also check the status, update, or delete and deprovision peerings for an ExpressRoute circuit. 如果想使用不同的方法处理线路,请从以下列表中选择一篇文章进行参阅:If you want to use a different method to work with your circuit, select an article from the following list:

配置先决条件Configuration prerequisites

  • 在开始之前,请安装最新版本的 CLI 命令(2.0 或更高版本)。Before beginning, install the latest version of the CLI commands (2.0 or later). 有关安装 CLI 命令的信息,请参阅安装 Azure CLIFor information about installing the CLI commands, see Install the Azure CLI.
  • 在开始配置前,请务必查看先决条件路由要求工作流页面。Make sure that you have reviewed the prerequisites, routing requirements, and workflow pages before you begin configuration.
  • 必须有一个活动的 ExpressRoute 线路。You must have an active ExpressRoute circuit. 在继续下一步之前,请按说明 创建 ExpressRoute 线路 ,并通过连接提供商启用该线路。Follow the instructions to Create an ExpressRoute circuit and have the circuit enabled by your connectivity provider before you proceed. ExpressRoute 线路必须处于已预配和已启用状态,这样你才能运行本文中的命令。The ExpressRoute circuit must be in a provisioned and enabled state for you to be able to run the commands in this article.

这些说明只适用于由提供第 2 层连接服务的服务提供商创建的线路。These instructions only apply to circuits created with service providers offering Layer 2 connectivity services. 如果服务提供商提供第 3 层托管服务(通常是 IPVPN,如 MPLS),则连接服务提供商会配置和管理路由。If you are using a service provider that offers managed Layer 3 services (typically an IPVPN, like MPLS), your connectivity provider will configure and manage routing for you.

可以为 ExpressRoute 线路配置一到三个对等互连(Azure 专用、Azure 公共和 Microsoft)。You can configure one, two, or all three peerings (Azure private, Azure public, and Microsoft) for an ExpressRoute circuit. 可以按照所选的任意顺序配置对等互连。You can configure peerings in any order you choose. 但是,必须确保一次只完成一个对等互连的配置。However, you must make sure that you complete the configuration of each peering one at a time. 有关路由域和对等互连的详细信息,请参阅 ExpressRoute 路由域For more information about routing domains and peerings, see ExpressRoute routing domains.

Microsoft 对等互连Microsoft peering

本文介绍如何为 ExpressRoute 线路创建、获取、更新和删除 Microsoft 对等互连配置。This section helps you create, get, update, and delete the Microsoft peering configuration for an ExpressRoute circuit.

重要

在 2019 年 10 月 1 日之前配置的 ExpressRoute 线路的 Microsoft 对等互连会通过 Microsoft 对等互连播发所有服务前缀,即使未定义路由筛选器。Microsoft peering of ExpressRoute circuits that were configured prior to October 1, 2019 will have all service prefixes advertised through the Microsoft peering, even if route filters are not defined. 在 2019 年 10 月 1 日或之后配置的 ExpressRoute 线路的 Microsoft 对等互连的任何前缀只有在路由筛选器附加到线路之后才会播发。Microsoft peering of ExpressRoute circuits that are configured on or after October 1, 2019 will not have any prefixes advertised until a route filter is attached to the circuit. 有关详细信息,请参阅配置用于 Microsoft 对等互连的路由筛选器For more information, see Configure a route filter for Microsoft peering.

创建 Microsoft 对等互连To create Microsoft peering

  1. 安装最新版本的 Azure CLI。Install the latest version of Azure CLI. 请使用最新版本的 Azure 命令行接口 (CLI)。* 在开始配置前,请查看先决条件工作流Use the latest version of the Azure Command-line Interface (CLI).* Review the prerequisites and workflows before you begin configuration.

    az login
    

    选择要为其创建 ExpressRoute 线路的订阅。Select the subscription for which you want to create ExpressRoute circuit.

    az account set --subscription "<subscription ID>"
    
  2. 创建 ExpressRoute 线路。Create an ExpressRoute circuit. 请按说明创建 ExpressRoute 线路 ,并由连接服务提供商进行预配。Follow the instructions to create an ExpressRoute circuit and have it provisioned by the connectivity provider. 如果连接服务提供商提供第 3 层托管服务,可以请求连接服务提供商启用 Microsoft 对等互连。If your connectivity provider offers managed Layer 3 services, you can ask your connectivity provider to enable Microsoft peering for you. 在这种情况下,不需要遵循后续部分中所列的说明。In that case, you won't need to follow instructions listed in the next sections. 但是,如果连接服务提供商不为你管理路由,请在创建线路后按照后续步骤继续配置。However, if your connectivity provider does not manage routing for you, after creating your circuit, continue your configuration using the next steps.

  3. 检查 ExpressRoute 线路以确保它已预配并已启用。Check the ExpressRoute circuit to make sure it is provisioned and also enabled. 使用以下示例:Use the following example:

    az network express-route list
    

    其响应类似于如下示例:The response is similar to the following example:

    "allowClassicOperations": false,
    "authorizations": [],
    "circuitProvisioningState": "Enabled",
    "etag": "W/\"1262c492-ffef-4a63-95a8-a6002736b8c4\"",
    "gatewayManagerEtag": null,
    "id": "/subscriptions/81ab786c-56eb-4a4d-bb5f-f60329772466/resourceGroups/ExpressRouteResourceGroup/providers/Microsoft.Network/expressRouteCircuits/MyCircuit",
    "location": "chinaeast",
    "name": "MyCircuit",
    "peerings": [],
    "provisioningState": "Succeeded",
    "resourceGroup": "ExpressRouteResourceGroup",
    "serviceKey": "1d05cf70-1db5-419f-ad86-1ca62c3c125b",
    "serviceProviderNotes": null,
    "serviceProviderProperties": {
     "bandwidthInMbps": 200,
     "peeringLocation": "Shanghai",
     "serviceProviderName": "Shanghai Telecom"
    },
    "serviceProviderProvisioningState": "Provisioned",
    "sku": {
     "family": "UnlimitedData",
     "name": "Standard_MeteredData",
     "tier": "Standard"
    },
    "tags": null,
    "type": "Microsoft.Network/expressRouteCircuits]
    
  4. 配置线路的 Microsoft 对等互连。Configure Microsoft peering for the circuit. 在继续下一步之前,请确保已准备好以下信息。Make sure that you have the following information before you proceed.

    • 主链路的 /30 子网。A /30 subnet for the primary link. 这必须是你拥有且已在 RIR/IRR 中注册的有效公共 IPv4 前缀。This must be a valid public IPv4 prefix owned by you and registered in an RIR / IRR.
    • 辅助链路的 /30 子网。A /30 subnet for the secondary link. 这必须是你拥有且已在 RIR/IRR 中注册的有效公共 IPv4 前缀。This must be a valid public IPv4 prefix owned by you and registered in an RIR / IRR.
    • 用于建立此对等互连的有效 VLAN ID。A valid VLAN ID to establish this peering on. 请确保线路中没有其他对等互连使用同一个 VLAN ID。Ensure that no other peering in the circuit uses the same VLAN ID.
    • 对等互连的 AS 编号。AS number for peering. 可以使用 2 字节和 4 字节 AS 编号。You can use both 2-byte and 4-byte AS numbers.
    • 播发的前缀:必须提供要通过 BGP 会话播发的所有前缀列表。Advertised prefixes: You must provide a list of all prefixes you plan to advertise over the BGP session. 只接受公共 IP 地址前缀。Only public IP address prefixes are accepted. 如果打算发送一组前缀,可以发送逗号分隔列表。If you plan to send a set of prefixes, you can send a comma-separated list. 这些前缀必须已在 RIR/IRR 中注册。These prefixes must be registered to you in an RIR / IRR.
    • “可选”- 客户 ASN :如果要播发的前缀未注册到对等互连 AS 编号,可以指定它们要注册到的 AS 编号。Optional - Customer ASN: If you are advertising prefixes that are not registered to the peering AS number, you can specify the AS number to which they are registered.
    • 路由注册表名称:可以指定 AS 编号和前缀要注册到的 RIR/IRR。Routing Registry Name: You can specify the RIR / IRR against which the AS number and prefixes are registered.
    • 可选 - MD5 哈希(如果选择使用)。Optional - An MD5 hash if you choose to use one.

    运行以下示例为线路配置 Microsoft 对等互连:Run the following example to configure Microsoft peering for your circuit:

    az network express-route peering create --circuit-name MyCircuit --peer-asn 100 --primary-peer-subnet 123.0.0.0/30 -g ExpressRouteResourceGroup --secondary-peer-subnet 123.0.0.4/30 --vlan-id 300 --peering-type MicrosoftPeering --advertised-public-prefixes 123.1.0.0/24
    

查看 Microsoft 对等互连详细信息To view Microsoft peering details

可以使用以下示例来获取配置详细信息:You can get configuration details by using the following example:

az network express-route peering show -g ExpressRouteResourceGroup --circuit-name MyCircuit --name AzureMicrosoftPeering

重要

Microsoft 会验证是否在 Internet 路由注册表中为你分配了指定的“播发公共前缀”和“对等 ASN”(或“客户 ASN”)。Microsoft verifies if the specified 'Advertised public prefixes' and 'Peer ASN' (or 'Customer ASN') are assigned to you in the Internet Routing Registry. 如果要从另一个实体获取公共前缀,并且该分配没有记录在路由注册表中,则自动验证将不会完成,并且将需要手动验证。If you are getting the public prefixes from another entity and if the assignment is not recorded with the routing registry, the automatic validation will not complete and will require manual validation. 如果自动验证失败,你将在上述命令的输出中看到“AdvertisedPublicPrefixesState”为“Validation needed”。If the automatic validation fails, you will see 'AdvertisedPublicPrefixesState' as 'Validation needed' on the output of the above command.

如果看到消息“需要验证”,请收集显示公共前缀将由路由注册表中作为前缀所有者列出的实体分配给你组织的文档,并通过开具支持票证提交这些文档进行手动验证,如下所示。If you see the message 'Validation needed', collect the document(s) that show the public prefixes are assigned to your organization by the entity that is listed as the owner of the prefixes in the routing registry and submit these documents for manual validation by opening a support ticket as shown below.

输出类似于以下示例:The output is similar to the following example:

{
  "azureAsn": 12076,
  "etag": "W/\"2e97be83-a684-4f29-bf3c-96191e270666\"",
  "gatewayManagerEtag": "18",
  "id": "/subscriptions/9a0c2943-e0c2-4608-876c-e0ddffd1211b/resourceGroups/ExpressRouteResourceGroup/providers/Microsoft.Network/expressRouteCircuits/MyCircuit/peerings/AzureMicrosoftPeering",
  "lastModifiedBy": "Customer",
  "microsoftPeeringConfig": {
    "advertisedPublicPrefixes": [
        ""
      ],
     "advertisedPublicPrefixesState": "",
     "customerASN": ,
     "routingRegistryName": ""
  }
  "name": "AzureMicrosoftPeering",
  "peerAsn": ,
  "peeringType": "AzureMicrosoftPeering",
  "primaryAzurePort": "",
  "primaryPeerAddressPrefix": "",
  "provisioningState": "Succeeded",
  "resourceGroup": "ExpressRouteResourceGroup",
  "routeFilter": null,
  "secondaryAzurePort": "",
  "secondaryPeerAddressPrefix": "",
  "sharedKey": null,
  "state": "Enabled",
  "stats": null,
  "vlanId": 100
}

更新 Microsoft 对等互连配置To update Microsoft peering configuration

可以更新配置的任何部分。You can update any part of the configuration. 在以下示例中,线路的播发前缀将从 123.1.0.0/24 更新为124.1.0.0/24:The advertised prefixes of the circuit are being updated from 123.1.0.0/24 to 124.1.0.0/24 in the following example:

az network express-route peering update --circuit-name MyCircuit -g ExpressRouteResourceGroup --peering-type MicrosoftPeering --advertised-public-prefixes 124.1.0.0/24

将 IPv6 Microsoft 对等互连设置添加到现有的 IPv4 配置To add IPv6 Microsoft peering settings to an existing IPv4 configuration

az network express-route peering update -g ExpressRouteResourceGroup --circuit-name MyCircuit --peering-type MicrosoftPeering --ip-version ipv6 --primary-peer-subnet 2002:db00::/126 --secondary-peer-subnet 2003:db00::/126 --advertised-public-prefixes 2002:db00::/126

删除 Microsoft 对等互连To delete Microsoft peering

可以运行以下示例来删除对等互连配置:You can remove your peering configuration by running the following example:

az network express-route peering delete -g ExpressRouteResourceGroup --circuit-name MyCircuit --name MicrosoftPeering

Azure 专用对等互连Azure private peering

本文介绍了如何为 ExpressRoute 线路创建、获取、更新和删除 Azure 专用对等互连配置。This section helps you create, get, update, and delete the Azure private peering configuration for an ExpressRoute circuit.

创建 Azure 专用对等互连To create Azure private peering

  1. 安装最新版本的 Azure CLI。Install the latest version of Azure CLI. 必须使用最新版本的 Azure 命令行接口 (CLI)。* 在开始配置前,请查看先决条件工作流You must use the latest version of the Azure Command-line Interface (CLI).* Review the prerequisites and workflows before you begin configuration.

    az login
    

    选择要创建 ExpressRoute 线路的订阅Select the subscription you want to create ExpressRoute circuit

    az account set --subscription "<subscription ID>"
    
  2. 创建 ExpressRoute 线路。Create an ExpressRoute circuit. 请按说明创建 ExpressRoute 线路 ,并由连接服务提供商进行预配。Follow the instructions to create an ExpressRoute circuit and have it provisioned by the connectivity provider. 如果连接服务提供商提供第 3 层托管服务,可以请求连接服务提供商启用 Azure 专用对等互连。If your connectivity provider offers managed Layer 3 services, you can ask your connectivity provider to enable Azure private peering for you. 在这种情况下,不需要遵循后续部分中所列的说明。In that case, you won't need to follow instructions listed in the next sections. 但是,如果连接服务提供商不为你管理路由,请在创建线路后按照后续步骤继续配置。However, if your connectivity provider does not manage routing for you, after creating your circuit, continue your configuration using the next steps.

  3. 检查 ExpressRoute 线路以确保它已预配并已启用。Check the ExpressRoute circuit to make sure it is provisioned and also enabled. 使用以下示例:Use the following example:

    az network express-route show --resource-group ExpressRouteResourceGroup --name MyCircuit
    

    其响应类似于如下示例:The response is similar to the following example:

    "allowClassicOperations": false,
    "authorizations": [],
    "circuitProvisioningState": "Enabled",
    "etag": "W/\"1262c492-ffef-4a63-95a8-a6002736b8c4\"",
    "gatewayManagerEtag": null,
    "id": "/subscriptions/81ab786c-56eb-4a4d-bb5f-f60329772466/resourceGroups/ExpressRouteResourceGroup/providers/Microsoft.Network/expressRouteCircuits/MyCircuit",
    "location": "chinanorth",
    "name": "MyCircuit",
    "peerings": [],
    "provisioningState": "Succeeded",
    "resourceGroup": "ExpressRouteResourceGroup",
    "serviceKey": "1d05cf70-1db5-419f-ad86-1ca62c3c125b",
    "serviceProviderNotes": null,
    "serviceProviderProperties": {
    "bandwidthInMbps": 200,
    "peeringLocation": "Beijing",
    "serviceProviderName": "Beijing Telecom Ethernet"
    },
    "serviceProviderProvisioningState": "Provisioned",
    "sku": {
     "family": "UnlimitedData",
     "name": "Standard_MeteredData",
     "tier": "Standard"
    },
    "tags": null,
    "type": "Microsoft.Network/expressRouteCircuits]
    
  4. 配置线路的 Azure 专用对等互连。Configure Azure private peering for the circuit. 在继续执行后续步骤之前,请确保已准备好以下各项:Make sure that you have the following items before you proceed with the next steps:

    • 主链路的 /30 子网。A /30 subnet for the primary link. 此子网不能是保留给虚拟网络使用的任何地址空间的一部分。The subnet must not be part of any address space reserved for virtual networks.
    • 辅助链路的 /30 子网。A /30 subnet for the secondary link. 此子网不能是保留给虚拟网络使用的任何地址空间的一部分。The subnet must not be part of any address space reserved for virtual networks.
    • 用于建立此对等互连的有效 VLAN ID。A valid VLAN ID to establish this peering on. 请确保线路中没有其他对等互连使用同一个 VLAN ID。Ensure that no other peering in the circuit uses the same VLAN ID.
    • 对等互连的 AS 编号。AS number for peering. 可以使用 2 字节和 4 字节 AS 编号。You can use both 2-byte and 4-byte AS numbers. 可以将专用 AS 编号用于此对等互连。You can use a private AS number for this peering. 请务必不要使用 65515。Ensure that you are not using 65515.
    • 可选 - MD5 哈希(如果选择使用)。Optional - An MD5 hash if you choose to use one.

    使用以下示例为线路配置 Azure 专用对等互连:Use the following example to configure Azure private peering for your circuit:

    az network express-route peering create --circuit-name MyCircuit --peer-asn 100 --primary-peer-subnet 10.0.0.0/30 -g ExpressRouteResourceGroup --secondary-peer-subnet 10.0.0.4/30 --vlan-id 200 --peering-type AzurePrivatePeering
    

    如果选择使用 MD5 哈希,请使用以下示例:If you choose to use an MD5 hash, use the following example:

    az network express-route peering create --circuit-name MyCircuit --peer-asn 100 --primary-peer-subnet 10.0.0.0/30 -g ExpressRouteResourceGroup --secondary-peer-subnet 10.0.0.4/30 --vlan-id 200 --peering-type AzurePrivatePeering --SharedKey "A1B2C3D4"
    

    重要

    请确保将 AS 编号指定为对等互连 ASN,而不是客户 ASN。Ensure that you specify your AS number as peering ASN, not customer ASN.

查看 Azure 专用对等互连详细信息To view Azure private peering details

可以使用以下示例来获取配置详细信息:You can get configuration details by using the following example:

az network express-route peering show -g ExpressRouteResourceGroup --circuit-name MyCircuit --name AzurePrivatePeering

输出类似于以下示例:The output is similar to the following example:

{
  "azureAsn": 12076,
  "etag": "W/\"2e97be83-a684-4f29-bf3c-96191e270666\"",
  "gatewayManagerEtag": "18",
  "id": "/subscriptions/9a0c2943-e0c2-4608-876c-e0ddffd1211b/resourceGroups/ExpressRouteResourceGroup/providers/Microsoft.Network/expressRouteCircuits/MyCircuit/peerings/AzurePrivatePeering",
  "ipv6PeeringConfig": null,
  "lastModifiedBy": "Customer",
  "microsoftPeeringConfig": null,
  "name": "AzurePrivatePeering",
  "peerAsn": 7671,
  "peeringType": "AzurePrivatePeering",
  "primaryAzurePort": "",
  "primaryPeerAddressPrefix": "",
  "provisioningState": "Succeeded",
  "resourceGroup": "ExpressRouteResourceGroup",
  "routeFilter": null,
  "secondaryAzurePort": "",
  "secondaryPeerAddressPrefix": "",
  "sharedKey": null,
  "state": "Enabled",
  "stats": null,
  "vlanId": 100
}

更新 Azure 专用对等互连配置To update Azure private peering configuration

可以使用以下示例来更新配置的任何部分。You can update any part of the configuration using the following example. 在此示例中,线路的 VLAN ID 将从 100 更新为 500。In this example, the VLAN ID of the circuit is being updated from 100 to 500.

az network express-route peering update --vlan-id 500 -g ExpressRouteResourceGroup --circuit-name MyCircuit --name AzurePrivatePeering

删除 Azure 专用对等互连To delete Azure private peering

可以运行以下示例来删除对等互连配置:You can remove your peering configuration by running the following example:

az network express-route peering delete -g ExpressRouteResourceGroup --circuit-name MyCircuit --name AzurePrivatePeering

Azure 公共对等互连Azure public peering

本文介绍了如何为 ExpressRoute 线路创建、获取、更新和删除 Azure 公共对等互连配置。This section helps you create, get, update, and delete the Azure public peering configuration for an ExpressRoute circuit.

创建 Azure 公共对等互连To create Azure public peering

  1. 安装最新版本的 Azure CLI。Install the latest version of Azure CLI. 必须使用最新版本的 Azure 命令行接口 (CLI)。* 在开始配置前,请查看先决条件工作流You must use the latest version of the Azure Command-line Interface (CLI).* Review the prerequisites and workflows before you begin configuration.

    az login
    

    选择要为其创建 ExpressRoute 线路的订阅。Select the subscription for which you want to create ExpressRoute circuit.

    az account set --subscription "<subscription ID>"
    
  2. 创建 ExpressRoute 线路。Create an ExpressRoute circuit. 请按说明创建 ExpressRoute 线路 ,并由连接服务提供商进行预配。Follow the instructions to create an ExpressRoute circuit and have it provisioned by the connectivity provider. 如果连接服务提供商提供第 3 层托管服务,可以请求连接服务提供商启用 Azure 公共对等互连。If your connectivity provider offers managed Layer 3 services, you can ask your connectivity provider to enable Azure public peering for you. 在这种情况下,不需要遵循后续部分中所列的说明。In that case, you won't need to follow instructions listed in the next sections. 但是,如果连接服务提供商不为你管理路由,请在创建线路后按照后续步骤继续配置。However, if your connectivity provider does not manage routing for you, after creating your circuit, continue your configuration using the next steps.

  3. 检查 ExpressRoute 线路以确保它已预配并已启用。Check the ExpressRoute circuit to ensure it is provisioned and also enabled. 使用以下示例:Use the following example:

    az network express-route list
    

    其响应类似于如下示例:The response is similar to the following example:

    "allowClassicOperations": false,
    "authorizations": [],
    "circuitProvisioningState": "Enabled",
    "etag": "W/\"1262c492-ffef-4a63-95a8-a6002736b8c4\"",
    "gatewayManagerEtag": null,
    "id": "/subscriptions/81ab786c-56eb-4a4d-bb5f-f60329772466/resourceGroups/ExpressRouteResourceGroup/providers/Microsoft.Network/expressRouteCircuits/MyCircuit",
    "location": "chinanorth",
    "name": "MyCircuit",
    "peerings": [],
    "provisioningState": "Succeeded",
    "resourceGroup": "ExpressRouteResourceGroup",
    "serviceKey": "1d05cf70-1db5-419f-ad86-1ca62c3c125b",
    "serviceProviderNotes": null,
    "serviceProviderProperties": {
     "bandwidthInMbps": 200,
     "peeringLocation": "Beijing",
     "serviceProviderName": "Beijing Telecom Ethernet"
    },
    "serviceProviderProvisioningState": "Provisioned",
    "sku": {
     "family": "UnlimitedData",
     "name": "Standard_MeteredData",
     "tier": "Standard"
    },
    "tags": null,
    "type": "Microsoft.Network/expressRouteCircuits]
    
  4. 配置线路的 Azure 公共对等互连。Configure Azure public peering for the circuit. 在继续下一步之前,请确保已准备以下信息。Make sure that you have the following information before you proceed further.

    • 主链路的 /30 子网。A /30 subnet for the primary link. 这必须是有效的公共 IPv4 前缀。This must be a valid public IPv4 prefix.
    • 辅助链路的 /30 子网。A /30 subnet for the secondary link. 这必须是有效的公共 IPv4 前缀。This must be a valid public IPv4 prefix.
    • 用于建立此对等互连的有效 VLAN ID。A valid VLAN ID to establish this peering on. 请确保线路中没有其他对等互连使用同一个 VLAN ID。Ensure that no other peering in the circuit uses the same VLAN ID.
    • 对等互连的 AS 编号。AS number for peering. 可以使用 2 字节和 4 字节 AS 编号。You can use both 2-byte and 4-byte AS numbers.
    • 可选 - MD5 哈希(如果选择使用)。Optional - An MD5 hash if you choose to use one.

    运行以下示例为线路配置 Azure 公共对等互连:Run the following example to configure Azure public peering for your circuit:

    az network express-route peering create --circuit-name MyCircuit --peer-asn 100 --primary-peer-subnet 12.0.0.0/30 -g ExpressRouteResourceGroup --secondary-peer-subnet 12.0.0.4/30 --vlan-id 200 --peering-type AzurePublicPeering
    

    如果选择使用 MD5 哈希,请使用以下示例:If you choose to use an MD5 hash, use the following example:

    az network express-route peering create --circuit-name MyCircuit --peer-asn 100 --primary-peer-subnet 12.0.0.0/30 -g ExpressRouteResourceGroup --secondary-peer-subnet 12.0.0.4/30 --vlan-id 200 --peering-type AzurePublicPeering --SharedKey "A1B2C3D4"
    

    重要

    请确保将 AS 编号指定为对等互连 ASN,而不是客户 ASN。Ensure that you specify your AS number as peering ASN, not customer ASN.

查看 Azure 公共对等互连详细信息To view Azure public peering details

可以使用以下示例来获取配置详细信息:You can get configuration details using the following example:

az network express-route peering show -g ExpressRouteResourceGroup --circuit-name MyCircuit --name AzurePublicPeering

输出类似于以下示例:The output is similar to the following example:

{
  "azureAsn": 12076,
  "etag": "W/\"2e97be83-a684-4f29-bf3c-96191e270666\"",
  "gatewayManagerEtag": "18",
  "id": "/subscriptions/9a0c2943-e0c2-4608-876c-e0ddffd1211b/resourceGroups/ExpressRouteResourceGroup/providers/Microsoft.Network/expressRouteCircuits/MyCircuit/peerings/AzurePublicPeering",
  "lastModifiedBy": "Customer",
  "microsoftPeeringConfig": null,
  "name": "AzurePublicPeering",
  "peerAsn": 7671,
  "peeringType": "AzurePublicPeering",
  "primaryAzurePort": "",
  "primaryPeerAddressPrefix": "",
  "provisioningState": "Succeeded",
  "resourceGroup": "ExpressRouteResourceGroup",
  "routeFilter": null,
  "secondaryAzurePort": "",
  "secondaryPeerAddressPrefix": "",
  "sharedKey": null,
  "state": "Enabled",
  "stats": null,
  "vlanId": 100
}

更新 Azure 公共对等互连配置To update Azure public peering configuration

可以使用以下示例来更新配置的任何部分。You can update any part of the configuration using the following example. 在此示例中,线路的 VLAN ID 将从 200 更新为 600。In this example, the VLAN ID of the circuit is being updated from 200 to 600.

az network express-route peering update --vlan-id 600 -g ExpressRouteResourceGroup --circuit-name MyCircuit --name AzurePublicPeering

删除 Azure 公共对等互连To delete Azure public peering

可以运行以下示例来删除对等互连配置:You can remove your peering configuration by running the following example:

az network express-route peering delete -g ExpressRouteResourceGroup --circuit-name MyCircuit --name AzurePublicPeering

后续步骤Next steps

下一步,将 VNet 链接到 ExpressRoute 线路Next step, Link a VNet to an ExpressRoute circuit.