您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

教程:使用 Azure 门户配置 ExpressRoute 的虚拟网络网关Tutorial: Configure a virtual network gateway for ExpressRoute using the Azure portal

本教程演示如何为预先存在的 VNet 添加虚拟网络网关。This tutorial walks you through the steps to add a virtual network gateway for a pre-existing VNet. 本文将演示为预先存在的 VNet 添加虚拟网络 (VNet) 网关、重设其大小并进行删除的步骤。This article walks you through the steps to add, resize, and remove a virtual network (VNet) gateway for a pre-existing VNet. 此配置的步骤专用于使用 Resource Manager 部署模型创建的、会在 ExpressRoute 配置中使用的 VNet。The steps for this configuration are specifically for VNets that were created using the Resource Manager deployment model that will be used in an ExpressRoute configuration. 有关 ExpressRoute 的虚拟网络网关和网关配置设置的详细信息,请参阅关于 ExpressRoute 的虚拟网络网关For more information about virtual network gateways and gateway configuration settings for ExpressRoute, see About virtual network gateways for ExpressRoute.

在本教程中,你将了解如何执行以下操作:In this tutorial, you learn how to:

  • 创建网关子网。Create a gateway subnet.
  • 创建虚拟网络网关。Create Virtual Network gateway.

先决条件Prerequisites

此任务的步骤使用的 VNet 基于以下配置参考列表中的值。The steps for this task use a VNet based on the values in the following configuration reference list. 我们将此列表用于我们的示例步骤。We use this list in our example steps. 可以复制列表作为参考,并将列表中的值替换为自己的值。You can copy the list to use as a reference, replacing the values with your own.

配置参考列表Configuration reference list

  • 虚拟网络名称 = “TestVNet”Virtual Network Name = "TestVNet"
  • 虚拟网络地址空间 = 192.168.0.0/16Virtual Network address space = 192.168.0.0/16
  • 子网名称 =“FrontEnd”Subnet Name = "FrontEnd"
    • 子网地址范围 =“192.168.1.0/24”Subnet address space = "192.168.1.0/24"
  • 资源组 = “TestRG”Resource Group = "TestRG"
  • 位置 =“美国东部”Location = "East US"
  • 网关子网名称:“GatewaySubnet”必须始终将网关子网命名为 GatewaySubnetGateway Subnet name: "GatewaySubnet" You must always name a gateway subnet GatewaySubnet.
    • 网关子网地址空间 = “192.168.200.0/26”Gateway Subnet address space = "192.168.200.0/26"
  • 网关名称 =“ERGW”Gateway Name = "ERGW"
  • 网关公共 IP 名称 =“MyERGWVIP”Gateway Public IP Name = "MyERGWVIP"
  • 网关类型 =“ExpressRoute” ExpressRoute 配置需要此类型。Gateway type = "ExpressRoute" This type is required for an ExpressRoute configuration.

可以先观看这些步骤的视频,再开始配置。You can view a Video of these steps before beginning your configuration.

创建网关子网Create the gateway subnet

  1. 门户中,导航到要为其创建虚拟网关的 Resource Manager 虚拟网络。In the portal, navigate to the Resource Manager virtual network for which you want to create a virtual network gateway.

  2. 在 VNet 的“设置”部分,选择“子网”以展开子网设置 。In the Settings section of your VNet, select Subnets to expand the Subnet settings.

  3. 在子网设置中,选择“+网关子网”来添加网关子网 。In the Subnets settings, select + Gateway subnet to add a gateway subnet.

    添加网关子网

  4. 子网的“名称”自动填充为值“GatewaySubnet”。The Name for your subnet is automatically filled in with the value 'GatewaySubnet'. Azure 需要此值才能识别作为网关子网的子网。This value is required in order for Azure to recognize the subnet as the gateway subnet. 调整自动填充的地址范围值,使其符合配置要求。Adjust the autofilled Address range values to match your configuration requirements. 建议使用 /27 或更大(/26、/25 等)创建网关子网。We recommend creating a gateway subnet with a /27 or larger (/26, /25, and so on.). 然后,单击“确定”来保存这些值并创建网关子网。Then, select OK to save the values and create the gateway subnet.

    添加子网

创建虚拟网络网关Create the virtual network gateway

  1. 在门户左侧选择“创建资源”,然后在搜索框中键入“虚拟网络网关”。In the portal, on the left side, select Create a resource , and type 'Virtual Network Gateway' in search. 在搜索返回的结果中找到“虚拟网关”,并选择该条目 。Locate Virtual network gateway in the search return and select the entry. 在“虚拟网关”页上,选择“创建” 。On the Virtual network gateway page, select Create.

  2. 在“创建虚拟网络网关”页面上,输入或选择以下设置:On the Create virtual network gateway page, enter, or select these settings:

    设置Setting Value
    订阅Subscription 确保选择正确的订阅。Verify that the correct subscription is selected.
    资源组Resource Group 选择虚拟网络后,将自动选择资源组。The resource group will automatically be chosen once you select the virtual network.
    名称Name 为网关命名。Name your gateway. 这与为网关子网命名不同。This isn't the same as naming a gateway subnet. 它是要创建的网关对象的名称。It's the name of the gateway object you're creating.
    区域Region 更改“区域”字段,使其指向虚拟网络所在的位置。Change the Region field to point to the location where your virtual network is located. 如果该位置未指向虚拟网络所在的区域,那么该虚拟网络将不在“选择虚拟网络”下拉列表中显示。If the location isn't pointing to the region where your virtual network is, the virtual network won't appear in the 'Choose a virtual network' dropdown.
    网关类型Gateway type 选择“ExpressRoute”Select ExpressRoute
    SKUSKU 从下拉列表中选择网关 SKU。Select the gateway SKU from the dropdown.
    虚拟网络Virtual network 选择 TestVNet。Select TestVNet.
    公共 IP 地址Public IP address 选择“新建”。Select Create new.
    公共 IP 地址名称Public IP address name 为公共 IP 地址提供一个名称。Provide a name for the public IP address.
  3. 依次选择“查看 + 创建”和“创建”,开始创建网关 。Select Review + Create , and then Create to begin creating the gateway. 此时会验证设置并部署网关。The settings are validated and the gateway deploys. 创建虚拟网络网关可能需要多达 45 分钟才能完成。Creating virtual network gateway can take up to 45 minutes to complete.

    “创建虚拟网关”页字段

清理资源Clean up resources

如果不再需要 ExpressRoute 网关,请在虚拟网络资源组中找到该网关,然后选择“删除”。If you no longer need the ExpressRoute gateway, locate the gateway in the virtual network resource group and select Delete. 请确保该网关没有任何到线路的连接。Ensure the gateway doesn't have any connections to a circuit.

删除虚拟网络网关

后续步骤Next steps

创建 VNet 网关后,可将 VNet 链接到 ExpressRoute 线路。After you've created the VNet gateway, you can link your VNet to an ExpressRoute circuit.