Azure 负载均衡器门户设置Azure Load Balancer portal settings

创建 Azure 负载均衡器时,可以通过本文中的信息详细了解各个设置以及适合自己的配置。As you create Azure Load Balancer, information in this article will help you learn more about the individual settings and what the right configuration is for you.

创建负载均衡器Create load balancer

Azure 负载均衡器是一个网络负载均衡器,用于在后端池中的 VM 实例之间分配流量。Azure Load Balancer is a network load balancer that distributes traffic across VM instances in the backend pool.

基础Basics

在“创建负载均衡器”门户页的“基本信息”选项卡中,可以看到以下信息:In the Basics tab of the create load balancer portal page, you'll see the following information:

设置Setting 详细信息Details
订阅Subscription 选择订阅。Select your subscription. 此选择是你要在其中部署负载平衡器的订阅。This selection is the subscription you want your load balancer to be deployed in.
资源组Resource group 选择“新建”并在文本框中键入资源组的名称。Select Create new and type in the name for your resource group in the text box. 如果有现有的已创建资源组,请选择它。If you have an existing resource group created, select it.
名称Name 此设置是 Azure 负载均衡器的名称。This setting is the name for your Azure Load Balancer.
区域Region 选择要在其中部署负载均衡器的 Azure 区域。Select an Azure region you'd like to deploy your load balancer in.
类型Type 负载均衡器有两种类型:Load balancer has two types:
内部(专用)Internal (Private)
公共(外部)。Public (External).
内部负载均衡器 (ILB) 通过专用 IP 地址将流量路由到后端池成员。An internal load balancer (ILB) routes traffic to backend pool members via a private IP address.
公共负载均衡器通过 Internet 将来自客户端的请求定向到后端池。A public load balancer directs requests from clients over the internet to the backend pool.
详细了解负载均衡器类型Learn more about load balancer types.
SKUSKU 选择“标准”。Select Standard.
负载均衡器有两种 SKU:“基本”和“标准” 。Load balancer has two SKUs: Basic and Standard.
基本 SKU 的功能有限。Basic has limited functionality.
对于生产型工作负载,建议使用标准 SKU。Standard is recommended for production workloads.
详细了解 SKULearn more about SKUs.

如果选择“公共”作为类型,则会看到以下信息:If you select Public as your type, you'll see the following information:

设置Setting 详细信息Details
公共 IP 地址Public IP address 选择“新建”可创建公共负载均衡器的公共 IP 地址。Select Create new to create a public IP address for your public load balancer.
如果有现有的公共 IP,请选择“使用现有项”。If you have an existing public IP, select Use existing.
公共 IP 地址名称Public IP address name 公共 IP 地址的名称。The name of the public IP address.
公用 IP 地址 SKUPublic IP address SKU 公共 IP 地址有两个 SKU:“基本”和“标准” 。Public IP addresses have two SKUs: Basic and Standard.
对于生产型工作负载,建议使用标准 SKU。Standard is recommended for production workloads.
负载均衡器和公共 IP 地址 SKU 必须匹配。Load balancer and public IP address SKUs must match.
分配Assignment 对于标准 SKU,会自动选择“静态”。Static is auto selected for standard.
基本公共 IP 有两种类型:“动态”和“静态”。Basic public IPs have two types: Dynamic and Static.
动态公共 IP 地址在创建之前不会进行分配。Dynamic public IP addresses aren't assigned until creation.
如果删除了资源,则可能会丢失 IP。IPs can be lost if the resource is deleted.
建议使用静态 IP 地址。Static IP addresses are recommended.
添加一个公共 IPv6 地址Add a public IPv6 address 负载均衡器支持将 IPv6 地址用于前端。Load balancer supports IPv6 addresses for your frontend.
详细了解负载平衡器和 IPv6Learn more about load Balancer and IPv6

创建公共负载均衡器。

如果在“类型”中选择“内部”,则会看到以下信息:If you select Internal in Type, you'll see the following information:

设置Setting 详细信息Details
虚拟网络Virtual network 你希望自己的内部负载均衡器能够成为其一部分的虚拟网络。The virtual network you want your internal load balancer to be part of.
为内部负载均衡器选择的专用前端 IP 地址将来自此虚拟网络。The private frontend IP address you select for your internal load balancer will be from this virtual network.
IP 地址分配IP address assignment 选项为“静态”或“动态”。Your options are Static or Dynamic.
“静态”可确保 IP 不会更改。Static ensures the IP doesn't change. 动态 IP 地址可能会更改。A dynamic IP could change.

创建公共负载均衡器。

前端 IP 配置Frontend IP configuration

Azure 负载均衡器的 IP 地址。The IP address of your Azure Load Balancer. 这是客户端的联系点。It's the point of contact for clients.

可以有一个或多个前端 IP 配置。You can have one or many frontend IP configurations. 如果已完成上述的基本信息部分,则已为负载均衡器创建了前端。If you went through the basics section above, you would have already created a frontend for your load balancer.

如果要将前端 IP 配置添加到负载均衡器,请转到 Azure 门户中的负载均衡器,选择“前端 IP 配置”,然后选择“+添加”。 If you want to add a frontend IP configuration to your load balancer, go to your load balancer in the Azure portal, select Frontend IP configuration, and then select +Add.

设置Setting 详细信息Details
名称Name 前端 IP 配置的名称。The name of your frontend IP configuration.
IP 版本IP version 希望前端使用的 IP 地址版本。The IP address version you'd like your frontend to have.
负载均衡器支持 IPv4 和 IPv6 前端 IP 配置。Load balancer supports both IPv4 and IPv6 frontend IP configurations.
IP 类型IP type IP 类型决定了单个 IP 地址是与前端关联,还是与使用某个 IP 前缀的 IP 地址范围关联。IP type determines if a single IP address is associated with your frontend or a range of IP addresses using an IP Prefix.
在需要重复连接到同一终结点时,可以使用公共 IP 前缀A public IP prefix assists when you need to connect to the same endpoint repeatedly. 前缀可确保提供足够的端口来帮助解决 SNAT 端口问题。The prefix ensures enough ports are given to assist with SNAT port issues.
公共 IP 地址(或前缀,前提是选择了上述前缀)Public IP address (or Prefix if you selected prefix above) 为负载均衡器前端选择或创建新的公共 IP(或前缀)。Select or create a new public IP (or prefix) for your load balancer frontend.

创建公共负载均衡器。

后端池Backend pools

后端地址池包含后端池中虚拟网络接口的 IP 地址。A backend address pool contains the IP addresses of the virtual network interfaces in the backend pool.

如果要将后端池添加到负载均衡器,请转到 Azure 门户中的负载均衡器,选择“后端池”,然后选择“+添加”。 If you want to add a backend pool to your load balancer, go to your load balancer in the Azure portal, select Backend pools, and then select +Add.

设置Setting 详细信息Details
名称Name 后端池的名称。The name of your backend pool.
虚拟网络Virtual network 后端实例所在的虚拟网络。The virtual network your backend instances are.
IP 版本IP version 选项为“IPv4”或“IPv6”。Your options are IPv4 or IPv6.

可以将虚拟机或虚拟机规模集添加到 Azure 负载均衡器的后端池。You can add virtual machines or virtual machine scale sets to the backend pool of your Azure Load Balancer. 首先创建虚拟机或虚拟机规模集。Create the virtual machines or virtual machine scale sets first. 接下来,在门户中将其添加到负载均衡器。Next, add them to the load balancer in the portal.

创建公共负载均衡器。

运行状况探测Health probes

运行状况探测用于监视后端 VM 或实例的状态。A health probe is used to monitor the status of your backend VMs or instances. 运行状况探测状态决定了根据运行状况检查将新连接发送到实例的时间。The health probe status determines when new connections are sent to an instance based on health checks.

如果要将运行状况探测添加到负载均衡器,请在 Azure 门户中转到你的负载均衡器,选择“运行状况探测”,然后选择“+添加”。 If you want to add a health probe to your load balancer, go to your load balancer in the Azure portal, select Health probes, then select +Add.

设置Setting 详细信息Details
名称Name 运行状况探测的名称。The name of your health probe.
协议Protocol 你选择的协议所确定的检查类型用于确定后端实例是否正常。The protocol you select determines the type of check used to determine if the backend instance(s) are healthy.
你的选项为:Your options are:
TCPTCP
HTTPSHTTPS
HTTPHTTP
确保使用正确的协议。Ensure you're using the right protocol. 此选择将取决于应用程序的性质。This selection will depend on the nature of your application.
运行状况探测的配置和探测响应确定哪些后端池实例将接收新流。The configuration of the health probe and probe responses determines which backend pool instances will receive new flows.
可以使用运行状况探测来检测后端终结点上应用程序的故障。You can use health probes to detect the failure of an application on a backend endpoint.
详细了解运行状况探测Learn more about health probes.
端口Port 运行状况探测的目标端口。The destination port for the health probe.
此设置是后端实例上的端口,可供运行状况探测用于确定实例的运行状况。This setting is the port on the backend instance the health probe will use to determine the instance's health.
时间间隔Interval 两次探测尝试之间的秒数。The number of seconds in between probe attempts.
该间隔将确定运行状况探测尝试访问后端实例的频率。The interval will determine how frequently the health probe will attempt to reach the backend instance.
如果选择 5,则会在 5 秒后进行第二次探测尝试,依此类推。If you select 5, the second probe attempt will be made after 5 seconds and so on.
不正常阈值Unhealthy threshold 在将 VM 视为不正常之前必须发生的连续探测失败次数。The number of consecutive probe failures that must occur before a VM is considered unhealthy.
如果选择 2,则在连续两次失败后,不会将新流设置为此后端实例。If you select 2, no new flows will be set to this backend instance after two consecutive failures.

创建公共负载均衡器。

负载均衡规则Load-balancing rules

定义将传入的流量分配至后端池中所有实例的方式。Defines how incoming traffic is distributed to all the instances within the backend pool. 负载均衡规则将给定的前端 IP 配置和端口映射到多个后端 IP 地址和端口。A load-balancing rule maps a given frontend IP configuration and port to multiple backend IP addresses and ports.

如果要将负载均衡器规则添加到负载均衡器,请在 Azure 门户中转到你的负载均衡器,选择“负载均衡规则”,然后选择“+添加”。 If you want to add a load balancer rule to your load balancer, go to your load balancer in the Azure portal, select Load-balancing rules, and then select +Add.

设置Setting 详细信息Details
名称Name 负载均衡器规则的名称。The name of the load balancer rule.
IP 版本IP Version 选项为“IPv4”或“IPv6”。Your options are IPv4 or IPv6.
前端 IP 地址Frontend IP address 选择前端 IP 地址。Select the frontend IP address.
要将负载均衡器规则与之关联的负载均衡器的前端 IP 地址。The frontend IP address of your load balancer you want the load balancer rule associated to.
协议Protocol Azure 负载均衡器是第 4 层网络负载均衡器。Azure Load Balancer is a layer 4 network load balancer.
选项包括:TCP 或 UDP。Your options are: TCP or UDP.
端口Port 此设置是与你希望根据此负载均衡规则分配流量的前端 IP 关联的端口。This setting is the port associated with the frontend IP that you want traffic to be distributed based on this load-balancing rule.
后端端口Backend port 此设置是你想要负载均衡器将流量发送到的后端池中的实例上的端口。This setting is the port on the instances in the backend pool you would like the load balancer to send traffic to. 此设置可以与前端端口相同,也可以与前端端口不同(如果你需要为你的应用程序提供的灵活性)。This setting can be the same as the frontend port or different if you need the flexibility for your application.
后端池Backend pool 你希望此负载均衡器规则应用到的后端池。The backend pool you would like this load balancer rule to be applied on.
运行状况探测Health probe 你已创建的运行状况探测,用于检查后端池中实例的状态。The health probe you created to check the status of the instances in the backend pool.
只有正常的实例才会接收新流量。Only healthy instances will receive new traffic.
会话暂留Session persistence 你的选项为:Your options are:
None
客户端 IPClient IP
客户端 IP 和协议Client IP and protocol

保持从客户端到后端池中同一虚拟机的流量。Maintain traffic from a client to the same virtual machine in the backend pool. 将在会话的持续时间内保持此流量。This traffic will be maintained for the duration of the session.
“无”指定任何虚拟机可以处理来自同一客户端的后续请求。None specifies that successive requests from the same client may be handled by any virtual machine.
“客户端 IP”指定来自同一客户端 IP 地址的后续请求将由同一虚拟机处理。Client IP specifies that successive requests from the same client IP address will be handled by the same virtual machine.
“客户端 IP 和协议”确保来自同一客户端 IP 地址和协议的连续请求将由同一虚拟机处理。Client IP and protocol ensure that successive requests from the same client IP address and protocol will be handled by the same virtual machine.
详细了解分配模式Learn more about distribution modes.
空闲超时(分钟)Idle timeout (minutes) 保持 TCP 或 HTTP 连接打开,而不依赖于客户端发送“保持活动状态”消息Keep a TCP or HTTP connection open without relying on clients to send keep-alive messages
TCP 重置TCP reset 负载均衡器可以发送 TCP 重置,这有助于创建可预测性更高的应用程序行为(在连接空闲时发生)。Load balancer can send TCP resets to help create a more predictable application behavior on when the connection is idle.
详细了解 TCP 重置Learn more about TCP reset
浮动 IPFloating IP “浮动 IP”是 Azure 的术语,表示所谓的“直接服务器返回 (DSR)”的一部分。Floating IP is Azure's terminology for a portion of what is known as Direct Server Return (DSR).
DSR 由两个部分组成:DSR consists of two parts:
1.流拓扑1. Flow topology
2.平台级别的 IP 地址映射方案。2. An IP address-mapping scheme at a platform level.

Azure 负载均衡器始终在 DSR 流拓扑中运行,不管是否启用了浮动 IP。Azure Load Balancer always operates in a DSR flow topology whether floating IP is enabled or not.
此操作意味着,流的出站部分始终会正确重写为直接流回到源。This operation means that the outbound part of a flow is always correctly rewritten to flow directly back to the origin.
如果不使用浮动 IP,则 Azure 会公开传统的负载均衡 IP 地址映射方案,即 VM 实例的 IP。Without floating IP, Azure exposes a traditional load-balancing IP address-mapping scheme, the VM instances' IP.
启用浮动 IP 会更改向负载均衡器前端 IP 进行的 IP 地址映射,以实现更大的灵活性。Enabling floating IP changes the IP address mapping to the frontend IP of the load Balancer to allow for additional flexibility.
有关详细信息,请参阅 Azure 负载均衡器的多个前端For more information, see Multiple frontends for Azure Load Balancer.
创建隐式出站规则Create implicit outbound rules 请选择“否”。Select No.
默认设置:disableOutboundSnat = falseDefault: disableOutboundSnat = false
在这种情况下,出站通过同一前端 IP 发生。In this case outbound occurs via same frontend IP.

disableOutboundSnat = truedisableOutboundSnat = true
在这种情况下,出站规则是出站所需的。In this case, outbound rules are needed for outbound.

创建公共负载均衡器。

入站 NAT 规则Inbound NAT rules

入站 NAT 规则将转发发送到前端 IP 地址和端口组合的传入流量。An inbound NAT rule forwards incoming traffic sent to frontend IP address and port combination.

该流量将被转发到后端池中的特定虚拟机或实例。The traffic is sent to a specific virtual machine or instance in the backend pool. 可以通过与负载均衡相同的基于哈希的分配来实现此端口转发。Port forwarding is done by the same hash-based distribution as load balancing.

如果你的方案需要远程桌面协议 (RDP) 或安全外壳 (SSH) 会话对后端池中的 VM 实例进行分隔。If your scenario requires Remote Desktop Protocol (RDP) or Secure Shell (SSH) sessions to separate VM instances in a backend pool. 可将多个内部终结点映射到同一前端 IP 地址上的端口。Multiple internal endpoints can be mapped to ports on the same frontend IP address.

可以使用前端 IP 地址来远程管理 VM,无需额外的跳转盒。The frontend IP addresses can be used to remotely administer your VMs without an additional jump box.

如果要将入站 NAT 规则添加到负载均衡器,请在 Azure 门户中转到你的负载均衡器,选择“入站 NAT 规则”,然后选择“+添加”。 If you want to add an inbound nat rule to your load balancer, go to your load balancer in the Azure portal, select Inbound NAT rules, and then select +Add.

设置Setting 详细信息Details
名称Name 入站 NAT 规则的名称The name of your inbound NAT rule
前端 IP 地址Frontend IP address 选择前端 IP 地址。Select the frontend IP address.
要将入站 NAT 规则与之关联的负载均衡器的前端 IP 地址。The frontend IP address of your load balancer you want the inbound NAT rule associated to.
IP 版本IP Version 选项为“IPv4”和“IPv6”。Your options are IPv4 and IPv6.
服务Service 你将在 Azure 负载均衡器上运行的服务的类型。The type of service you'll be running on Azure Load Balancer.
此处的选择将相应地更新端口信息。A selection here will update the port information appropriately.
协议Protocol Azure 负载均衡器是第 4 层网络负载均衡器。Azure Load Balancer is a layer 4 network load balancer.
选项包括:TCP 或 UDP。Your options are: TCP or UDP.
空闲超时(分钟)Idle timeout (minutes) 保持 TCP 或 HTTP 连接打开,而不依赖于客户端发送“保持活动状态”消息。Keep a TCP or HTTP connection open without relying on clients to send keep-alive messages.
TCP 重置TCP Reset 负载均衡器可以发送 TCP 重置,这有助于创建可预测性更高的应用程序行为(在连接空闲时发生)。Load Balancer can send TCP resets to help create a more predictable application behavior on when the connection is idle.
详细了解 TCP 重置Learn more about TCP reset
端口Port 此设置是与你希望根据此入站 NAT 规则分配流量的前端 IP 关联的端口。This setting is the port associated with the frontend IP that you want traffic to be distributed based on this inbound NAT rule.
目标虚拟机Target virtual machine 你希望将此规则与之关联的后端池的虚拟机部分。The virtual machine part of the backend pool you would like this rule to be associated to.
端口映射Port mapping 此设置可以是默认设置,也可以是自定义设置,具体取决于应用程序首选项。This setting can be default or custom based on your application preference.

创建公共负载均衡器。

出站规则Outbound rules

负载均衡器出站规则为后端池中的 VM 配置出站 SNAT。Load balancer outbound rules configure outbound SNAT for VMs in the backend pool.

如果要将出站规则添加到负载均衡器,请在 Azure 门户中转到你的负载均衡器,选择“出站规则”,然后选择“+添加”。 If you want to add an outbound rule to your load balancer, go to your load balancer in the Azure portal, select Outbound rules, and then select +Add.

设置Setting 详细信息Details
名称Name 出站规则的名称。The name of your outbound rule.
前端 IP 地址Frontend IP address 选择前端 IP 地址。Select the frontend IP address.
要将出站规则与之关联的负载均衡器的前端 IP 地址。The frontend IP address of your load balancer you want the outbound rule to be associated to.
协议Protocol Azure 负载均衡器是第 4 层网络负载均衡器。Azure Load Balancer is a layer 4 network load balancer.
选项包括:“所有”、“TCP”或“UDP”。Your options are: All, TCP, or UDP.
空闲超时(分钟)Idle timeout (minutes) 保持 TCP 或 HTTP 连接打开,而不依赖于客户端发送“保持活动状态”消息。Keep a TCP or HTTP connection open without relying on clients to send keep-alive messages.
TCP 重置TCP Reset 负载均衡器可以发送 TCP 重置,这有助于创建可预测性更高的应用程序行为(在连接空闲时发生)。Load balancer can send TCP resets to help create a more predictable application behavior on when the connection is idle.
详细了解 TCP 重置Learn more about TCP reset
后端池Backend pool 你希望将此出站规则应用到的后端池。The backend pool you would like this outbound rule to be applied on.

端口分配Port allocation

设置Setting 详细信息Details
端口分配Port allocation 建议选择“手动选择出站端口数”。We recommend selecting Manually choose number of outbound ports.

出站端口Outbound ports

设置Setting 详细信息Details
选择依据Choose by 选择“每个实例的端口数”Select Ports per instance
每个实例的端口数Ports per instance 输入 10,000。Enter 10,000.

创建公共负载均衡器。

后续步骤Next Steps

本文介绍了 Azure 门户中 Azure 负载均衡器的不同术语和设置。In this article, you learned about the different terms and settings in the Azure portal for Azure Load Balancer.