教程:使用门户在 Azure 负载均衡器中配置端口转发Tutorial: Configure port forwarding in Azure Load Balancer using the portal

端口转发使你可以使用 Azure 负载均衡器公共 IP 地址和端口号连接到 Azure 虚拟网络中的虚拟机 (VM)。Port forwarding lets you connect to virtual machines (VMs) in an Azure virtual network by using an Azure Load Balancer public IP address and port number.

在本教程中,你将在 Azure 负载均衡器上设置端口转发。In this tutorial, you set up port forwarding on an Azure Load Balancer. 你将学习如何执行以下操作:You learn how to:

  • 创建公共标准负载均衡器来均衡 VM 上的网络流量。Create a public Standard load balancer to balance network traffic over VMs.
  • 使用网络安全组 (NSG) 规则创建虚拟网络和 VM。Create a virtual network and VMs with a network security group (NSG) rule.
  • 将 VM 添加到负载均衡器后端地址池。Add the VMs to the load balancer back-end address pool.
  • 创建负载均衡器运行状况探测和流量规则。Create a load balancer health probe and traffic rules.
  • 创建负载均衡器入站 NAT 端口转发规则。Create load balancer inbound NAT port-forwarding rules.
  • 在 VM 上安装和配置 IIS,以查看负载均衡和运行中的端口转发。Install and configure IIS on the VMs to view load balancing and port forwarding in action.

如果没有 Azure 订阅,可在开始前创建一个试用帐户If you don't have an Azure subscription, create a trial account before you begin.

对于本教程中的所有步骤,请通过 https://portal.azure.cn 登录 Azure 门户。For all steps in this tutorial, sign in to the Azure portal at https://portal.azure.cn.

创建标准负载均衡器Create a Standard load balancer

首先,创建公共标准负载均衡器,以便均衡 VM 上的流量负载。First, create a public Standard load balancer that can balance traffic load over VMs. 标准负载均衡器仅支持标准公共 IP 地址。A Standard load balancer supports only a Standard public IP address. 创建标准负载均衡器时,还要创建配置为负载均衡器前端且默认情况下命名为“LoadBalancerFrontEnd”的新的标准公共 IP 地址 。When you create a Standard load balancer, you also create a new Standard public IP address, which is configured as the load balancer front end and named LoadBalancerFrontEnd by default.

  1. 在屏幕的左上方,单击“创建资源” > “网络” > “负载均衡器” 。On the top left-hand side of the screen, click Create a resource > Networking > Load Balancer.

  2. 在“创建负载均衡器”页的“基本”选项卡中输入或选择以下信息,接受其余的默认设置,然后选择“查看 + 创建” :In the Basics tab of the Create load balancer page, enter or select the following information, accept the defaults for the remaining settings, and then select Review + create:

    设置Setting ValueValue
    订阅Subscription 选择订阅。Select your subscription.
    资源组Resource group 选择“新建”并在文本框中键入 MyResourceGroupLB 。Select Create new and type MyResourceGroupLB in the text box.
    名称Name myLoadBalancermyLoadBalancer
    区域Region 选择“中国东部 2” 。Select China East 2.
    类型Type 选择“公共”。 Select Public.
    SKUSKU 选择“标准” 。Select Standard.
    公共 IP 地址Public IP address 选择“新建”。 Select Create new.
    公共 IP 地址名称Public IP address name 在文本框中键入 myPublicIP 。Type myPublicIP in the text box.

    备注

    确保在某个位置中创建负载均衡器及其所有资源。Make sure to create your Load Balancer and all resources for it in a location.

  3. 在“查看 + 创建”选项卡中,单击“创建” 。In the Review + create tab, click Create.

创建并配置后端服务器Create and configure back-end servers

使用两台虚拟机创建虚拟网络,并将 VM 添加到负载均衡器的后端池。Create a virtual network with two virtual machines, and add the VMs to the back-end pool of your load balancer.

虚拟网络和参数Virtual network and parameters

在本部分中,你需要将步骤中的以下参数替换为以下信息:In this section you'll need to replace the following parameters in the steps with the information below:

参数Parameter ValueValue
<resource-group-name><resource-group-name> myResourceGroupLB(选择现有资源组)myResourceGroupLB (Select existing resource group)
<virtual-network-name><virtual-network-name> myVNetmyVNet
<region-name><region-name> 中国东部 2China East 2
<IPv4-address-space><IPv4-address-space> 10.3.0.0\1610.3.0.0\16
<subnet-name><subnet-name> myBackendSubnetmyBackendSubnet
<subnet-address-range><subnet-address-range> 10.3.0.0\2410.3.0.0\24

创建虚拟网络Create the virtual network

在本部分,请创建虚拟网络和子网。In this section, you'll create a virtual network and subnet.

  1. 在屏幕的左上方选择“创建资源”>“网络”>“虚拟网络”,或者在搜索框中搜索“虚拟网络”。 On the upper-left side of the screen, select Create a resource > Networking > Virtual network or search for Virtual network in the search box.

  2. 在“创建虚拟网络” 的“基本信息”选项卡中输入或选择以下信息 :In Create virtual network, enter or select this information in the Basics tab:

    设置Setting Value
    项目详细信息Project Details
    订阅Subscription 选择 Azure 订阅Select your Azure subscription
    资源组Resource Group 选择“新建” ,输入 <resource-group-name> ,然后选择“确定”,或根据参数选择现有 <resource-group-name>Select Create new, enter <resource-group-name>, then select OK, or select an existing <resource-group-name> based on parameters.
    实例详细信息Instance details
    名称Name 输入 <virtual-network-name>Enter <virtual-network-name>
    区域Region 选择 <region-name>Select <region-name>
  3. 选择“IP 地址”选项卡 ,或选择页面底部的“下一步: IP 地址”按钮。Select the IP Addresses tab or select the Next: IP Addresses button at the bottom of the page.

  4. 在“IP 地址” 选项卡上,输入以下信息:In the IP Addresses tab, enter this information:

    设置Setting Value
    IPv4 地址空间IPv4 address space 输入 <IPv4-address-space>Enter <IPv4-address-space>
  5. 在“子网名称” 下,选择词语“默认” 。Under Subnet name, select the word default.

  6. 在“编辑子网”中输入以下信息: In Edit subnet, enter this information:

    设置Setting Value
    子网名称Subnet name 输入 <subnet-name>Enter <subnet-name>
    子网地址范围Subnet address range 输入 <subnet-address-range>Enter <subnet-address-range>
  7. 选择“保存”。 Select Save.

  8. 选择“查看 + 创建” 选项卡,或选择“查看 + 创建” 按钮。Select the Review + create tab or select the Review + create button.

  9. 选择“创建” 。Select Create.

创建 VM 并将其添加到负载均衡器后端池Create VMs and add them to the load balancer back-end pool

  1. 在门户左上角,选择“创建资源” > “计算” > “Windows Server 2016 Datacenter”。 On the upper-left side of the portal, select Create a resource > Compute > Windows Server 2016 Datacenter.

  2. 在“创建虚拟机”中,在“基本信息”选项卡中键入或选择以下值: In Create a virtual machine, type or select the following values in the Basics tab:

    • 订阅 > 资源组:下拉并选择“MyResourceGroupLB”。 Subscription > Resource Group: Drop down and select MyResourceGroupLB.
    • 虚拟机名称:键入“MyVM1” 。Virtual machine name: Type MyVM1.
    • 区域:选择“中国北部” 。Region: Select China North.
    • 用户名:键入“azureuser” 。Username: Type azureuser.
    • 密码:键入“Azure1234567” 。Password: Type Azure1234567. 在“确认密码” 字段中,重新键入该密码。Retype the password in the Confirm password field.
  3. 选择“网络”选项卡,或选择 “下一步:磁盘”,然后选择“下一步: 网络”。Select the Networking tab, or select Next: Disks, then Next: Networking.

    确保选中以下项:Make sure the following are selected:

    • 虚拟网络MyVNetVirtual network: MyVNet
    • 子网MyBackendSubnetSubnet: MyBackendSubnet
  4. 在“公共 IP”下,选择“新建”,在“创建公共 IP 地址”页面上选择“标准”,然后选择“确定” 。Under Public IP, select Create new, select Standard on the Create public IP address page, and then select OK.

  5. 在“网络安全组”下选择“高级”,以创建新的网络安全组(简称 NSG,一种防火墙) 。Under Network Security Group, select Advanced to create a new network security group (NSG), a type of firewall.

    1. 在“配置网络安全组”字段中,选择“新建”。 In the Configure network security group field, select Create new.
    2. 键入 MyNetworkSecurityGroup,然后选择“确定”。 Type MyNetworkSecurityGroup, and select OK.

    备注

    请注意,默认情况下,NSG 已有打开端口 3389(远程桌面 (RDP) 端口)的传入规则。Observe that by default, the NSG already has an incoming rule to open port 3389, the remote desktop (RDP) port.

  6. 将 VM 添加到创建的负载均衡器后端池:Add the VM to a load balancer back-end pool that you create:

    1. 在“负载均衡” > “将此虚拟机置于现有负载均衡解决方案之后?”下,选择“确定” 。Under LOAD BALANCING > Place this virtual machine behind an existing load balancing solution?, select Yes.
    2. 对于“负载均衡选项”,下拉并选择“Azure 负载均衡器” 。For Load balancing options, drop down and select Azure load balancer.
    3. 对于“选择负载均衡器”,下拉并选择“MyLoadBalancer” 。For Select a load balancer, drop down and select MyLoadBalancer.
    4. 在“选择后端池”下,选择“新建”,然后输入“MyBackendPool”,再选择“创建” 。Under Select a backend pool, select Create new, then type MyBackendPool, and select Create.

    创建虚拟网络

  7. 选择“管理”选项卡,或者选择“下一步” > “管理”。 Select the Management tab, or select Next > Management. 在“监视” 下,将“启动诊断” 设置为“关闭”。 Under Monitoring, set Boot diagnostics to Off.

  8. 选择“查看 + 创建” 。Select Review + create.

  9. 检查设置,验证成功后,选择“创建” 。Review the settings, and when validation succeeds, select Create.

  10. 按步骤创建另一个 VM,其名称为 MyVM2,所有其他设置与 MyVM1 相同。Follow the steps to create a second VM named MyVM2, with all the other settings the same as MyVM1.

    对于“网络安全组”,选择“高级”后,下拉并选择已创建的“MyNetworkSecurityGroup” 。For Network Security Group, after selecting Advanced, drop down and select the MyNetworkSecurityGroup that you already created.

    在“选择后端池”,确保选中“MyBackendPool” 。Under Select a backend pool, make sure MyBackendPool is selected.

为 VM 创建 NSG 规则Create an NSG rule for the VMs

为 VM 创建网络安全组 (NSG) 规则,以允许入站 Internet (HTTP) 连接。Create a network security group (NSG) rule for the VMs to allow inbound internet (HTTP) connections.

备注

默认情况下,NSG 已有打开端口 3389(远程桌面 (RDP) 端口)的规则。By default, the NSG already has a rule that opens port 3389, the remote desktop (RDP) port.

  1. 在左侧菜单中选择“所有资源” 。Select All resources on the left menu. 在资源列表中,选择“MyResourceGroupLB”资源组中的“MyNetworkSecurityGroup”。 From the resource list, select MyNetworkSecurityGroup in the MyResourceGroupLB resource group.

  2. 在“设置”下,依次选择“入站安全规则”、“添加”。 Under Settings, select Inbound security rules, and then select Add.

  3. 在“添加入站安全规则” 对话框中,键入或选择以下内容:In the Add inbound security rule dialog, type or select the following:

    • :选择“服务标记” 。Source: Select Service Tag.
    • 源服务标记:选择“Internet” 。Source service tag: Select Internet.
    • 目标端口范围:键入 80Destination port ranges: Type 80.
    • 协议:选择“TCP” 。Protocol: Select TCP.
    • 操作:选择“允许” 。Action: Select Allow.
    • 优先级:键入 100 。Priority: Type 100.
    • 名称:键入“MyHTTPRule” 。Name: Type MyHTTPRule.
    • 说明:键入“允许 HTTP” 。Description: Type Allow HTTP.
  4. 选择“添加” 。Select Add.

    创建 NSG 规则

创建负载均衡器资源Create load balancer resources

在本节,检查负载均衡器后端池,并配置负载均衡器运行状况探测和流量规则。In this section, you inspect the load balancer back-end pool, and configure a load balancer health probe and traffic rules.

查看后端地址池View the back-end address pool

为了将流量分发到 VM,负载均衡器使用后端地址池,其中包含连接到负载均衡器的虚拟网络接口 (NIC) 的 IP 地址。To distribute traffic to the VMs, the load balancer uses a back-end address pool, which contains the IP addresses of the virtual network interfaces (NICs) that are connected to the load balancer.

创建负载均衡器后端池,并在创建 VM 后将 VM 添加到其中。You created your load balancer back-end pool and added VMs to it when you created the VMs. 还可以创建后端池,并从负载均衡器“后端池”页面添加或删除 VM 。You can also create back-end pools and add or remove VMs from the load balancer Backend pools page.

  1. 在左侧菜单中选择“所有资源”,然后在资源列表中选择“MyLoadBalancer”。 Select All resources on the left menu, and then select MyLoadBalancer from the resource list.

  2. 在“设置”下,选择“后端池”。 Under Settings, select Backend pools.

  3. 在“后端池”页上 展开 MyBackendPool,确保 VM1VM2 都已列出。On the Backend pools page, expand MyBackendPool and make sure both VM1 and VM2 are listed.

  4. 选择“MyBackendPool” 。Select MyBackendPool.

    在“MyBackendPool”页面上的“虚拟机”和“IP 地址”下,可在池中添加或删除可用的 VM 。On the MyBackendPool page, under VIRTUAL MACHINE and IP ADDRESS, you can remove or add available VMs to the pool.

可以通过在“后端池”页面上选择“添加”来创建新的后端池 。You can create new back-end pools by selecting Add on the Backend pools page.

创建运行状况探测器Create a health probe

若要允许负载均衡器监视 VM 状态,请使用运行状况探测。To allow the load balancer to monitor VM status, you use a health probe. 运行状况探测器基于其对运行状况检查的响应,从负载均衡器中动态添加或删除 VM。The health probe dynamically adds or removes VMs from the load balancer rotation based on their response to health checks.

  1. 在左侧菜单中选择“所有资源”,然后在资源列表中选择“MyLoadBalancer”。 Select All resources on the left menu, and then select MyLoadBalancer from the resource list.

  2. 在“设置”下,依次选择“运行状况探测”、“添加”。 Under Settings, select Health probes, and then select Add.

  3. 在“添加运行状况探测” 页上,键入或选择以下值:On the Add health probe page, type or select the following values:

    • 名称:键入 MyHealthProbeName: Type MyHealthProbe.
    • 协议:下拉并选择“HTTP” 。Protocol: Drop down and select HTTP.
    • 端口:键入 80Port: Type 80.
    • 路径:接受 / 作为默认 URI。Path: Accept / for the default URI. 可以将此值替换为任何其他的 URI。You can replace this value with any other URI.
    • 时间间隔:键入 15Interval: Type 15. 时间间隔是两次探测尝试之间的秒数。Interval is the number of seconds between probe attempts.
    • 不正常阈值:键入 2Unhealthy threshold: Type 2. 此值是将 VM 视为不正常之前发生的连续探测失败次数。This value is the number of consecutive probe failures that occur before a VM is considered unhealthy.
  4. 选择“确定” 。Select OK.

    添加探测

创建负载均衡器规则Create a load balancer rule

负载均衡器规则定义如何将流量分配给 VM。A load balancer rule defines how traffic is distributed to the VMs. 此规则定义传入流量的前端 IP 配置、用于接收流量的后端 IP 池,以及所需的源和目标端口。The rule defines the front-end IP configuration for incoming traffic, the back-end IP pool to receive the traffic, and the required source and destination ports.

名为 MyLoadBalancerRule 的负载均衡器规则在前端 LoadBalancerFrontEnd 中侦听端口 80。The load balancer rule named MyLoadBalancerRule listens to port 80 in the front-end LoadBalancerFrontEnd. 该规则也在端口 80 上将网络流量发送到后端地址池 MyBackendPoolThe rule sends network traffic to the back-end address pool MyBackendPool, also on port 80.

  1. 在左侧菜单中选择“所有资源”,然后在资源列表中选择“MyLoadBalancer”。 Select All resources on the left menu, and then select MyLoadBalancer from the resource list.

  2. 在“设置”下,依次选择“负载均衡规则”、“添加”。 Under Settings, select Load balancing rules, and then select Add.

  3. 在“添加负载均衡规则” 页上,键入或选择以下值:On the Add load balancing rule page, type or select the following values:

    • 名称:键入 MyLoadBalancerRuleName: Type MyLoadBalancerRule.
    • 协议:选择“TCP” 。Protocol: Select TCP.
    • 端口:键入 80Port: Type 80.
    • 后端端口:键入 80Backend port: Type 80.
    • 后端池:选择“MyBackendPool” 。Backend pool: Select MyBackendPool.
    • 运行状况探测:选择“MyHealthProbe” 。Health probe: Select MyHealthProbe.
  4. 选择“确定” 。Select OK.

    添加负载均衡器规则

创建入站 NAT 端口转发规则Create an inbound NAT port-forwarding rule

创建负载均衡器入站网络地址转换 (NAT) 规则,以将流量从前端 IP 地址的特定端口转发到后端 VM 的特定端口。Create a load balancer inbound network address translation (NAT) rule to forward traffic from a specific port of the front-end IP address to a specific port of a back-end VM.

  1. 在左侧菜单中选择“所有资源”,然后在资源列表中选择“MyLoadBalancer” 。Select All resources in the left-hand menu, and then select MyLoadBalancer from the resource list.

  2. 在“设置”下,依次选择“入站 NAT 规则”和“添加” 。Under Settings, select Inbound NAT rules, and then select Add.

  3. 在“添加入站 NAT 规则” 页上,键入或选择以下值:On the Add inbound NAT rule page, type or select the following values:

    • 名称:键入“MyNATRuleVM1” 。Name: Type MyNATRuleVM1.
    • 端口:键入 4221 。Port: Type 4221.
    • 目标虚拟机:从下拉列表中选择“MyVM1” 。Target virtual machine: Select MyVM1 from the drop-down.
    • 网络 IP 配置 :从下拉列表中选择“ipconfig1” 。Network IP Configuration: Select ipconfig1 from the drop-down.
    • 端口映射:选择“自定义” 。Port mapping: Select Custom.
    • 目标端口:键入“3389” 。Target port: Type 3389.
  4. 选择“确定” 。Select OK.

  5. 重复步骤,使用“端口” 添加名为 MyNATRuleVM2 的入站 NAT 规则:4222 和目标虚拟机:MyVM2 。Repeat the steps to add an inbound NAT rule named MyNATRuleVM2, using Port: 4222 and Target virtual machine: MyVM2.

测试负载均衡器Test the load balancer

在本节中,将在后端服务器上安装 Internet Information Services (IIS),并自定义默认网页以显示计算机名称。In this section, you'll install Internet Information Services (IIS) on the back-end servers, and customize the default web page to show the machine name. 然后,将使用负载均衡器的公共 IP 地址测试负载均衡器。Then, you'll use the load balancer's public IP address to test the load balancer.

每个后端 VM 提供不同版本的默认 IIS 网页,因此可以看到负载均衡器在两个 VM 之间分发请求。Each back-end VM serves a different version of the default IIS web page, so you can see the load balancer distribute requests between the two VMs.

通过 RDP 连接到 VMConnect to the VMs with RDP

使用远程桌面 (RDP) 连接到每个 VM。Connect to each VM with Remote Desktop (RDP).

  1. 在门户的左侧菜单中选择“所有资源” 。In the portal, select All resources on the left menu. 在资源列表中,选择“MyResourceGroupLB”资源组中的每个 VM。 From the resource list, select each VM in the MyResourceGroupLB resource group.

  2. 在“概览”页上选择“连接”,然后选择“下载 RDP 文件”。 On the Overview page, select Connect, and then select Download RDP file.

  3. 打开下载的 RDP 文件,然后选择“连接”。 Open the RDP file you downloaded, and select Connect.

  4. 在“Windows 安全性”屏幕上选择“更多选择” ,然后选择“使用其他帐户”。On the Windows Security screen, select More choices and then Use a different account.

    输入用户名 azureuser 和密码 Azure1234567,然后选择“确定”。 Enter username azureuser and password Azure1234567, and select OK.

  5. 使用“是”对任何证书请求进行响应。 Respond Yes to any certificate prompt.

    VM 桌面会在新窗口中打开。The VM desktop opens in a new window.

安装 IIS 并替换默认 IIS 网页Install IIS and replace the default IIS web page

使用 PowerShell 安装 IIS,并将默认 IIS 网页替换为显示 VM 名称的页面。Use PowerShell to install IIS and replace the default IIS web page with a page that displays the name of the VM.

  1. 在 MyVM1 和 MyVM2 上,通过“开始”菜单启动 Windows PowerShellOn MyVM1 and on MyVM2, launch Windows PowerShell from the Start menu.

  2. 运行以下命令,以便安装 IIS 并替换默认的 IIS 网页:Run the following commands to install IIS and replace the default IIS web page:

     # Install IIS
       Install-WindowsFeature -name Web-Server -IncludeManagementTools
    
     # Remove default htm file
      remove-item  C:\inetpub\wwwroot\iisstart.htm
    
     #Add custom htm file that displays server name
      Add-Content -Path "C:\inetpub\wwwroot\iisstart.htm" -Value $("Hello World from " + $env:computername)
    
    
  3. 选择“断开连接”,关闭与 MyVM1 和 MyVM2 的 RDP 连接。 Close the RDP connections with MyVM1 and MyVM2 by selecting Disconnect. 请勿关闭 VM。Don't shut down the VMs.

测试负载均衡Test load balancing

  1. 在门户的“MyLoadBalancer”的“概览”页上,复制“公共 IP 地址”下的公共 IP 地址 。In the portal, on the Overview page for MyLoadBalancer, copy the public IP address under Public IP address. 将鼠标悬停在地址上,选择“复制”图标对其进行复制。 Hover over the address and select the Copy icon to copy it. 在此示例中,它是 40.67.218.235 。In this example, it is 40.67.218.235.

  2. 将负载均衡器的公共 IP 地址 (40.67.218.235) 粘贴或键入到浏览器的地址栏中 。Paste or type the load balancer's public IP address (40.67.218.235) into the address bar of your internet browser.

    自定义的 IIS Web 服务器默认页会显示在浏览器中。The customized IIS web server default page appears in the browser. 会显示 Hello World from MyVM1Hello World from MyVM2 消息。The message reads either Hello World from MyVM1, or Hello World from MyVM2.

    新建 IIS 默认页

  3. 刷新浏览器,可以看到负载均衡器在 VM 之间分配流量。Refresh the browser to see the load balancer distribute traffic across VMs. 当负载均衡器将请求分配到每个后端 VM 时,有时会显示 MyVM1 页,有时会显示 MyVM2 页。Sometimes the MyVM1 page appears, and other times the MyVM2 page appears, as the load balancer distributes the requests to each back-end VM.

    备注

    可能需要在两次尝试之间清除浏览器缓存或打开新的浏览器窗口。You may need to clear your browser cache or open a new browser window between attempts.

测试端口转发Test port forwarding

通过端口转发,可以使用负载均衡器的 IP 地址和 NAT 规则中定义的前端端口值将桌面远程发送到后端 VM。With port forwarding, you can remote desktop to a back-end VM by using the IP address of the load balancer and the front-end port value defined in the NAT rule.

  1. 在门户的“MyLoadBalancer”的“概览”页上,复制公共 IP 地址 。In the portal, on the Overview page for MyLoadBalancer, copy its public IP address. 将鼠标悬停在地址上,选择“复制”图标对其进行复制。 Hover over the address and select the Copy icon to copy it. 在此示例中,它是 40.67.218.235 。In this example, it is 40.67.218.235.

  2. 打开命令提示符,运用负载均衡器的公共 IP 地址和在 VM 的 NAT 规则中定义的前端端口,使用下面的命令用 MyVM2 创建远程桌面会话。Open a command prompt, and use the following command to create a remote desktop session with MyVM2, using the load balancer's public IP address and the front-end port you defined in the VM's NAT rule.

    mstsc /v:40.67.218.235:4222
    
  3. 打开下载的 RDP 文件,然后选择“连接” 。Open the downloaded RDP file, and select Connect.

  4. 在“Windows 安全性”屏幕上选择“更多选择” ,然后选择“使用其他帐户”。On the Windows Security screen, select More choices and then Use a different account.

    输入用户名 azureuser 和密码 Azure1234567,然后选择“确定”。 Enter username azureuser and password Azure1234567, and select OK.

  5. 使用“是”对任何证书请求进行响应。 Respond Yes to any certificate prompt.

    MyVM2 桌面会在新窗口中打开。The MyVM2 desktop opens in a new window.

RDP 连接成功,因为入站 NAT 规则“MyNATRuleVM2”将流量从负载均衡器的前端端口 4222 定向到 MyVM2 的端口 3389(RDP 端口) 。The RDP connection succeeds, because the inbound NAT rule MyNATRuleVM2 directs traffic from the load balancer's front-end port 4222 to MyVM2's port 3389 (the RDP port).

清理资源Clean up resources

若要在不再需要的情况下删除负载均衡器和所有相关的资源,请打开 MyResourceGroupLB 资源组,然后选择“删除资源组”。 To delete the load balancer and all related resources when you no longer need them, open the MyResourceGroupLB resource group and select Delete resource group.