使用 PowerShell 创建和修改 ExpressRoute 线路的对等互连
本文可帮助使用 PowerShell 在资源管理器部署模型中创建和管理 ExpressRoute 线路的路由配置。 还可以检查 ExpressRoute 线路的状态,更新、删除和取消预配其对等互连。 如果想使用不同的方法处理线路,请从以下列表中选择一篇文章进行参阅:
Resource Manager - Azure 门户
Resource Manager - PowerShell
Azure CLI
经典 - PowerShell
配置先决条件
- 需要最新版本的 Azure Resource Manager PowerShell cmdlet。 有关详细信息,请参阅如何安装和配置 Azure PowerShell。
- 在开始配置之前,请务必查看先决条件页、路由要求页和工作流页。
- 必须有一个活动的 ExpressRoute 线路。 在继续下一步之前,请按说明 创建 ExpressRoute 线路 ,并通过连接提供商启用该线路。 ExpressRoute 线路必须处于已预配和已启用状态,才能运行本文中的 cmdlet。
这些说明只适用于由提供第 2 层连接服务的服务提供商创建的线路。 如果服务提供商提供第 3 层托管服务(通常是 IPVPN,如 MPLS),则连接服务提供商会配置和管理路由。
Important
我们目前无法通过服务管理门户播发服务提供商配置的对等互连。 我们正在努力不久就实现这一功能。 请在配置 BGP 对等互连之前与服务提供商协商。
你可以为 ExpressRoute 线路配置一或两个对等互连(Azure 专用和Azure 公共互联)。 可以按照所选的任意顺序配置对等互连。 但是,你必须确保一次只完成一个对等互连的配置。
Azure 专用对等互连
本文介绍如何为 ExpressRoute 线路创建、获取、更新和删除 Azure 专用对等互连配置。
创建 Azure 专用对等互连
为 ExpressRoute 导入 PowerShell 模块。
必须从 PowerShell 库安装最新的 PowerShell 安装程序,并将 Azure Resource Manager 模块导入 PowerShell 会话,以便开始使用 ExpressRoute cmdlet。 需要以管理员身份运行 PowerShell。
PowerShell复制Install-Module AzureRM
Install-AzureRM
导入已知语义版本范围内的所有 AzureRM.* 模块。
PowerShell复制Import-AzureRM
也可以只导入已知语义版本范围内的所选模块
PowerShell复制Import-Module AzureRM.Network
登录到帐户。
PowerShell复制Login-AzureRmAccount -Environment $(Get-AzureRmEnvironment -Name AzureChinaCloud)
选择要创建 ExpressRoute 线路的订阅
PowerShell复制Select-AzureRmSubscription -SubscriptionId "<subscription ID>"
创建 ExpressRoute 线路。
请按说明创建 ExpressRoute 线路 ,并由连接服务提供商进行预配。
如果连接服务提供商提供第 3 层托管服务,可以请求连接服务提供商启用 Azure 专用对等互连。 在这种情况下,不需要遵循后续部分中所列的说明。 但是,如果连接服务提供商不为你管理路由,请在创建线路后按照后续步骤继续配置。
检查 ExpressRoute 线路以确保它已预配并已启用。 使用以下示例:
PowerShell复制Get-AzureRmExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"
其响应类似于如下示例:
复制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 : []
配置线路的 Azure 专用对等互连。
在继续执行后续步骤之前,请确保已准备好以下各项:
- 主链路的 /30 子网。 此子网不能是保留给虚拟网络使用的任何地址空间的一部分。
- 辅助链路的 /30 子网。 此子网不能是保留给虚拟网络使用的任何地址空间的一部分。
- 用于建立此对等互连的有效 VLAN ID。 请确保线路中没有其他对等互连使用同一个 VLAN ID。
- 对等互连的 AS 编号。 可以使用 2 字节和 4 字节 AS 编号。 可以将专用 AS 编号用于此对等互连。 请务必不要使用 65515。
- 可选 - MD5 哈希(如果选择使用)。
使用以下示例为线路配置 Azure 专用对等互连:
PowerShell复制Add-AzureRmExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt -PeeringType AzurePrivatePeering -PeerASN 100 -PrimaryPeerAddressPrefix "10.0.0.0/30" -SecondaryPeerAddressPrefix "10.0.0.4/30" -VlanId 200 Set-AzureRmExpressRouteCircuit -ExpressRouteCircuit $ckt
如果选择使用 MD5 哈希,请使用以下示例:
PowerShell复制Add-AzureRmExpressRouteCircuitPeeringConfig -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。
查看 Azure 专用对等互连详细信息
可以使用以下示例来获取配置详细信息:
$ckt = Get-AzureRmExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"
Get-AzureRmExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -Circuit $ckt
更新 Azure 专用对等互连配置
可以使用以下示例来更新配置的任何部分。 在此示例中,线路的 VLAN ID 将从 100 更新为 500。
Set-AzureRmExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt -PeeringType AzurePrivatePeering -PeerASN 100 -PrimaryPeerAddressPrefix "10.0.0.0/30" -SecondaryPeerAddressPrefix "10.0.0.4/30" -VlanId 200
Set-AzureRmExpressRouteCircuit -ExpressRouteCircuit $ckt
删除 Azure 专用对等互连
可以运行以下示例来删除对等互连配置:
Warning
运行此示例前,必须确保已从 ExpressRoute 线路取消链接所有虚拟网络。
Remove-AzureRmExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt
Set-AzureRmExpressRouteCircuit -ExpressRouteCircuit $ckt
Azure 公共对等互连
本文介绍如何为 ExpressRoute 线路创建、获取、更新和删除 Azure 公共对等互连配置。
创建 Azure 公共对等互连
为 ExpressRoute 导入 PowerShell 模块。
必须从 PowerShell 库安装最新的 PowerShell 安装程序,并将 Azure Resource Manager 模块导入 PowerShell 会话,以便开始使用 ExpressRoute cmdlet。 需要以管理员身份运行 PowerShell。
PowerShell复制Install-Module AzureRM Install-AzureRM
导入已知语义版本范围内的所有 AzureRM.* 模块。
PowerShell复制Import-AzureRM
也可以只导入已知语义版本范围内的 select 模块。
PowerShell复制Import-Module AzureRM.Network
登录到帐户。
PowerShell复制Login-AzureRmAccount -Environment $(Get-AzureRmEnvironment -Name AzureChinaCloud)
选择要创建 ExpressRoute 线路的订阅。
PowerShell复制Select-AzureRmSubscription -SubscriptionId "<subscription ID>"
创建 ExpressRoute 线路。
请按说明创建 ExpressRoute 线路 ,并由连接服务提供商进行预配。
如果连接服务提供商提供第 3 层托管服务,可以请求连接服务提供商启用 Azure 专用对等互连。 在这种情况下,不需要遵循后续部分中所列的说明。 但是,如果连接服务提供商不为你管理路由,请在创建线路后按照后续步骤继续配置。
检查 ExpressRoute 线路以确保它已预配并已启用。 使用以下示例:
PowerShell复制Get-AzureRmExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"
其响应类似于如下示例:
复制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 : []
配置线路的 Azure 公共对等互连。
在继续下一步之前,请确保已准备以下信息。
- 主链路的 /30 子网。 这必须是有效的公共 IPv4 前缀。
- 辅助链路的 /30 子网。 这必须是有效的公共 IPv4 前缀。
- 用于建立此对等互连的有效 VLAN ID。 请确保线路中没有其他对等互连使用同一个 VLAN ID。
- 对等互连的 AS 编号。 可以使用 2 字节和 4 字节 AS 编号。
- 可选 - MD5 哈希(如果选择使用)。
运行以下示例为线路配置 Azure 公共对等互连
PowerShell复制Add-AzureRmExpressRouteCircuitPeeringConfig -Name "AzurePublicPeering" -ExpressRouteCircuit $ckt -PeeringType AzurePublicPeering -PeerASN 100 -PrimaryPeerAddressPrefix "12.0.0.0/30" -SecondaryPeerAddressPrefix "12.0.0.4/30" -VlanId 100 Set-AzureRmExpressRouteCircuit -ExpressRouteCircuit $ckt
如果选择使用 MD5 哈希,请使用以下示例:
PowerShell复制Add-AzureRmExpressRouteCircuitPeeringConfig -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-AzureRmExpressRouteCircuit -ExpressRouteCircuit $ckt
Important
请确保将 AS 编号指定为对等互连 ASN,而不是客户 ASN。
查看 Azure 公共对等互连详细信息
可以使用以下 cmdlet 来获取配置详细信息:
$ckt = Get-AzureRmExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"
Get-AzureRmExpressRouteCircuitPeeringConfig -Name "AzurePublicPeering" -Circuit $ckt
更新 Azure 公共对等互连配置
可以使用以下示例来更新配置的任何部分。 在此示例中,线路的 VLAN ID 将从 200 更新为 600。
Set-AzureRmExpressRouteCircuitPeeringConfig -Name "AzurePublicPeering" -ExpressRouteCircuit $ckt -PeeringType AzurePublicPeering -PeerASN 100 -PrimaryPeerAddressPrefix "123.0.0.0/30" -SecondaryPeerAddressPrefix "123.0.0.4/30" -VlanId 600
Set-AzureRmExpressRouteCircuit -ExpressRouteCircuit $ckt
删除 Azure 公共对等互连
可以运行以下示例来删除对等互连配置:
Remove-AzureRmExpressRouteCircuitPeeringConfig -Name "AzurePublicPeering" -ExpressRouteCircuit $ckt
Set-AzureRmExpressRouteCircuit -ExpressRouteCircuit $ckt
后续步骤
下一步, 将 VNet 链接到 ExpressRoute 线路。
有关 ExpressRoute 工作流的详细信息,请参阅 ExpressRoute 工作流。
有关线路对等互连的详细信息,请参阅 ExpressRoute 线路和路由域。
有关使用虚拟网络的详细信息,请参阅 虚拟网络概述。
使用 PowerShell 创建和修改 ExpressRoute 线路的对等互连的更多相关文章
- 创建和修改 ExpressRoute 线路的对等互连
本文将指导你执行相关步骤,以便使用 Azure 门户和 Resource Manager 部署模型创建和管理 ExpressRoute 线路的路由配置. 配置先决条件 在开始配置之前,请务必查看先决条 ...
- 使用 PowerShell 创建和修改 ExpressRoute 线路
开始之前 安装最新版本的 Azure Resource Manager PowerShell cmdlet. 有关详细信息,请参阅 Azure PowerShell 概述. 在开始配置之前,请查看先决 ...
- 创建和修改 ExpressRoute 线路
本文介绍如何使用 Azure 门户和 Azure Resource Manager 部署模型创建 Azure ExpressRoute 线路. 以下步骤还说明如何查看线路状态,以及如何更新.删除和取消 ...
- 将 ExpressRoute 线路从经典部署模型转移到 Resource Manager 部署模型
本文概述将 Azure ExpressRoute 线路从经典部署模型转移到 Azure Resource Manager 部署模型的效果. Azure 当前使用两种部署模型:Resource Mana ...
- 将虚拟网络连接到 ExpressRoute 线路
本文通过使用 Resource Manager 部署模型和 Azure 门户,帮助将虚拟网络 (VNets) 链接到 Azure ExpressRoute 线路. 虚拟网络可以在同一个订阅中,也可以属 ...
- ExpressRoute 线路预配工作流和线路状态
本页从较高层面引导你完成服务预配和路由配置工作流. 下图和相应的步骤说明了预配端到端 ExpressRoute 线路所要执行的任务. 使用 PowerShell 配置 ExpressRoute 线路. ...
- ExpressRoute 线路和路由域
你必须订购一条 ExpressRoute 线路 ,以通过连接提供商将你的本地基础结构连接到 Azure.下图提供了你的 WAN 与 Azure 之间的连接的逻辑表示形式. ExpressRoute 线 ...
- Azure PowerShell (5) 使用Azure PowerShell创建简单的Azure虚拟机和Linux虚拟机
<Windows Azure Platform 系列文章目录> 本文介绍的是国外的Azure Global.如果是国内由世纪互联运维的Azure China,请参考这篇文档: Azure ...
- Oracle触发器原理、创建、修改、删除
本篇主要内容如下: 8.1 触发器类型 8.1.1 DML触发器 8.1.2 替代触发器 8.1.3 系统触发器 8.2 创建触发器 8.2.1 触发器触发次序 8.2.2 创建DML触发器 8.2. ...
随机推荐
- 【树】Unique Binary Search Trees II
题目: Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. F ...
- C#中null值属于什么变量类型
今天学习发现有段代码的输出结果有些理解不了,如图1,输出的结果全部为 false: 图1 后来和同事讨论研究了一下才明白,原来是这样:↓ class Program { static void Mai ...
- echart 桑基图操作事项
例图 注意: option = { label:{//formatter名字 show:true, formatter:function(obj){ return obj.data.name+'_12 ...
- WPF开发的彩票程序(练手好例子)
前言 WPF是.NET最新的界面开发库,开发界面非常灵活!但是学习WPF难度也非常大. 应朋友之邀,编写了一个小程序.程序虽小,五脏俱全,WPF开发的灵活性可窥见一斑. 对于新手学习有很好的借鉴意义, ...
- 解惑《你必须知道的.net》——C#继承关系中【方发表】的创建和调用
前言: 现在正在读<你必须知道的.net>(第二版)一书,看到IL语言那一章,将call.callvirt和calli时候,书中举了一个例子,是一个三层继承的例子,我一开始看的时候就有点懵 ...
- NoSQL之Redis入门笔记
Redis 1.Redis介绍 1.1 NoSQL:一类新出现的数据库(not only sql),它的特点 不支持sql语法 存储结构跟传统关系型数据库中的那种关系表完全不同,nosql中存储的数据 ...
- 数据库--oracle图形化管理工具和新增自定义用户
oracle数据库图形化管理工具: 1 navicat工具很小,操作mySQL和SQLServer非常好用,但对于oracle体验性就有点差,要自己下载编码和替换oci文件.下面是解决的方法教程链接 ...
- java面试⑤前端部分
2.4.1 简单说一下HTML,CSS,javaScript在网页开发中的定位? 2.4.2简单介绍一下AJAX 2.4.3 JS和JQuery的关系 2.4.4 JQuery的常用选择器 2.4.5 ...
- BATJ面试必会之Java IO 篇
一.概览 二.磁盘操作 三.字节操作 实现文件复制 装饰者模式 四.字符操作 编码与解码 String 的编码方式 Reader 与 Writer 实现逐行输出文本文件的内容 五.对象操作 序列化 S ...
- sql多行合并成一行用逗号隔开,多表联合查询中子查询取名可重复
简单版的 SELECT a.CreateBy,Name =stuff((select ','+Name FROM SG_Client WHERE CreateBy = a.CreateBy for x ...