你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

使用 Azure 门户管理 Azure Stack Edge Pro GPU 上 VM 上的网络接口

适用于:Yes for Pro GPU SKUAzure Stack Edge Pro - GPUYes for Pro 2 SKUAzure Stack Edge Pro 2Yes for Pro R SKUAzure Stack Edge Pro RYes for Mini R SKUAzure Stack Edge Mini R

你可以使用 Azure 门户、模板、Azure PowerShell cmdlet 以及通过 Azure CLI/Python 脚本在 Azure Stack Edge 设备上创建和管理虚拟机 (VM)。 本文介绍如何使用 Azure 门户管理在 Azure Stack Edge 设备上运行的 VM 上的网络接口。

创建 VM 时,需要指定一个要创建的虚拟网络接口。 创建虚拟机后,可能要向其添加一个或多个网络接口。 还可更改现有网络接口的默认网络接口设置。

本文介绍如何将网络接口添加到现有 VM、更改 IP 类型(静态与动态)等现有设置以及拆离或删除现有接口。

关于 VM 上的网络接口

通过网络接口,Azure Stack Edge Pro 设备上运行的虚拟机 (VM) 能够与 Azure 和本地资源进行通信。

可以使用本地 UI 创建一个或多个虚拟交换机。 创建虚拟交换机后,Azure Stack Edge 将为其创建默认网络。 VM 可以通过虚拟交换机附加到默认网络。 默认网络名称与虚拟交换机名称相同。

创建虚拟网络是可选的。 仅当网络位于不同的 VLAN 网络中,或者具有不同的非默认地址空间和网关时,才必须创建虚拟网络。

多个网络接口可以与一个虚拟交换机相关联。 VM 上的每个网络接口都分配有一个静态或动态 IP 地址。 将 IP 地址分配到 VM 上的多个网络接口时,会在 VM 上启用某些功能。 例如,VM 可在单个服务器上使用不同的 IP 地址和 SSL 证书托管多个网站或服务。

设备上的 VM 可以充当网络虚拟设备,例如防火墙或负载均衡器。 有关在虚拟交换机上添加虚拟局域网 (LAN) 配置的详细信息,请参阅创建虚拟 LAN

先决条件

在开始通过 Azure 门户在设备上管理 VM 之前,请确保:

  1. 可以访问激活的 Azure Stack Edge Pro GPU 设备。 已启用设备上的计算网络接口。 此操作会在 VM 上的该网络接口上创建一个虚拟交换机。

    1. 在设备的本地 UI 中,转到“计算”。 选择将用于创建虚拟交换机的网络接口。

    2. 在网络接口上启用计算。 Azure Stack Edge Pro GPU 创建并管理与该网络接口相对应的虚拟交换机。

  2. 在设备上至少部署了一个 VM。 若要创建此 VM,请参阅通过 Azure 门户在 Azure Stack Edge Pro 上部署 VM 中的说明。

  3. VM 应处于“已停止”状态。 要停止 VM,请转到“虚拟机”中,选择要停止的 VM。 在 VM“详细信息”页上,选择“停止”,然后在提示确认时选择“是”。 在添加、编辑或删除网络接口之前,必须停止 VM。

    Screenshot showing the confirmation prompt to stop a virtual machine in Azure Stack Edge.

添加网络接口

按照以下步骤将网络接口添加到设备上部署的虚拟机。

  1. 转到已停止的虚拟机,然后选择“网络”。

    Screenshot showing the Details tab for a virtual machine. The Networking label, which opens the Networking blade for the VM, is highlighted.

  2. 在“网络”边栏选项卡中,从命令栏中选择“+ 添加网络接口” 。

    Screenshot showing the Networking blade for a virtual machine. The Plus Add Network Interface button is highlighted.

  3. 在“添加网络接口”边栏选项卡中,输入以下参数:

    字段 说明
    名称 边缘资源组内的唯一名称。 创建网络接口后,无法更改其名称。 若要轻松管理多个网络接口,请使用命名约定中提供的建议。
    选择边缘资源组 选择要将网络接口添加到的边缘资源组。
    虚拟网络 在网络接口上启用计算时,与设备上创建的虚拟交换机关联的虚拟网络。
    子网 所选虚拟网络中的子网。 此字段将自动填充与启用了计算的网络接口关联的子网。
    IP 地址分配 网络接口的静态或动态 IP。 静态 IP 应该是指定子网范围内可用的空闲 IP。 如果环境中存在 DHCP 服务器,请选择动态。

    Screenshot showing the Add network interface blade for a virtual machine. The Add button is highlighted.

  4. 此时会显示一条通知,指出正在创建网络接口。

    Screenshot showing the notification that a network interface is being created.

  5. 成功创建网络接口后,网络接口的列表会刷新以显示新创建的接口。

    Screenshot of the Networking blade for a virtual machine. The entry for a newly created virtual machine is highlighted.

编辑网络接口

按照以下步骤编辑与设备上部署的虚拟机关联的网络接口。

  1. 转到已停止的虚拟机,然后选择虚拟机“详细信息”中的“网络”。

  2. 在网络接口列表中,选择要编辑的接口。 在所选网络接口的最右侧,选择编辑图标(铅笔)。

    Screenshot showing the Networking blade for a virtual machine. The name of a network interface, and the pencil icon for the entry, are highlighted.

  3. 在“编辑网络接口”边栏选项卡中,只能更改网络接口的 IP 分配。 创建网络接口后,无法更改其名称、边缘资源组、虚拟网络和与其关联的子网。 将“IP 分配”更改为静态,并保存所做的更改。

    Screenshot of the Edit network interface blade for a virtual machine. The IP address assignment area and the Save button are highlighted.

  4. 刷新网络接口列表,以显示更新的网络接口。

拆离网络接口

按照以下步骤拆离或删除与设备上部署的虚拟机关联的网络接口。

  1. 转到已停止的虚拟机,然后选择虚拟机“详细信息”中的“网络”。

  2. 在网络接口列表中,选择要编辑的接口。 在所选网络接口的最右侧,选择拆离图标(拔掉)。

    Screenshot of the Networking blade for a virtual machine. The name of a network interface, and the detach icon for it are highlighted.

  3. 你将看到一条消息,要求你确认是否要拆离网络接口。 选择 “是”

    Screenshot showing the notification to confirm you want to detach a network interface from a virtual machine.

    完全拆离接口后,会刷新网络接口列表以显示剩余的接口。

删除网络接口

请按照以下步骤操作,删除未连接到虚拟机的网络接口。

  1. 依次转到“虚拟机”和“资源”页。 选择“网络”。

    Screenshot that shows the Networking tab on the Resources page for virtual machines. The labels for the Resources pane and the Networking tab are highlighted.

  2. 在“网络”边栏选项卡上,根据要删除的网络接口选择删除图标(垃圾桶)。 仅显示未附加到 VM 的网络接口的删除图标。

    Screenshot showing the Networking blade in virtual machine resources. The delete icon for an unattached network interface is highlighted.

  3. 你将看到一条消息,要求你确认是否要删除网络接口。 此操作不可逆。 选择 “是”

    Screenshot of the notification asking you to confirm you want to delete a selected network interface.

    删除网络接口后,将从列表中删除网络接口。

后续步骤

若要了解如何在 Azure Stack Edge Pro 设备上部署虚拟机,请参阅通过 Azure 门户部署虚拟机