创建和修改 ExpressRoute 线路的对等互连(经典)Create and modify peering for an ExpressRoute circuit (classic)

本文指导执行相关步骤,以便使用 PowerShell 和经典部署模型创建和管理 ExpressRoute 线路的对等互连/路由配置。This article walks you through the steps to create and manage peering/routing configuration for an ExpressRoute circuit using PowerShell and the classic deployment model. 下面的步骤还会说明如何查看状态,以及如何更新、删除和取消预配 ExpressRoute 线路的对等互连。The steps below will also show you how to check the status, update, or delete and deprovision peerings for an ExpressRoute circuit. 可以为 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.

这些说明仅适用于由提供第 2 层连接服务的服务提供商创建的线路。These instructions only apply to circuits created with service providers that offer 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

从 2017 年 3 月 1 日开始,将无法在经典部署模型中创建新的 ExpressRoute 线路。As of March 1, 2017, you can't create new ExpressRoute circuits in the classic deployment model.

  • 可以将现有的 ExpressRoute 线路从经典部署模型移到 Resource Manager 部署模型,不会遇到连接中断问题。You can move an existing ExpressRoute circuit from the classic deployment model to the Resource Manager deployment model without experiencing any connectivity down time. 有关详细信息,请参阅移动现有线路For more information, see Move an existing circuit.
  • allowClassicOperations 设置为 TRUE 即可在经典部署模型中连接到虚拟网络。You can connect to virtual networks in the classic deployment model by setting allowClassicOperations to TRUE.

请使用以下链接在 Resource Manager 部署模型中创建和管理 ExpressRoute 线路:Use the following links to create and manage ExpressRoute circuits in the Resource Manager deployment model:

关于 Azure 部署模型About Azure deployment models

Azure 当前使用两种部署模型:Resource Manager 部署模型和经典部署模型。Azure currently works with two deployment models: Resource Manager and classic. 这两个模型相互不完全兼容。The two models are not completely compatible with each other. 在开始之前,需要知道所要使用的模型。Before you begin, you need to know which model that you want to work in. 有关部署模型的信息,请参阅了解部署模型For information about the deployment models, see Understanding deployment models. 如果不熟悉 Azure,建议使用 Resource Manager 部署模型。If you are new to Azure, we recommend that you use the Resource Manager deployment model.

配置先决条件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 described below.

下载最新的 PowerShell cmdletDownload the latest PowerShell cmdlets

安装最新版本的 Azure 服务管理 (SM) PowerShell 模块和 ExpressRoute 模块。Install the latest versions of the Azure Service Management (SM) PowerShell modules and the ExpressRoute module.

  1. 按照安装服务管理模块一文中的说明安装 Azure 服务管理模块。Use the instructions in the Installing the Service Management module article to install the Azure Service Management Module. 如果已安装 Az 或 RM 模块,请确保使用“-AllowClobber”。If you have the Az or RM module already installed, be sure to use '-AllowClobber'.

  2. 导入已安装的模块。Import the installed modules. 使用以下示例时,请调整路径以反映已安装的 PowerShell 模块的位置和版本。When using the following example, adjust the path to reflect the location and version of your installed PowerShell modules.

    Import-Module 'C:\Program Files\WindowsPowerShell\Modules\Azure\5.3.0\Azure.psd1'
    Import-Module 'C:\Program Files\WindowsPowerShell\Modules\Azure\5.3.0\ExpressRoute\ExpressRoute.psd1'
    
  3. 若要登录到 Azure 帐户,请使用提升的权限打开 PowerShell 控制台,并连接到帐户。To sign in to your Azure account, open your PowerShell console with elevated rights and connect to your account. 使用以下示例帮助你通过服务管理模块进行连接:Use the following example to help you connect using the Service Management module:

    Add-AzureAccount
    

Azure 专用对等互连Azure private peering

本部分说明如何为 ExpressRoute 线路创建、获取、更新和删除 Azure 专用对等互连配置。This section provides instructions on how to create, get, update, and delete the Azure private peering configuration for an ExpressRoute circuit.

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

  1. 创建 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 request 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, follow the instructions below.

  2. 检查 ExpressRoute 线路以确保它已预配。Check the ExpressRoute circuit to make sure it is provisioned.

    检查 ExpressRoute 线路是否已预配并已启用。Check to see if the ExpressRoute circuit is Provisioned and also Enabled.

    Get-AzureDedicatedCircuit -ServiceKey "*********************************"
    

    返回:Return:

    Bandwidth                        : 200
    CircuitName                      : MyTestCircuit
    Location                         : Beijing
    ServiceKey                       : *********************************
    ServiceProviderName              : Beijing Telecom Ethernet
    ServiceProviderProvisioningState : Provisioned
    Sku                              : Standard
    Status                           : Enabled
    

    确保线路显示为已预配并已启用。Make sure that the circuit shows as Provisioned and Enabled. 否则,请咨询连接服务提供商,使线路处于所需状态。If it isn't, work with your connectivity provider to get your circuit to the required state and status.

    ServiceProviderProvisioningState : Provisioned
    Status                           : Enabled
    
  3. 配置线路的 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. 它不能是保留给虚拟网络使用的任何地址空间的一部分。This must not be part of any address space reserved for virtual networks.
    • 辅助链路的 /30 子网。A /30 subnet for the secondary link. 它不能是保留给虚拟网络使用的任何地址空间的一部分。This 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。Verify 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。Verify that you are not using 65515.
    • MD5 哈希(如果选择使用)。An MD5 hash if you choose to use one. 可选 。Optional.

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

    New-AzureBGPPeering -AccessType Private -ServiceKey "*********************************" -PrimaryPeerSubnet "10.0.0.0/30" -SecondaryPeerSubnet "10.0.0.4/30" -PeerAsn 1234 -VlanId 100
    

    若要使用 MD5 哈希,请使用以下示例为线路配置 Azure 专用对等互连:If you want to use an MD5 hash, use the following example to configure private peering for your circuit:

    New-AzureBGPPeering -AccessType Private -ServiceKey "*********************************" -PrimaryPeerSubnet "10.0.0.0/30" -SecondaryPeerSubnet "10.0.0.4/30" -PeerAsn 1234 -VlanId 100 -SharedKey "A1B2C3D4"
    

    Important

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

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

可使用以下 cmdlet 来查看配置详细信息:You can view configuration details using the following cmdlet:

Get-AzureBGPPeering -AccessType Private -ServiceKey "*********************************"

返回:Return:

AdvertisedPublicPrefixes       : 
AdvertisedPublicPrefixesState  : Configured
AzureAsn                       : 12076
CustomerAutonomousSystemNumber : 
PeerAsn                        : 1234
PrimaryAzurePort               : 
PrimaryPeerSubnet              : 10.0.0.0/30
RoutingRegistryName            : 
SecondaryAzurePort             : 
SecondaryPeerSubnet            : 10.0.0.4/30
State                          : Enabled
VlanId                         : 100

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

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

Set-AzureBGPPeering -AccessType Private -ServiceKey "*********************************" -PrimaryPeerSubnet "10.0.0.0/30" -SecondaryPeerSubnet "10.0.0.4/30" -PeerAsn 1234 -VlanId 500 -SharedKey "A1B2C3D4"

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

可以运行以下 cmdlet 删除对等互连配置。You can remove your peering configuration by running the following cmdlet. 运行此 cmdlet 之前,必须确保已从 ExpressRoute 线路取消链接所有虚拟网络。You must make sure that all virtual networks are unlinked from the ExpressRoute circuit before running this cmdlet.

Remove-AzureBGPPeering -AccessType Private -ServiceKey "*********************************"

Azure 公共对等互连Azure public peering

本部分说明如何为 ExpressRoute 线路创建、获取、更新和删除 Azure 公共对等互连配置。This section provides instructions on how to create, get, update, and delete the Azure public peering configuration for an ExpressRoute circuit.

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

  1. 创建 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 request 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, follow the instructions below.

  2. 检查 ExpressRoute 线路以确认它已预配Check ExpressRoute circuit to verify that it is provisioned

    首先,必须检查 ExpressRoute 线路是否已预配且已启用。You must first check to see if the ExpressRoute circuit is Provisioned and also Enabled.

    Get-AzureDedicatedCircuit -ServiceKey "*********************************"
    

    返回:Return:

    Bandwidth                        : 200
    CircuitName                      : MyTestCircuit
    Location                         : Beijing
    ServiceKey                       : *********************************
    ServiceProviderName              : Beijing Telecom Ethernet
    ServiceProviderProvisioningState : Provisioned
    Sku                              : Standard
    Status                           : Enabled
    

    确认线路显示为已预配并已启用。Verify that the circuit shows as Provisioned and Enabled. 否则,请咨询连接服务提供商,使线路处于所需状态。If it isn't, work with your connectivity provider to get your circuit to the required state and status.

    ServiceProviderProvisioningState : Provisioned
    Status                           : Enabled
    
  3. 配置线路的 Azure 公共对等互连Configure Azure public peering for the circuit

    在继续下一步之前,请确保已准备好以下信息:Make sure that you have the following information before you proceed:

    • 主链路的 /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。Verify 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 哈希(如果选择使用)。An MD5 hash if you choose to use one. 可选 。Optional.

    Important

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

    可使用以下示例为线路配置 Azure 公共对等互连:You can use the following example to configure Azure public peering for your circuit:

    New-AzureBGPPeering -AccessType Public -ServiceKey "*********************************" -PrimaryPeerSubnet "131.107.0.0/30" -SecondaryPeerSubnet "131.107.0.4/30" -PeerAsn 1234 -VlanId 200
    

    若要使用 MD5 哈希,请使用以下示例配置线路:If you want to use an MD5 hash, use the following example to configure your circuit:

    New-AzureBGPPeering -AccessType Public -ServiceKey "*********************************" -PrimaryPeerSubnet "131.107.0.0/30" -SecondaryPeerSubnet "131.107.0.4/30" -PeerAsn 1234 -VlanId 200 -SharedKey "A1B2C3D4"
    

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

若要查看配置详细信息,请使用以下 cmdlet:To view configuration details, use the following cmdlet:

Get-AzureBGPPeering -AccessType Public -ServiceKey "*********************************"

返回:Return:

AdvertisedPublicPrefixes       : 
AdvertisedPublicPrefixesState  : Configured
AzureAsn                       : 12076
CustomerAutonomousSystemNumber : 
PeerAsn                        : 1234
PrimaryAzurePort               : 
PrimaryPeerSubnet              : 131.107.0.0/30
RoutingRegistryName            : 
SecondaryAzurePort             : 
SecondaryPeerSubnet            : 131.107.0.4/30
State                          : Enabled
VlanId                         : 200

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

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

Set-AzureBGPPeering -AccessType Public -ServiceKey "*********************************" -PrimaryPeerSubnet "131.107.0.0/30" -SecondaryPeerSubnet "131.107.0.4/30" -PeerAsn 1234 -VlanId 600 -SharedKey "A1B2C3D4"

确认线路显示为已预配并已启用。Verify that the circuit shows as Provisioned and Enabled.

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

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

Remove-AzureBGPPeering -AccessType Public -ServiceKey "*********************************"

Microsoft 对等互连Microsoft peering

本部分说明如何为 ExpressRoute 线路创建、获取、更新和删除 Microsoft 对等互连配置。This section provides instructions on how to create, get, update, and delete the Microsoft peering configuration for an ExpressRoute circuit.

创建 Microsoft 对等互连To create Microsoft peering

  1. 创建 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 request 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, follow the instructions below.

  2. 检查 ExpressRoute 线路以确认它已预配Check ExpressRoute circuit to verify that it is provisioned

    确认线路显示为已预配并已启用。Verify that the circuit shows as Provisioned and Enabled.

    Get-AzureDedicatedCircuit -ServiceKey "*********************************"
    

    返回:Return:

    Bandwidth                        : 200
    CircuitName                      : MyTestCircuit
    Location                         : Beijing
    ServiceKey                       : *********************************
    ServiceProviderName              : Beijing Telecom Ethernet
    ServiceProviderProvisioningState : Provisioned
    Sku                              : Standard
    Status                           : Enabled
    

    确认线路显示为已预配并已启用。Verify that the circuit shows as Provisioned and Enabled. 否则,请咨询连接服务提供商,使线路处于所需状态。If it isn't, work with your connectivity provider to get your circuit to the required state and status.

    ServiceProviderProvisioningState : Provisioned
    Status                           : Enabled
    
  3. 配置线路的 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。Verify 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. 如果打算发送一组前缀,可以发送逗号分隔列表。You can send a comma-separated list if you plan to send a set of prefixes. 这些前缀必须已在 RIR/IRR 中注册。These prefixes must be registered to you in an RIR / IRR.
    • 客户 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. 可选 。Optional.
    • 路由注册表名称:可以指定 AS 编号和前缀要注册到的 RIR/IRR。Routing Registry Name: You can specify the RIR / IRR against which the AS number and prefixes are registered.
    • MD5 哈希(如果选择使用)。An MD5 hash, if you choose to use one. 可选。Optional.

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

    New-AzureBGPPeering -AccessType Microsoft -ServiceKey "*********************************" -PrimaryPeerSubnet "131.107.0.0/30" -SecondaryPeerSubnet "131.107.0.4/30" -VlanId 300 -PeerAsn 1234 -CustomerAsn 2245 -AdvertisedPublicPrefixes "123.0.0.0/30" -RoutingRegistryName "ARIN" -SharedKey "A1B2C3D4"
    

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

可使用以下 cmdlet 来查看配置详细信息:You can view configuration details using the following cmdlet:

Get-AzureBGPPeering -AccessType Microsoft -ServiceKey "*********************************"

返回:Return:

AdvertisedPublicPrefixes       : 123.0.0.0/30
AdvertisedPublicPrefixesState  : Configured
AzureAsn                       : 12076
CustomerAutonomousSystemNumber : 2245
PeerAsn                        : 1234
PrimaryAzurePort               : 
PrimaryPeerSubnet              : 10.0.0.0/30
RoutingRegistryName            : ARIN
SecondaryAzurePort             : 
SecondaryPeerSubnet            : 10.0.0.4/30
State                          : Enabled
VlanId                         : 300

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

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

Set-AzureBGPPeering -AccessType Microsoft -ServiceKey "*********************************" -PrimaryPeerSubnet "131.107.0.0/30" -SecondaryPeerSubnet "131.107.0.4/30" -VlanId 300 -PeerAsn 1234 -CustomerAsn 2245 -AdvertisedPublicPrefixes "123.0.0.0/30" -RoutingRegistryName "ARIN" -SharedKey "A1B2C3D4"

删除 Microsoft 对等互连To delete Microsoft peering

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

Remove-AzureBGPPeering -AccessType Microsoft -ServiceKey "*********************************"

后续步骤Next steps

接下来,请 将 VNet 链接到 ExpressRoute 线路Next, Link a VNet to an ExpressRoute circuit.