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

本文帮助你使用 PowerShell 在资源管理器部署模型中创建和管理 ExpressRoute 线路的路由配置。This article helps you create and manage routing configuration for an ExpressRoute circuit in the Resource Manager deployment model using PowerShell. 还可以检查 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:

这些说明只适用于由提供第 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.

Important

我们目前无法通过服务管理门户播发服务提供商配置的对等互连。We currently do not advertise peerings configured by service providers through the service management portal. 我们正在努力不久就实现这一功能。We are working on enabling this capability soon. 请在配置 BGP 对等互连之前与服务提供商核对。Check with your service provider before configuring BGP peerings.

可以为 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.

配置先决条件Configuration prerequisites

  • 在开始配置之前,请务必查看先决条件页、路由要求页和工作流页。Make sure that you have reviewed the prerequisites page, the routing requirements page, and the workflows page 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 线路必须处于已预配和已启用状态,才能运行本文中的 cmdlet。The ExpressRoute circuit must be in a provisioned and enabled state for you to be able to run the cmdlets in this article.

使用 Azure PowerShellWorking with Azure PowerShell

本文中的步骤和示例使用 Azure PowerShell Az 模块。The steps and examples in this article use Azure PowerShell Az modules. 若要在计算机上本地安装 Az 模块,请参阅安装 Azure PowerShellTo install the Az modules locally on your computer, see Install Azure PowerShell. 若要详细了解新 Az 模块,请参阅新 Azure Powershell Az 模块简介To learn more about the new Az module, see Introducing the new Azure PowerShell Az module. PowerShell cmdlet 经常更新。PowerShell cmdlets are updated frequently. 如果未运行最新版本,在说明中指定的值可能无法使用。If you are not running the latest version, the values specified in the instructions may fail. 若要在系统上查找已安装的 PowerShell 版本,请使用 Get-Module -ListAvailable Az cmdlet。To find the installed versions of PowerShell on your system, use the Get-Module -ListAvailable Az cmdlet.

Microsoft 对等互连Microsoft peering

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

Important

在 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. 登录并选择订阅。Sign in and select your subscription.

    如果在本地安装了 PowerShell,请登录。If you installed PowerShell locally, sign in.

    Connect-AzAccount
    

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

    Select-AzSubscription -SubscriptionId "<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 对等互连。f 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:

    Get-AzExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"
    

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

    Name                             : ExpressRouteARMCircuit
    ResourceGroupName                : ExpressRouteResourceGroup
    Location                         : chinaeast
    Id                               : /subscriptions/***************************/resourceGroups/ExpressRouteResourceGroup/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuit
    Etag                             : W/"################################"
    ProvisioningState                : Succeeded
    Sku                              : {
                                        "Name": "Standard_MeteredData",
                                        "Tier": "Standard",
                                        "Family": "MeteredData"
                                      }
    CircuitProvisioningState         : Enabled
    ServiceProviderProvisioningState : Provisioned
    ServiceProviderNotes             : 
    ServiceProviderProperties        : {
                                        "ServiceProviderName": "Shanghai Telecom",
                                        "PeeringLocation": "China East",
                                        "BandwidthInMbps": 200
                                      }
    ServiceKey                       : **************************************
    Peerings                         : []
    
  4. 配置线路的 Microsoft 对等互连。Configure Microsoft peering for the circuit. 在继续下一步之前,请确保已准备好以下信息。Make sure that you have the following information before you proceed.

    • 主链路的 /30 或 /126 子网。A /30 or /126 subnet for the primary link. 这必须是你拥有的且已在 RIR/IRR 中注册的有效公共 IPv4 或 IPv6 前缀。This must be a valid public IPv4 or IPv6 prefix owned by you and registered in an RIR / IRR.
    • 辅助链路的 /30 或 /126 子网。A /30 or /126 subnet for the secondary link. 这必须是你拥有的且已在 RIR/IRR 中注册的有效公共 IPv4 或 IPv6 前缀。This must be a valid public IPv4 or IPv6 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. IPv4 BGP 会话需要 IPv4 播发前缀,而 IPv6 BGP 会话需要 IPv6 播发前缀。IPv4 BGP sessions require IPv4 advertised prefixes and IPv6 BGP sessions require IPv6 advertised prefixes.
    • 路由注册表名称:可以指定 AS 编号和前缀要注册到的 RIR/IRR。Routing Registry Name: You can specify the RIR / IRR against which the AS number and prefixes are registered.
    • 可选:Optional:
      • 客户 ASN:如果要播发的前缀未注册到对等互连 AS 编号,可以指定它们要注册到的 AS 编号。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.
      • MD5 哈希(如果选择使用)。An MD5 hash if you choose to use one.

Important

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. 如果自动验证失败,则会在“Get-AzExpressRouteCircuitPeeringConfig”(请参阅下面的“获取 Microsoft 对等互连详细信息”)命令的输出中看到作为”需要验证”的“AdvertisedPublicPrefixesState”。If the automatic validation fails, you will see 'AdvertisedPublicPrefixesState' as 'Validation needed' on the output of "Get-AzExpressRouteCircuitPeeringConfig" (see "To get Microsoft peering details" below) 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.

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

Add-AzExpressRouteCircuitPeeringConfig -Name "MicrosoftPeering" -ExpressRouteCircuit $ckt -PeeringType MicrosoftPeering -PeerASN 100 -PeerAddressType IPv4 -PrimaryPeerAddressPrefix "123.0.0.0/30" -SecondaryPeerAddressPrefix "123.0.0.4/30" -VlanId 300 -MicrosoftConfigAdvertisedPublicPrefixes "123.1.0.0/24" -MicrosoftConfigCustomerAsn 23 -MicrosoftConfigRoutingRegistryName "ARIN"

Add-AzExpressRouteCircuitPeeringConfig -Name "MicrosoftPeering" -ExpressRouteCircuit $ckt -PeeringType MicrosoftPeering -PeerASN 100 -PeerAddressType IPv6 -PrimaryPeerAddressPrefix "3FFE:FFFF:0:CD30::/126" -SecondaryPeerAddressPrefix "3FFE:FFFF:0:CD30::4/126" -VlanId 300 -MicrosoftConfigAdvertisedPublicPrefixes "3FFE:FFFF:0:CD31::/120" -MicrosoftConfigCustomerAsn 23 -MicrosoftConfigRoutingRegistryName "ARIN"

Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt

获取 Microsoft 对等互连详细信息To get Microsoft peering details

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

$ckt = Get-AzExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"

Get-AzExpressRouteCircuitPeeringConfig -Name "MicrosoftPeering" -ExpressRouteCircuit $ckt

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

可以使用以下示例来更新配置的任何部分:You can update any part of the configuration using the following example:

Set-AzExpressRouteCircuitPeeringConfig  -Name "MicrosoftPeering" -ExpressRouteCircuit $ckt -PeeringType MicrosoftPeering -PeerASN 100 -PeerAddressType IPv4 -PrimaryPeerAddressPrefix "123.0.0.0/30" -SecondaryPeerAddressPrefix "123.0.0.4/30" -VlanId 300 -MicrosoftConfigAdvertisedPublicPrefixes "124.1.0.0/24" -MicrosoftConfigCustomerAsn 23 -MicrosoftConfigRoutingRegistryName "ARIN"

Set-AzExpressRouteCircuitPeeringConfig  -Name "MicrosoftPeering" -ExpressRouteCircuit $ckt -PeeringType MicrosoftPeering -PeerASN 100 -PeerAddressType IPv6 -PrimaryPeerAddressPrefix "3FFE:FFFF:0:CD30::/126" -SecondaryPeerAddressPrefix "3FFE:FFFF:0:CD30::4/126" -VlanId 300 -MicrosoftConfigAdvertisedPublicPrefixes "3FFE:FFFF:0:CD31::/120" -MicrosoftConfigCustomerAsn 23 -MicrosoftConfigRoutingRegistryName "ARIN"

Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt

删除 Microsoft 对等互连To delete Microsoft peering

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

Remove-AzExpressRouteCircuitPeeringConfig -Name "MicrosoftPeering" -ExpressRouteCircuit $ckt

Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt

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. 为 ExpressRoute 导入 PowerShell 模块。Import the PowerShell module for ExpressRoute.

    必须从 PowerShell 库安装最新的 PowerShell 安装程序,并将 Azure Resource Manager 模块导入 PowerShell 会话,以便开始使用 ExpressRoute cmdlet。You must install the latest PowerShell installer from PowerShell Gallery and import the Azure Resource Manager modules into the PowerShell session in order to start using the ExpressRoute cmdlets. 需要以管理员身份运行 PowerShell。You will need to run PowerShell as an Administrator.

    Install-Module Az
    

    导入已知语义版本范围内的所有 Az.* 模块。Import all of the Az.* modules within the known semantic version range.

    Import-Module Az
    

    也可以只导入已知语义版本范围内的 select 模块。You can also just import a select module within the known semantic version range.

    Import-Module Az.Network 
    

    登录到帐户。Sign in to your account.

    Connect-AzAccount -EnvironmentName AzureChinaCloud
    

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

    Select-AzSubscription -SubscriptionId "<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:

    Get-AzExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"
    

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

    Name                             : ExpressRouteARMCircuit
    ResourceGroupName                : ExpressRouteResourceGroup
    Location                         : chinanorth
    Id                               : /subscriptions/***************************/resourceGroups/ExpressRouteResourceGroup/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuit
    Etag                             : W/"################################"
    ProvisioningState                : Succeeded
    Sku                              : {
                                        "Name": "Standard_MeteredData",
                                        "Tier": "Standard",
                                        "Family": "MeteredData"
                                      }
    CircuitProvisioningState         : Enabled
    ServiceProviderProvisioningState : Provisioned
    ServiceProviderNotes             : 
    ServiceProviderProperties        : {
                                        "ServiceProviderName": "Beijing Telecom Ethernet",
                                        "PeeringLocation": "Beijing",
                                        "BandwidthInMbps": 200
                                      }
    ServiceKey                       : **************************************
    Peerings                         : []
    
  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.
    • 可选:Optional:
      • MD5 哈希(如果选择使用)。An MD5 hash if you choose to use one.

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

    Add-AzExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt -PeeringType AzurePrivatePeering -PeerASN 100 -PrimaryPeerAddressPrefix "10.0.0.0/30" -SecondaryPeerAddressPrefix "10.0.0.4/30" -VlanId 200
    
    Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt
    

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

    Add-AzExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt -PeeringType AzurePrivatePeering -PeerASN 100 -PrimaryPeerAddressPrefix "10.0.0.0/30" -SecondaryPeerAddressPrefix "10.0.0.4/30" -VlanId 200  -SharedKey "A1B2C3D4"
    

    Important

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

获取 Azure 专用对等互连详细信息To get Azure private peering details

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

$ckt = Get-AzExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"

Get-AzExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt

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

Set-AzExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt -PeeringType AzurePrivatePeering -PeerASN 100 -PrimaryPeerAddressPrefix "10.0.0.0/30" -SecondaryPeerAddressPrefix "10.0.0.4/30" -VlanId 200

Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt

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

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

Warning

运行此示例前,必须确保已删除所有虚拟网络。You must ensure that all virtual networks are removed before running this example.

Remove-AzExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt

Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt

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. 为 ExpressRoute 导入 PowerShell 模块。Import the PowerShell module for ExpressRoute.

    必须从 PowerShell 库安装最新的 PowerShell 安装程序,并将 Azure Resource Manager 模块导入 PowerShell 会话,以便开始使用 ExpressRoute cmdlet。You must install the latest PowerShell installer from PowerShell Gallery and import the Azure Resource Manager modules into the PowerShell session in order to start using the ExpressRoute cmdlets. 需要以管理员身份运行 PowerShell。You will need to run PowerShell as an Administrator.

    Install-Module Az
    

    导入已知语义版本范围内的所有 Az.* 模块。Import all of the Az.* modules within the known semantic version range.

    Import-Module Az
    

    也可以只导入已知语义版本范围内的 select 模块。You can also just import a select module within the known semantic version range.

    Import-Module Az.Network
    

    登录到帐户。Sign in to your account.

    Connect-AzAccount
    

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

    Select-AzSubscription -SubscriptionId "<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:

    Get-AzExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"
    

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

    Name                             : ExpressRouteARMCircuit
    ResourceGroupName                : ExpressRouteResourceGroup
    Location                         : chinanorth
    Id                               : /subscriptions/***************************/resourceGroups/ExpressRouteResourceGroup/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuit
    Etag                             : W/"################################"
    ProvisioningState                : Succeeded
    Sku                              : {
                                         "Name": "Standard_MeteredData",
                                         "Tier": "Standard",
                                         "Family": "MeteredData"
                                       }
    CircuitProvisioningState         : Enabled
    ServiceProviderProvisioningState : Provisioned
    ServiceProviderNotes             : 
    ServiceProviderProperties        : {
                                         "ServiceProviderName": "Beijing Telecom Ethernet",
                                         "PeeringLocation": "Beijing",
                                         "BandwidthInMbps": 200
                                       }
    ServiceKey                       : **************************************
    Peerings                         : []   
    
  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.
    • 可选:Optional:
      • MD5 哈希(如果选择使用)。An MD5 hash if you choose to use one.

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

    Add-AzExpressRouteCircuitPeeringConfig -Name "AzurePublicPeering" -ExpressRouteCircuit $ckt -PeeringType AzurePublicPeering -PeerASN 100 -PrimaryPeerAddressPrefix "12.0.0.0/30" -SecondaryPeerAddressPrefix "12.0.0.4/30" -VlanId 100
    
    Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt
    

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

    Add-AzExpressRouteCircuitPeeringConfig -Name "AzurePublicPeering" -ExpressRouteCircuit $ckt -PeeringType AzurePublicPeering -PeerASN 100 -PrimaryPeerAddressPrefix "12.0.0.0/30" -SecondaryPeerAddressPrefix "12.0.0.4/30" -VlanId 100  -SharedKey "A1B2C3D4"
    
    Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt
    

    Important

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

获取 Azure 公共对等互连详细信息To get Azure public peering details

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

  $ckt = Get-AzExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"

  Get-AzExpressRouteCircuitPeeringConfig -Name "AzurePublicPeering" -Circuit $ckt

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

Set-AzExpressRouteCircuitPeeringConfig  -Name "AzurePublicPeering" -ExpressRouteCircuit $ckt -PeeringType AzurePublicPeering -PeerASN 100 -PrimaryPeerAddressPrefix "123.0.0.0/30" -SecondaryPeerAddressPrefix "123.0.0.4/30" -VlanId 600

Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt

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

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

Remove-AzExpressRouteCircuitPeeringConfig -Name "AzurePublicPeering" -ExpressRouteCircuit $ckt
Set-AzExpressRouteCircuit -ExpressRouteCircuit $ckt

后续步骤Next steps

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