![Windows 10 和 Linux 服务器之间 TCP 窗口缩放不起作用](https://linux22.com/image/752033/Windows%2010%20%E5%92%8C%20Linux%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B9%8B%E9%97%B4%20TCP%20%E7%AA%97%E5%8F%A3%E7%BC%A9%E6%94%BE%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我们在运行 Windows 10 的几个客户端从我们的 HTTP 文件传送服务器下载文件时遇到了一些问题。
我们无法在我们这边重现该错误,但注意到 TCP 窗口缩放并未“增加”,并且 Linux 服务器和 Windows 10 客户端之间的吞吐量仍然很低。
我们在服务器上运行了 TCPDUMP,捕获来自客户端的数据包,并可以看到小窗口大小:
例子:
00:00:00.321292 IP 85.144.19.44.58799 > 195.224.144.66.80: Flags [.], ack 554881, win 1025, options [nop,nop,sack 1 {556241:564401}], length 0
00:00:00.321348 IP 85.144.19.44.58799 > 195.224.144.66.80: Flags [.], ack 554881, win 1025, options [nop,nop,sack 1 {556241:565761}], length 0
00:00:00.321359 IP 195.224.144.66.80 > 85.144.19.44.58799: Flags [.], seq 590241:591601, ack 702, win 30, length 1360: HTTP
00:00:00.322417 IP 85.144.19.44.58799 > 195.224.144.66.80: Flags [.], ack 554881, win 1025, options [nop,nop,sack 1 {556241:572561}], length 0
00:00:00.322482 IP 85.144.19.44.58799 > 195.224.144.66.80: Flags [.], ack 554881, win 1025, options [nop,nop,sack 1 {556241:573921}], length 0
00:00:00.322497 IP 195.224.144.66.80 > 85.144.19.44.58799: Flags [.], seq 595681:597041, ack 702, win 30, length 1360: HTTP
00:00:00.322528 IP 85.144.19.44.58799 > 195.224.144.66.80: Flags [.], ack 554881, win 1025, options [nop,nop,sack 1 {556241:575281}], length 0
00:00:00.322559 IP 195.224.144.66.80 > 85.144.19.44.58799: Flags [.], seq 597041:598401, ack 702, win 30, length 1360: HTTP
00:00:00.322570 IP 85.144.19.44.58799 > 195.224.144.66.80: Flags [.], ack 554881, win 1025, options [nop,nop,sack 1 {556241:576641}], length 0
00:00:00.322983 IP 85.144.19.44.58799 > 195.224.144.66.80: Flags [.], ack 554881, win 1025, options [nop,nop,sack 1 {556241:578001}], length 0
00:00:00.323007 IP 195.224.144.66.80 > 85.144.19.44.58799: Flags [.], seq 598401:599761, ack 702, win 30, length 1360: HTTP
00:00:00.323015 IP 85.144.19.44.58799 > 195.224.144.66.80: Flags [.], ack 554881, win 1025, options [nop,nop,sack 1 {556241:579361}], length 0
00:00:00.323026 IP 195.224.144.66.80 > 85.144.19.44.58799: Flags [.], seq 599761:601121, ack 702, win 30, length 1360: HTTP
00:00:00.323268 IP 85.144.19.44.58799 > 195.224.144.66.80: Flags [.], ack 587521, win 1025, length 0
00:00:00.332204 IP 85.144.19.44.58799 > 195.224.144.66.80: Flags [.], ack 591601, win 1025, length 0
00:00:00.332242 IP 195.224.144.66.80 > 85.144.19.44.58799: Flags [.], seq 606561:609281, ack 702, win 30, length 2720: HTTP
注意小窗口尺寸(1025)。
我们已经使用我们网络上的另一台服务器(macOS)测试了 Windows 10 客户端吞吐量,并且可以获得完整的吞吐量以及增加的缩放窗口大小,因此问题似乎是该 Linux 服务器所特有的。
我们对此特定 Linux 服务器上的网络堆栈进行了一些更改,并将其包含在 sysctl.conf 中:
kernel.panic = 3
net.core.somaxconn = 1024
net.ipv4.tcp_ecn = 0
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_mtu_probing = 1
vm.swappiness = 1
net.ipv4.tcp_syncookies = 0
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.route.flush = 1
net.ipv6.route.flush = 1
有谁知道为什么 Windows 10 无法与我们的 Linux 机器协商更好的 TCP 窗口大小?如上所述,这不是中间盒的问题,我们可以通过在同一个交付网络上使用不同的服务器进行测试来实现完全吞吐量。只是这台特定的机器。
我们将非常感激您提前提出的任何想法、反馈、提示和建议。
非常感谢。