前言#
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,裡邊有相應的端口規則。