Debian 9/10 开启 Google TCP BBR

1. 运行

sysctl net.ipv4.tcp_congestion_control

输出

net.ipv4.tcp_congestion_control = cubic

2. 运行

sysctl net.ipv4.tcp_available_congestion_control

输出

net.ipv4.tcp_available_congestion_control = reno cubic

开启BBR

命令行依次输入

grep -qxF 'net.core.default_qdisc=fq' /etc/sysctl.conf || echo 'net.core.default_qdisc=fq' >> /etc/sysctl.conf
grep -qxF 'net.ipv4.tcp_congestion_control=bbr' /etc/sysctl.conf || echo 'net.ipv4.tcp_congestion_control=bbr' >> /etc/sysctl.conf
sysctl -p

如果配置文件中不存在以上相关配置,则新增。其中-q表示静默方式查找,-x表示匹配整行…
如果提示

sysctl: setting key "net.ipv4.tcp_congestion_control": No such file or directory

说明内核中没有bbr,检查系统内核是否高于4.9哦

验证BBR是否开启成功
命令行输入

sysctl net.ipv4.tcp_congestion_control

如果输出

net.ipv4.tcp_congestion_control = bbr

即表示BBR开启成功。

开启前后效果对比

这里跑了下superbench脚本

wget -qO- https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | sudo bash

VirMach VPS
VirMach Los Angeles启用BBR之前

----------------------------------------------------------------------
 Superbench.sh -- https://www.oldking.net/350.html
 Mode  : Standard    Version : 1.1.7
 Usage : wget -qO- sb.oldking.net | bash
----------------------------------------------------------------------
 CPU Model            : QEMU Virtual CPU version (cpu64-rhel6)
 CPU Cores            : 2 Cores 2499.998 MHz x86_64
 CPU Cache            : 4096 KB 
 OS                   : Debian GNU/Linux 10 (64 Bit) KVM
 Kernel               : 4.19.0-6-amd64
 Total Space          : 1.1 GB / 45.0 GB 
 Total RAM            : 53 MB / 1869 MB (367 MB Buff)
 Total SWAP           : 0 MB / 255 MB
 Uptime               : 0 days 15 hour 7 min
 Load Average         : 0.00, 0.00, 0.00
 TCP CC               : cubic
 ASN & ISP            : AS36352, ColoCrossing
 Organization         : Virtual Machine Solutions LLC
 Location             : Los Angeles, United States / US
 Region               : California
----------------------------------------------------------------------
 I/O Speed( 1.0GB )   : 409 MB/s
 I/O Speed( 1.0GB )   : 411 MB/s
 I/O Speed( 1.0GB )   : 463 MB/s
 Average I/O Speed    : 427.7 MB/s
----------------------------------------------------------------------
 Node Name        Upload Speed      Download Speed      Latency     
 Speedtest.net    895.12 Mbit/s     409.90 Mbit/s       (*)60.11 ms 
 Fast.com         0.00 Mbit/s       154.1 Mbit/s        -           
 Nanjing 5G   CT  176.96 Mbit/s     1865.96 Mbit/s      135.78 ms   
 Hefei 5G     CT  0.49 Mbit/s       54.33 Mbit/s        153.14 ms   
 Guangzhou 5G CT  0.14 Mbit/s       1169.21 Mbit/s      175.24 ms   
 TianJin 5G   CU  0.38 Mbit/s       37.82 Mbit/s        369.61 ms   
 Shanghai 5G  CU  0.21 Mbit/s       1322.17 Mbit/s      254.40 ms   
 Guangzhou 5G CU  FAILED Mbit/s     294.15 Mbit/s       322.03 ms   
 Tianjin 5G   CM  0.24 Mbit/s       565.61 Mbit/s       253.24 ms   
 Hefei 5G     CM  0.35 Mbit/s       707.64 Mbit/s       205.84 ms   
 Changsha 5G  CM  0.92 Mbit/s       621.04 Mbit/s       213.99 ms   
----------------------------------------------------------------------
 Finished in  : 6 min 28 sec
 Timestamp    : 2020-12-16 22:47:16 GMT+8
 Results      : ./superbench.log

VirMach Los Angeles启用BBR之后

----------------------------------------------------------------------
 Superbench.sh -- https://www.oldking.net/350.html
 Mode  : Standard    Version : 1.1.7
 Usage : wget -qO- sb.oldking.net | bash
----------------------------------------------------------------------
 CPU Model            : QEMU Virtual CPU version (cpu64-rhel6)
 CPU Cores            : 2 Cores 2499.998 MHz x86_64
 CPU Cache            : 4096 KB 
 OS                   : Debian GNU/Linux 10 (64 Bit) KVM
 Kernel               : 4.19.0-6-amd64
 Total Space          : 1.1 GB / 45.0 GB 
 Total RAM            : 57 MB / 1869 MB (377 MB Buff)
 Total SWAP           : 0 MB / 255 MB
 Uptime               : 0 days 15 hour 20 min
 Load Average         : 0.05, 0.06, 0.02
 TCP CC               : bbr
 ASN & ISP            : AS36352, ColoCrossing
 Organization         : Virtual Machine Solutions LLC
 Location             : Los Angeles, United States / US
 Region               : California
----------------------------------------------------------------------
 I/O Speed( 1.0GB )   : 511 MB/s
 I/O Speed( 1.0GB )   : 391 MB/s
 I/O Speed( 1.0GB )   : 478 MB/s
 Average I/O Speed    : 460.0 MB/s
----------------------------------------------------------------------
 Node Name        Upload Speed      Download Speed      Latency     
 Speedtest.net    687.04 Mbit/s     385.34 Mbit/s       (*)55.80 ms 
 Fast.com         0.00 Mbit/s       137.0 Mbit/s        -           
 Nanjing 5G   CT  283.86 Mbit/s     1810.37 Mbit/s      137.77 ms   
 Hefei 5G     CT  28.39 Mbit/s      71.54 Mbit/s        162.99 ms   
 Guangzhou 5G CT  0.34 Mbit/s       36.96 Mbit/s        170.26 ms   
 TianJin 5G   CU  0.74 Mbit/s       0.40 Mbit/s         286.44 ms   
 Shanghai 5G  CU  10.50 Mbit/s      1616.95 Mbit/s      232.41 ms   
 Tianjin 5G   CM  11.46 Mbit/s      593.42 Mbit/s       234.04 ms   
----------------------------------------------------------------------
 Finished in  : 4 min 45 sec
 Timestamp    : 2020-12-16 22:58:37 GMT+8
 Results      : ./superbench.log
点赞

    发表评论

    电子邮件地址不会被公开。必填项已用 * 标注