如何确认VPS上是否开启了BBR,以及一键安装的脚本

     0评论

文章目录[隐藏]

BBR是Google提出的提升TCP效率的算法,在丢包率较高的网络上,可大幅度提升通信效率。BBR算法已在Linux上实现为内核补丁,不过比较旧的版本没有应用此补丁,新版本即使有也可能默认没有开启。本文介绍如何确认VPS上是否开启了BBR,以及如果没有开启,如何开启。

检查

congestion即拥塞,从以下net命令的名称我们也可以看出bbr主要是对拥塞控制算法的改进。如果已安装、启用了bbr,前三项检查的结果是确定的,第四项检查输出则可有可无。

# 第一项检查: root@topvps:~# sysctl net.ipv4.tcp_available_congestion_control | grep bbr # 若已开启bbr,结果通常为以下两种: net.ipv4.tcp_available_congestion_control = bbr cubic reno net.ipv4.tcp_available_congestion_control = reno cubic bbr # 第二项检查: root@topvps:~# sysctl net.ipv4.tcp_congestion_control | grep bbr # 若已开启bbr,结果如下: net.ipv4.tcp_congestion_control = bbr # 第三项检查: root@topvps:~# sysctl net.core.default_qdisc | grep fq # 若已开启bbr,结果如下: net.core.default_qdisc = fq # 第四项检查: root@topvps:~# lsmod | grep bbr # 若已开启bbr,结果可能如下。并不是所有的 VPS 都会有此返回值,若没有也属正常。 tcp_bbr 20480 2

安装

若上面的检查发现当前的内核没有开启bbr,可以执行以下命令一键安装、启用:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh

注意:脚本不支持OpenVZ。

系统支持:CentOS 6+,Debian 7+,Ubuntu 12+ 虚拟技术:OpenVZ 以外的,比如 KVM、Xen、VMware 等 内存要求:≥128M 更新日期:2018 年 12 月 14 日

比如在Ubuntu 18.04上轻量云上运行此脚本,不用安装,直接就开启了。Vultr的Ubuntu 18.04默认开启了bbr,不用手动启动了。

---------- System Information ---------- OS : Ubuntu 18.04.2 LTS Arch : x86_64 (64 Bit) Kernel : 4.15.0-50-generic ---------------------------------------- Auto install latest kernel for TCP BBR URL: https://teddysun.com/489.html ---------------------------------------- Press any key to start...or Press Ctrl+C to cancel Info: Your kernel version is greater than 4.9, directly setting TCP BBR... Info: Setting TCP BBR completed... root@qly-hk:~# lsmod | grep bbr tcp_bbr 20480 1

参考资料

-- EOF --

本文最后修改于5年前 (2019-06-07)

差评不太行一般挺好非常不错 (No Ratings Yet)
读取中...
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址