前言
BBR是谷歌开源的tcp拥塞控制算法,据传比锐速好用,具体自行斟酌。
使用方法
已测试通过的系统: Ubuntu 14.04 x64、Ubuntu 16.04 x64、CentOS 6 x64、CentOS 7 x64 只支持 64 位系统,要求 glibc 版本 2.14 以上。
安装
wget https://down.moehu.org/shell/ovz-bbr-installer.sh
chmod +x ovz-bbr-installer.sh
./ovz-bbr-installer.sh
卸载
./ovz-bbr-installer.sh uninstall
更新 glibc
CentOS 6 更新 glibc,首先下载如下几个文件:
wget http://ftp.redsleeve.org/pub/steam/glibc-2.15-60.el6.x86_64.rpm
http://ftp.redsleeve.org/pub/steam/glibc-common-2.15-60.el6.x86_64.rpm
http://ftp.redsleeve.org/pub/steam/glibc-devel-2.15-60.el6.x86_64.rpm
http://ftp.redsleeve.org/pub/steam/glibc-headers-2.15-60.el6.x86_64.rpm
http://ftp.redsleeve.org/pub/steam/nscd-2.15-60.el6.x86_64.rpm
然后安装:
rpm -Uvh glibc-2.15-60.el6.x86_64.rpm
glibc-common-2.15-60.el6.x86_64.rpm
glibc-devel-2.15-60.el6.x86_64.rpm
glibc-headers-2.15-60.el6.x86_64.rpm
nscd-2.15-60.el6.x86_64.rpm
如果以上步骤无法更新,可以手动编译更新(来自网友的方法)
wget http://ftp.gnu.org/gnu/glibc/glibc-2.15.tar.gz
wget http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz
tar -zxf glibc-2.15.tar.gz
tar -zxf glibc-ports-2.15.tar.gz
mv glibc-ports-2.15 glibc-2.15/ports
mkdir glibc-build-2.15
cd glibc-build-2.15
../glibc-2.15/configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make all && make install
检查一下:
# ldd --version
ldd (GNU libc) 2.15
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
已经升级到 glibc 2.15 了。
判断 BBR 已正常工作
判断 bbr 是否正常启动可以尝试 ping 10.0.0.2,如果能通,说明 bbr 已经启动。
然后检查 iptables 规则
iptables -t nat -nL
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
LKL_IN all -- 0.0.0.0/0 0.0.0.0/0
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain LKL_IN (1 references)
target prot opt source destination
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8989 to:10.0.0.2
里边会看到多了一张链表 LKL_IN,里边有相应的端口规则。