这是2016年9月份才开源的一个优化网络拥堵的算法。
目前最新版本的Linux内核(4.9-rc8)中已经集成了该算法。
据很多人反馈,速度比锐速还厉害!!
毕竟是新鲜的东西,难免有BUG,酌情使用。
更新动态
2017年2月16日01:01:11
新增秋水逸冰一键安装脚本
2016年12月13日11:33:18
新增CentOS7 RMP 安装BBR步骤说明
新增CentOS6一键安装脚本
更新CentOS6 RMP包地址。
开源地址
https://github.com/google/bbr
注意这不是Google官方的产品。
使用必读
不支持OpenVZ虚拟!
安装前需要备份重要数据,安装完可能会导致系统无法启动!
系统无法修改请尝试修改引导!或者重装系统!
安装方式
Debian8/Ubuntu14
- 下载最新内核,最新内核查看这里
-
1<span class="crayon-e">wget </span><span class="crayon-v">http</span><span class="crayon-o">:</span><span class="crayon-c">//kernel.ubuntu.com/~kernel-ppa/mainline/v4.9-rc8/linux-image-4.9.0-040900rc8-generic_4.9.0-040900rc8.201612051443_amd64.deb</span>
- 安装内核
-
1<span class="crayon-v">dpkg</span> <span class="crayon-o">-</span><span class="crayon-i">i</span> <span class="crayon-v">linux</span><span class="crayon-o">-</span><span class="crayon-v">image</span><span class="crayon-o">-</span><span class="crayon-cn">4.9.0</span><span class="crayon-o">*</span><span class="crayon-sy">.</span><span class="crayon-v">deb</span>
- 删除其余内核
-
123<span class="crayon-v">dpkg</span> <span class="crayon-o">-</span><span class="crayon-v">l</span><span class="crayon-o">|</span><span class="crayon-e">grep </span><span class="crayon-v">linux</span><span class="crayon-o">-</span><span class="crayon-e">image</span><span class="crayon-e">sudo </span><span class="crayon-v">apt</span><span class="crayon-o">-</span><span class="crayon-e">get </span><span class="crayon-e">remove </span><span class="crayon-v">linux</span><span class="crayon-o">-</span><span class="crayon-v">image</span><span class="crayon-o">-</span><span class="crayon-sy">[</span><span class="crayon-i">Tab</span>补全<span class="crayon-sy">]</span> <span class="crayon-p">#删旧内核,在这里,就是把第一个3.13的删掉</span>
- 更新 grub 系统引导文件并重启
-
123<span class="crayon-v">update</span><span class="crayon-o">-</span><span class="crayon-e">grub</span><span class="crayon-v">reboot</span>
- 开启bbr
-
123<span class="crayon-i">echo</span> <span class="crayon-s">"net.core.default_qdisc=fq"</span> <span class="crayon-o">>></span> <span class="crayon-o">/</span><span class="crayon-v">etc</span><span class="crayon-o">/</span><span class="crayon-v">sysctl</span><span class="crayon-sy">.</span><span class="crayon-e">conf</span><span class="crayon-i">echo</span> <span class="crayon-s">"net.ipv4.tcp_congestion_control=bbr"</span> <span class="crayon-o">>></span> <span class="crayon-o">/</span><span class="crayon-v">etc</span><span class="crayon-o">/</span><span class="crayon-v">sysctl</span><span class="crayon-sy">.</span><span class="crayon-v">conf</span>
保存生效 sysctl -p
执行 sysctl net.ipv4.tcp_available_congestion_control
如果结果中有bbr
, 则证明你的内核已开启bbr
执行lsmod | grep bbr
, 看到有 tcp_bbr 模块即说明bbr已启动。
CentOS7
评论有人已经成功。
1)RMP安装(推荐)
先更新到7.3,安装elrepo官方4.9正式版
YUM 更新
1 |
<span class="crayon-e">yum </span><span class="crayon-v">update</span> <span class="crayon-o">-</span><span class="crayon-v">y</span> |
查看内核版本
1 2 3 |
<span class="crayon-v">cat</span> <span class="crayon-o">/</span><span class="crayon-v">etc</span><span class="crayon-o">/</span><span class="crayon-v">redhat</span><span class="crayon-o">-</span><span class="crayon-v">release</span> <span class="crayon-p">#CentOS Linux release 7.3.1611 (Core)</span> |
安装RPM
1 2 3 |
<span class="crayon-v">rpm</span> <span class="crayon-o">--</span><span class="crayon-e">import </span><span class="crayon-v">https</span><span class="crayon-o">:</span><span class="crayon-c">//www.elrepo.org/RPM-GPG-KEY-elrepo.org</span> <span class="crayon-v">rpm</span> <span class="crayon-o">-</span><span class="crayon-e">Uvh </span><span class="crayon-v">http</span><span class="crayon-o">:</span><span class="crayon-c">//www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm</span> |
修改elrepo让yum update可用
vim /etc/yum.repos.d/elrepo.repo
|
把enabled=0改成enabled=1
然后保存之后yum update -y,就会更新到elrepo正式版4.9内核。
开启bbr
vim /etc/sysctl.conf
|
加两行:
1 2 3 |
<span class="crayon-v">net</span><span class="crayon-sy">.</span><span class="crayon-v">core</span><span class="crayon-sy">.</span><span class="crayon-v">default_qdisc</span> <span class="crayon-o">=</span> <span class="crayon-e">fq</span> <span class="crayon-v">net</span><span class="crayon-sy">.</span><span class="crayon-v">ipv4</span><span class="crayon-sy">.</span><span class="crayon-v">tcp_congestion_control</span> <span class="crayon-o">=</span> <span class="crayon-v">bbr</span> |
保存生效 sysctl -p
2) 编译安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<span class="crayon-e">wget </span><span class="crayon-v">http</span><span class="crayon-o">:</span><span class="crayon-c">//mirrors.kernel.org/debian/pool/main/l/linux/linux-image-4.9.0-rc8-amd64-unsigned_4.9~rc8-1~exp1_amd64.deb</span> <span class="crayon-i">ar</span> <span class="crayon-i">x</span> <span class="crayon-v">linux</span><span class="crayon-o">-</span><span class="crayon-v">image</span><span class="crayon-o">-</span><span class="crayon-cn">4.9.0</span><span class="crayon-o">-</span><span class="crayon-v">rc8</span><span class="crayon-o">-</span><span class="crayon-v">amd64</span><span class="crayon-o">-</span><span class="crayon-v">unsigned_4</span><span class="crayon-sy">.</span><span class="crayon-cn">9</span><span class="crayon-o">~</span><span class="crayon-v">rc8</span><span class="crayon-o">-</span><span class="crayon-cn">1</span><span class="crayon-o">~</span><span class="crayon-v">exp1_amd64</span><span class="crayon-sy">.</span><span class="crayon-e">deb</span> <span class="crayon-v">tar</span> <span class="crayon-o">-</span><span class="crayon-e">Jxf </span><span class="crayon-v">data</span><span class="crayon-sy">.</span><span class="crayon-v">tar</span><span class="crayon-sy">.</span><span class="crayon-e">xz</span> <span class="crayon-v">install</span> <span class="crayon-o">-</span><span class="crayon-e">m644 </span><span class="crayon-v">boot</span><span class="crayon-o">/</span><span class="crayon-v">vmlinuz</span><span class="crayon-o">-</span><span class="crayon-cn">4.9.0</span><span class="crayon-o">-</span><span class="crayon-v">rc8</span><span class="crayon-o">-</span><span class="crayon-v">amd64</span> <span class="crayon-o">/</span><span class="crayon-v">boot</span><span class="crayon-o">/</span><span class="crayon-v">vmlinuz</span><span class="crayon-o">-</span><span class="crayon-cn">4.9.0</span><span class="crayon-o">-</span><span class="crayon-v">rc8</span><span class="crayon-o">-</span><span class="crayon-e">amd64</span> <span class="crayon-v">cp</span> <span class="crayon-o">-</span><span class="crayon-e">Rav </span><span class="crayon-v">lib</span><span class="crayon-o">/</span><span class="crayon-v">modules</span><span class="crayon-o">/</span><span class="crayon-cn">4.9.0</span><span class="crayon-o">-</span><span class="crayon-v">rc8</span><span class="crayon-o">-</span><span class="crayon-v">amd64</span> <span class="crayon-o">/</span><span class="crayon-v">lib</span><span class="crayon-o">/</span><span class="crayon-v">modules</span><span class="crayon-o">/</span> <span class="crayon-v">depmod</span> <span class="crayon-o">-</span><span class="crayon-i">a</span> <span class="crayon-cn">4.9.0</span><span class="crayon-o">-</span><span class="crayon-v">rc8</span><span class="crayon-o">-</span><span class="crayon-v">amd64</span> <span class="crayon-p">#centos >= 6</span> <span class="crayon-v">dracut</span> <span class="crayon-o">-</span><span class="crayon-v">f</span> <span class="crayon-o">-</span><span class="crayon-v">v</span> <span class="crayon-o">--</span><span class="crayon-v">hostonly</span> <span class="crayon-o">-</span><span class="crayon-i">k</span> <span class="crayon-s">'/lib/modules/4.9.0-rc8-amd64'</span><span class="crayon-h"> </span><span class="crayon-o">/</span><span class="crayon-v">boot</span><span class="crayon-o">/</span><span class="crayon-v">initramfs</span><span class="crayon-o">-</span><span class="crayon-cn">4.9.0</span><span class="crayon-o">-</span><span class="crayon-v">rc8</span><span class="crayon-o">-</span><span class="crayon-v">amd64</span><span class="crayon-sy">.</span><span class="crayon-i">img</span> <span class="crayon-cn">4.9.0</span><span class="crayon-o">-</span><span class="crayon-v">rc8</span><span class="crayon-o">-</span><span class="crayon-e">amd64</span> <span class="crayon-v">grub2</span><span class="crayon-o">-</span><span class="crayon-v">mkconfig</span> <span class="crayon-o">-</span><span class="crayon-v">o</span> <span class="crayon-o">/</span><span class="crayon-v">boot</span><span class="crayon-o">/</span><span class="crayon-v">grub2</span><span class="crayon-o">/</span><span class="crayon-v">grub</span><span class="crayon-sy">.</span><span class="crayon-v">cfg</span> |
然后修改系统启动引导文件:
1
|
vi /etc/grub.conf
|
需要修改Grub引导顺序,让新安装的内核作为默认内核。
或者执行:
1
|
grub2–set–default “CentOS Linux (4.9.0-rc8-amd64) 7 (Core)”
|
然后重启
1
|
reboot
|
重启后,查看内核是否安装成功。
1
|
uname –r
|
开启bbr
据人反馈:先把/etc/sysctl.conf 文件中 关于 net.ipv4.tcp_congestion_control的配置注释掉。
1
2
|
echo “net.core.default_qdisc=fq” >> /etc/sysctl.conf
echo “net.ipv4.tcp_congestion_control=bbr” >> /etc/sysctl.conf
|
保存生效 sysctl -p
执行 sysctl net.ipv4.tcp_available_congestion_control
如果结果中有bbr
, 则证明你的内核已开启bbr
执行lsmod | grep bbr
, 看到有 tcp_bbr 模块即说明bbr已启动。
CentOS6
1)一键安装(推荐)
安装脚本(开源地址:https://github.com/52fancy/GooGle-BBR)
1
|
wget —no–check–certificate https://github.com/52fancy/GooGle-BBR/raw/master/BBR.sh && sh BBR.sh
|
之后重启服务器即可
验证是否安装成功
1
|
lsmod | grep bbr
|
如果结果显示bbr安装成功。
如果失败,请尝试RMP安装。
2)RMP安装
RMP 地址:https://elrepo.org/linux/kernel/
1
2
|
rpm —import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install –y https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-4.9.0-1.el7.elrepo.x86_64.rpm
|
CAC CentOS6 系统可直接执行以下代码(以下代码已经失效)
1
2
3
|
####此代码已经失效####
rpm —import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install –y http://elrepo.org/people/ajb/devel/kernel-ml/el6/x86_64/RPMS/kernel-ml-devel-4.9.0-0.rc8.el6.elrepo.x86_64.rpm
|
安装完成,修改启动引导。(自己百度vi 命令用法)
1
|
vi /etc/grub.conf
|
修改成 default=0
保存然后重启
1
|
reboot
|
重启后,查看内核是否安装成功。
1
|
uname –r
|
开启bbr
据人反馈:先把/etc/sysctl.conf 文件中 关于 net.ipv4.tcp_congestion_control的配置注释掉。
1
2
|
echo “net.core.default_qdisc=fq” >> /etc/sysctl.conf
echo “net.ipv4.tcp_congestion_control=bbr” >> /etc/sysctl.conf
|
保存生效 sysctl -p
执行 sysctl net.ipv4.tcp_available_congestion_control
如果结果中有bbr
, 则证明你的内核已开启bbr
执行lsmod | grep bbr
, 看到有 tcp_bbr 模块即说明bbr已启动。
编译安装(不推荐)
速度较慢。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
yum install vim wget gcc gcc–c++ xz bc ncurses–devel hmaccalc zlib–devel binutils–devel elfutils–libelf–devel openssl–devel –y
cd /usr/local/src/
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/testing/linux-4.9-rc8.tar.xz
tar xvJf linux–4.9–rc8.tar.xz
cd linux–4.9–rc8
make menuconfig
uname –r
#2.6.32-573.3.1.el6.x86_64
cp /boot/config–2.6.32–573.3.1.el6.x86_64 .config
#cp: overwrite `.config’? #输入y
sudo sh –c ‘yes “” | make oldconfig’
make #执行比较久,可以去看一集电视剧
make modules_install install#忽略提示could not find module vmware_balloon
|
修改Grub引导顺序,让新安装的内核作为默认内核。default = 0
1
|
vi /boot/grub/menu.lst #修改启动项
|
重启
1
|
reboot
|
重启后,查看内核是否安装成功。
1
|
uname –r
|
开启bbr
据人反馈:先把/etc/sysctl.conf 文件中 关于 net.ipv4.tcp_congestion_control的配置注释掉。
1
2
|
echo “net.core.default_qdisc=fq” >> /etc/sysctl.conf
echo “net.ipv4.tcp_congestion_control=bbr” >> /etc/sysctl.conf
|
保存生效 sysctl -p
执行 sysctl net.ipv4.tcp_available_congestion_control
如果结果中有bbr
, 则证明你的内核已开启bbr
执行ps -ef| grep bbr
, 看到有 tcp_bbr 模块即说明bbr已启动。
一键安装
本脚本为秋水逸冰的一键安装。
系统支持:CentOS 6+,Debian 7+,Ubuntu 12+
虚拟技术:OpenVZ 以外的(KVM、Xen、VMware等)
内存要求:≥128M
1
2
3
|
wget —no–check–certificate https://github.com/teddysun/across/raw/master/bbr.sh
chmod +x bbr.sh
./bbr.sh
|
安装完成后,脚本会提示需要重启 VPS,输入 y 并回车后重启。
重启完成后,进入 VPS,验证一下是否成功安装最新内核并开启 TCP BBR,输入以下命令:
1
|
uname –r
|
查看内核版本,含有 4.9 就表示 OK 了
1
|
sysctl net.ipv4.tcp_available_congestion_control
|
返回值一般为:
net.ipv4.tcp_available_congestion_control = bbr cubic reno
1
|
sysctl net.ipv4.tcp_congestion_control
|
返回值一般为:
net.ipv4.tcp_congestion_control = bbr
1
|
sysctl net.core.default_qdisc
|
返回值一般为:
net.core.default_qdisc = fq
1
|
lsmod | grep bbr
|
返回值有 tcp_bbr 模块即说明bbr已启动。
测试效果
使用 CloudAtCost 小JJ,安装SS测试了一下。
明显没有锐速效果好。
不知道建站会怎么样。