Azure VM TCP 空闲超时

Azure VM TCP idle timeout

我在 Azure VM 上设置 FTP 服务器时遇到问题。 在正常使用中,服务器运行良好。通过被动 FTP 连接传输大文件会出现问题。

设置

FTP-服务器软件是FileZilla Server。 Azure VM 端点、Windows 防火墙和 Filezilla 配置为使用端口 10000-10009 进行被动连接。 客户端是第 3 方设备。

问题

在持续时间超过 4 分钟的大型文件传输中,连接会出现空闲超时。

我找到了一个 Microsoft 博客条目,其中写道:

"When FTP is transferring large files, the elapsed time for transfer may exceed 4 minutes, especially if the VM size is A0. Any time the file transfer exceeds 4 minutes, the Azure SLB will time out the idle TCP/21 connection, which causes issues with cleanly finishing up the FTP transfer once all the data has been transferred. [..] Basically, FTP uses TCP/21 to set everything up and begin the transfer of data. The transfer of data happens on another port. The TCP/21 connection goes idle for the duration of the transfer on the other port. When the transfer is complete, FTP tries to send data on the TCP/21 connection to finish up the transfer, but the SLB sends a TCP reset instead."

现在...对于我的第 3 方客户端,是否无法将其设置为发送 TCP keepalive 命令以避免空闲超时。

问题

如何告诉 Azure VM 在 4 分钟后不要关闭 idel TCP 连接?

我什至不明白为什么会这样,因为这违反了 TCP 规范(RFC 5382 使它特别清楚它的 2h 4m 在正常情况下)。换句话说,过早丢弃空闲连接的 Azure 不能用于长 FTP 传输。

请帮忙!

此致

斯蒂芬

我使用的是最新版本的 Filezilla (3.14.1),您可以将 Filezilla 设置为发送 Keep-Alive 数据包,建议您先尝试这样做,而不是尝试更改默认的 Azure 负载-平衡器超时。但是,负载平衡器超时是用户可配置的(即:在您的控制之下),可以在此处找到详细信息:https://azure.microsoft.com/en-us/documentation/articles/load-balancer-tcp-idle-timeout/

要在 Filezilla 中设置保持活动命令:

•打开 FileZilla "Edit" 菜单和 select "Settings." 在 Mac 上,打开 "FileZilla" 菜单并选择 "Preferences."

•Select 设置对话框 "Connection" 部分中的 "FTP" 页面。查找页面的 "FTP Keep-Alive" 部分。

•激活"FTP Keep-alive" 部分中的"Send FTP keep-alive commands" 框。这会以短时间间隔在 FileZilla 和 FTP 服务器之间发送命令,重置超时功能并防止服务器关闭连接。

希望对您有所帮助。

我找到了两个解决方案!

1. 最多可以将 VM 端点的超时设置为 30 分钟。

执行此操作的 Powershell 命令是:

> Get-AzureVM -ServiceName "MyService" -Name "MyVM" | Set-AzureEndpoint -Name "MyEndpoint" -IdleTimeoutInMinutes 30 | Update-AzureVM

更多信息here

2.创建ILIP(实例级IP)

您可以创建一个 ILIP 来绕过 VM webservice enpoint 层。执行此操作的 PowerShell 命令是:

Get-AzureVM -ServiceName “MyService” -Name “MyVM” | Set-AzurePublicIP -PublicIPName "MyNewEndpoint" | Update-AzureVM

更多信息here