> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/welcome/cn/cloud-networking/get-started/validate-connection-in-public-cloud/microsoft-azure-cloud-configuration.md).

# 微软云 ExpressRoute Circuit 配置

微软云侧的专线配置：创建 ExpressRoute 线路并传递服务密钥、配置虚拟网络与网关、建立连接并检查 BGP。

## 背景信息

Azure ExpressRoute 让您通过服务提供商的专用线路绕过公共互联网，直接与 Azure 建立连接。相比公网访问，它的可靠性更高、时延更低、安全性更强，常用于大型企业、金融、医疗等行业的跨地域数据交换，尤其适合实时数据处理、大规模数据迁移与高可用灾备。

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-d5933071d6bdb869e9c91da860c69a8972001bb2%2Fazure-er-traffic-paths.png?alt=media" alt=""><figcaption><p>ExpressRoute 访问 Azure 公共服务与虚拟网络的流量路径</p></figcaption></figure>

## 名词解释

| 名称                          | 说明                            |
| --------------------------- | ----------------------------- |
| **ExpressRoute Circuit**    | 本地网络与微软云之间的虚拟专线               |
| **Virtual Network**         | 虚拟网络，Azure 订阅下的虚拟网络环境         |
| **Virtual Network Gateway** | 虚拟网络的虚拟网关                     |
| **Connections**             | 将 ExpressRoute 线路与虚拟网关关联的配置组件 |

{% hint style="info" %} <mark style="color:blue;">**注意**</mark>

<mark style="color:blue;">ExpressRoute 线路自</mark><mark style="color:blue;">**服务密钥发放时**</mark><mark style="color:blue;">开始计费。请在接入方案确认、Zenlayer 可以着手配置时再创建线路。</mark>
{% endhint %}

## 操作步骤

您的本地设备通过 Zenlayer 二层专线与 Azure 云上负载建立 BGP 连接，整体流程如下：

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-2d0a2dd5ea1838074f9dfe213077e61d07968c45%2F%E5%BE%AE%E8%BD%AF%E4%BA%91%E4%B8%93%E7%BA%BF%E9%85%8D%E7%BD%AE%E6%B5%81%E7%A8%8B.svg?alt=media" alt=""><figcaption><p>微软云侧配置流程</p></figcaption></figure>

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-4c432ba3250e983701fff1f683cf402d05ed1b24%2Fazure-er-architecture.png?alt=media" alt=""><figcaption><p>Azure ExpressRoute 端到端连接示意</p></figcaption></figure>

{% stepper %}
{% step %}
**创建 ExpressRoute 线路并传递服务密钥**

进入 **ExpressRoute circuits** 服务，点击 **Create** 创建线路。

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-c1d2a4e95343e48358057fdd2527c08a4c408883%2Fazure-er-circuit-1.png?alt=media" alt=""><figcaption><p>创建 ExpressRoute 线路</p></figcaption></figure>

按方案完成以下配置：

* 选择您的 Azure 订阅；建议把同一项目的云上资源放在同一**资源组**中，便于维护。
* 选择部署 ExpressRoute 的**区域**，并设置线路名称。
* **端口类型**选择 **Provider**，**供应商**选择 **Zenlayer**。
* 确认选择正确的数据中心，可参考 Azure 官网的 [**Global commercial Azure**](https://learn.microsoft.com/azure/expressroute/expressroute-locations#global-commercial-azure) 列表。
* 按需求选择带宽规格、SKU 与计费方式。

<img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-5961bea9ac389c1aa2f03164b5622f10a99895e1%2FIcon.svg?alt=media&amp;token=a93735da-9464-4c9e-8864-df26ba85d8b3" alt="" data-size="line"><mark style="color:blue;">**注意**</mark>\ <mark style="color:blue;">ExpressRoute 线路的带宽只能升速、不能降速。详见</mark> [<mark style="color:purple;">**修改 ExpressRoute 线路**</mark>](https://learn.microsoft.com/azure/expressroute/expressroute-howto-circuit-portal-resource-manager#modify)<mark style="color:blue;">。</mark>

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-11e879e0e28af05b8a6d044d816b1a79a82d10af%2Fazure-er-circuit-2.png?alt=media" alt=""><figcaption><p>ExpressRoute 线路的参数配置项</p></figcaption></figure>

创建完成后，在线路的 **Overview** 中获取 **Service Key**（服务密钥），连同以下信息一并提供给 Zenlayer：

| 需提供的信息                      | 说明                                                   |
| --------------------------- | ---------------------------------------------------- |
| 本地设备 ASN                    | 您本地设备的自治系统号                                          |
| IPv4 Primary / Secondary 子网 | 本地设备使用子网的第一个可用地址，微软侧默认使用第二个；无论是否主备双线接入，两条线路都需要填写不同子网 |
| VLAN ID                     | 用于标识专线链路                                             |

Zenlayer 会为您预配置 BGP，约 10 分钟完成。完成后 BGP 状态显示为 **UP**，表示连接已建立。您也可以稍后在 **Peerings** > **Azure private** 中修改。

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-4da8fae682fce6e502813c3704fa57b1e3b09a9b%2Fazure-er-service-key.png?alt=media" alt=""><figcaption><p>在 Overview 中获取服务密钥</p></figcaption></figure>

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-42405377f5d4826a6f9276b75e1e9eb3f2d94af3%2Fazure-er-bgp-up.png?alt=media" alt=""><figcaption><p>BGP 状态显示为 UP</p></figcaption></figure>
{% endstep %}

{% step %}
**配置虚拟网络与虚拟网关**

如果云上已有虚拟网络及其虚拟网关，可跳过此步。

1. 选择 **Virtual networks**，点击 **Create** 创建虚拟网络，确保资源组与区域符合业务需求。
2. 在 **Subnets** 中创建**网关子网**。
3. 选择 **Virtual network gateways**，点击 **Create** 创建 ExpressRoute 网关，确保区域匹配，并关联到对应的虚拟网络网关子网。

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-5e3bdfb789ae525ce02bfcac60cb478ddf8bf62e%2Fazure-er-vnet-1.png?alt=media" alt=""><figcaption><p>创建虚拟网络</p></figcaption></figure>

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-bdcedeef8c027ce1452ae1527232b43c903dbcf5%2Fazure-er-vnet-2.png?alt=media" alt=""><figcaption><p>创建网关子网</p></figcaption></figure>

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-e4f43f4ae9978cbd0354504be2ae0ab68f034f10%2Fazure-er-gateway-1.png?alt=media" alt=""><figcaption><p>创建 ExpressRoute 虚拟网络网关</p></figcaption></figure>

配置完成后，可以看到虚拟网关已与虚拟网络关联。

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-1f7c8a5cf856526f619d3c0943485d4651c45ce6%2Fazure-er-gateway-2.png?alt=media" alt=""><figcaption><p>虚拟网关与虚拟网络关联完成</p></figcaption></figure>
{% endstep %}

{% step %}
**配置 Connections**

当 Zenlayer 反馈线路状态为 **Provisioned** 后，回到 ExpressRoute 线路，在左侧 **Settings** > **Connections** 中添加线路与虚拟网关之间的连接。

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-59e654cd5deac1fe4ba4a6a524466dfa97b1655b%2Fazure-er-connection-1.png?alt=media" alt=""><figcaption><p>在 Connections 页面新建连接</p></figcaption></figure>

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-a6b61106215ac4719e3bdfc89797c79e2908ccad%2Fazure-er-connection-2.png?alt=media" alt=""><figcaption><p>选择 ExpressRoute 连接类型</p></figcaption></figure>

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-f04b6542cea0ef49c2c24f1874d12243996a7eff%2Fazure-er-connection-3.png?alt=media" alt=""><figcaption><p>关联虚拟网络网关与 ExpressRoute 线路</p></figcaption></figure>

关联完成后状态如下，至此云上配置完成。

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-7958e9c624a9a5263a2a69eef1f76dd17b1de8aa%2Fazure-er-connection-4.png?alt=media" alt=""><figcaption><p>连接建立完成后的状态</p></figcaption></figure>
{% endstep %}

{% step %}
**检查 BGP Peering**

在 ExpressRoute 线路的 **Peerings** > **Azure private** 下检查 BGP 邻居状态与学习到的路由，确认双方已互相学到对端网段。

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-50a28d7e721b0c53ace1e2110e917f5baeb44922%2Fazure-er-peering-1.png?alt=media" alt=""><figcaption><p>查看 Azure private 对等互连</p></figcaption></figure>

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-4900a88794e638c2b12bab903cf2d5015284329a%2Fazure-er-peering-2.png?alt=media" alt=""><figcaption><p>检查 BGP 邻居状态</p></figcaption></figure>

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-d40a9f718220005b47b210f64f64dd60083a3be7%2Fazure-er-peering-3.png?alt=media" alt=""><figcaption><p>核对学习到的路由条目</p></figcaption></figure>

<figure><img src="https://2318250923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBWy7DFFtkhyEC9R4kE%2Fuploads%2Fgit-blob-8e721a9ec0a0eba56e92fa243c6108028774455b%2Fazure-er-peering-4.png?alt=media" alt=""><figcaption><p>确认连通性</p></figcaption></figure>
{% endstep %}
{% endstepper %}

## 在 zenConsole 侧

用 Azure 生成的服务密钥创建云连接：

* [**二层网络**](https://docs.console.zenlayer.com/welcome/cn/cloud-networking/get-started/create-a-layer-2-connection/select-a-public-cloud-as-access-point.md)
* [**三层网络**](https://docs.console.zenlayer.com/welcome/cn/cloud-networking/get-started/create-a-layer-3-connection/select-a-public-cloud-as-access-point.md)

## 参考

* [**创建 ExpressRoute 线路**](https://learn.microsoft.com/azure/expressroute/expressroute-howto-circuit-portal-resource-manager)
* [**ExpressRoute 可用位置**](https://learn.microsoft.com/azure/expressroute/expressroute-locations#global-commercial-azure)
* [**为 ExpressRoute 线路配置虚拟网络网关**](https://learn.microsoft.com/azure/expressroute/expressroute-howto-add-gateway-portal-resource-manager)
