配置 Azure 负载均衡器的 TCP 重置和空闲超时Configure TCP reset and idle timeout for Azure Load Balancer

Azure 负载均衡器的空闲超时范围如下所示:Azure Load Balancer has the following idle timeout range:

  • 出站规则需要 4 分钟到 100 分钟4 minutes to 100 minutes for Outbound Rules
  • 负载均衡器规则和入站 NAT 规则需要 4 到 30 分钟4 minutes to 30 minutes for Load Balancer rules and Inbound NAT rules

它默认设置为 4 分钟。By default, it's set to 4 minutes. 如果处于非活动状态的时间超过超时值,则不能保证在客户端和服务之间保持 TCP 或 HTTP 会话。If a period of inactivity is longer than the timeout value, there's no guarantee that the TCP or HTTP session is maintained between the client and your service.

以下部分介绍如何更改负载均衡器资源的空闲超时和 TCP 重置设置。The following sections describe how to change idle timeout and tcp reset settings for load balancer resources.

设置 TCP 重置和空闲超时Set tcp reset and idle timeout


若要设置负载均衡器的空闲超时和 TCP 重置,请编辑负载均衡规则。To set the idle timeout and tcp reset for a load balancer, edit the load-balanced rule.

  1. 登录 Azure 门户Sign in to the Azure portal.

  2. 在左侧菜单中,选择“资源组”。In the left-hand menu, select Resource groups.

  3. 选择负载均衡器的资源组。Select the resource group for your load balancer. 在本示例中,资源组的名称为 myResourceGroup。In this example, the resource group is named myResourceGroup.

  4. 选择你的负载均衡器。Select your load balancer. 在本示例中,负载均衡器的名称为 myLoadBalancer。In this example, the load balancer is named myLoadBalancer.

  5. 在“设置”中,选择“负载均衡规则” 。In Settings, select Load balancing rules.

    编辑负载均衡器规则。

  6. 选择负载均衡规则。Select your load-balancing rule. 在本示例中,负载均衡规则的名称为 myLBrule。In this example, the load-balancing rule is named myLBrule.

  7. 在负载均衡规则中,将“空闲超时(分钟)”中的滑块移动到超时值。In the load-balancing rule, move the slider in Idle timeout (minutes) to your timeout value.

  8. 在“TCP 重置”下,选择“启用” 。Under TCP reset, select Enabled.

    设置空闲超时和 TCP 重置。

  9. 选择“保存”。Select Save.

后续步骤Next steps

有关 TCP 空闲超时和重置的详细信息,请参阅负载均衡器 TCP 重置和空闲超时For more information on tcp idle timeout and reset, see Load Balancer TCP Reset and Idle Timeout

有关配置负载均衡器分发模式的详细信息,请参阅配置负载均衡器分发模式For more information on configuring the load balancer distribution mode, see Configure a load balancer distribution mode.