Windows TCP 拥塞控制算法
BBR
- https://zhuanlan.zhihu.com/p/543011535
- https://github.com/google/bbr
说明:WIN10专业版,前几日访问油管connection speed一直缓冲,换一台电脑马上速度飙到几万,另外也有童鞋提醒跟本地网络有关。经过1天多的各种尝试,终于找到解决方案,就是调节了TCP 全局参数 ,现在的速度提升50%。现提供方法给大家参考。
管理员运行cmd,运行以下命令:
netsh int tcp show global
TCP 全局参数
----------------------------------------------
接收方缩放状态 : enabled
接收窗口自动调节级别 : normal
加载项拥塞控制提供程序 : default
ECN 功能 : disabled
RFC 1323 时间戳 : enabled
初始 RTO : 1000
接收段合并状态 : enabled
非 Sack Rtt 复原 : disabled
最大 SYN 重新传输次数 : 4
快速打开 : enabled
快速打开回退 : enabled
HyStart : enabled
比例费率降低 : enabled
节奏配置文件 : off
修改以下几项,解决了网速慢的问题,命令都是在CMD中输入,然后重启。
直接缓存访问(DCA):
netsh int tcp set global dca=enabled
接收窗口自动调谐级别:
netsh int tcp set global autotuninglevel=normal
附加拥塞控制提供程序
netsh int tcp set supplemental template=internet congestionprovider=ctcp
RFC 1323 时间戳:
netsh int tcp set global timestamps=enabled
Benchmark of BBR
https://arxiv.org/pdf/1810.13241.pdf
Linux上有bbr,windows上也有ctcp
使用管理员模式在命令模式下运行
netsh int tcp set supplemental template=internet congestionprovider=ctcp
xxxxxxxxxx [root@Jaking11 ~]# ifconfigeth0: flags=4163 mtu 1500 inet 192.168.10.11 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::250:56ff:fe29:eae prefixlen 64 scopeid 0x20 ether 00:50:56:29:0e:ae txqueuelen 1000 (Ethernet) RX packets 86 bytes 10889 (10.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 95 bytes 10828 (10.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0text
默认是下面的cubic。现在运行下命令就改成了ctcp

另外我看了下 powershell下面可以用下面的命令,好像是因为新系统下面netsh命令已经没用了
Set-NetTCPSetting -SettingName “InternetCustom” -CongestionProvider CTCP -InitialCongestionWindowMss 6

显示windows所有TCP设置参数
在CMD命令行输入以下命令 netsh int tcp show global
C:\Users\admin>netsh int tcp show global
查询活动状态...
TCP 全局参数
----------------------------------------------
接收方缩放状态 : enabled
烟囱卸载状态 : automatic
NetDMA 状态 : enabled
直接缓存访问(DCA) : enabled
接收窗口自动调谐级别 : normal
附加拥塞控制提供程序 : ctcp
ECN 功能 : disabled
RFC 1323 时间戳 : enabled
TCP优化设置命令
直接缓存访问(DCA):netsh int tcp set global dca=enabled
接收窗口自动调谐级别:netsh int tcp set global autotuninglevel=normal
附加拥塞控制提供程序:netsh interface tcp set global congestionprovider=ctcp
win10附加拥塞控制:netsh int tcp set supplemental template=internet congestionprovider=ctcp
RFC 1323 时间戳:netsh int tcp set global timestamps=enabled
一定要关闭ECN
ECN为显式拥塞通知.
启用ECN可以告知对方主机拥塞状况,好处是让网络曲线更平滑.
然而,大多数主机并没有启用ECN,一旦启用就会增加等待超时时间,反而降低了网络性能
netsh int tcp set global ecn=disable
Setting
netsh int ip set global congestprovider=CTCP
Set-NetTCPSetting -SettingName "InternetCustom" -CongestionProvider CTCP -InitialCongestionWindowMss 6
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nsi\{eb004a03-9b1a-11d4-9123-0050047759bc}\0]
"0200"=hex:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"1700"=hex:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
https://www.speedguide.net/forums/showthread.php?291853-Bypass-Windows-10-Restrictions-(Templates-CongestionProvider)-etc
BBR2
netsh int tcp set supplemental Template=Internet CongestionProvider=bbr2
netsh int tcp set supplemental Template=Datacenter CongestionProvider=bbr2
netsh int tcp set supplemental Template=Compat CongestionProvider=bbr2
netsh int tcp set supplemental Template=DatacenterCustom CongestionProvider=bbr2
netsh int tcp set supplemental Template=InternetCustom CongestionProvider=bbr2
Registry
https://www.speedguide.net/articles/windows-10-manual-tcpip-registry-tweaks-7507
References
https://techcommunity.microsoft.com/t5/networking-blog/windows-transport-converges-on-two-congestion-providers-cubic/ba-p/339819
https://lxadm.com/netsh-int-tcp-set-global-congestionprovider-ctcp/
https://learn.microsoft.com/en-us/powershell/module/nettcpip/set-nettcpsetting?view=windowsserver2022-ps
https://www.oocolo.com/886.html
https://www.azurew.com/windows/windows-server-2016/8703.html
https://itren.org/501.html
https://www.haah.net/archives/8817.html
https://stackoverflow.com/questions/60159716/how-to-enable-tcp-bbr-on-windows/75556970#75556970
https://islun.com/660/