您尚未登录。

#1 2018-11-29 08:59:07

caizhengzhu
管理员

centos开启BBR

一键安装:https://www.bandwagonhost.net/bandwagonhost-bbr.html

KVM
安装:

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

验证:

uname -r
sysctl net.ipv4.tcp_available_congestion_control
sysctl net.ipv4.tcp_congestion_control
sysctl net.core.default_qdisc
lsmod | grep bbr

OpenVZ

安装:

wget https://raw.githubusercontent.com/kuoruan/shell-scripts/master/ovz-bbr/ovz-bbr-installer.sh 
chmod +x ovz-bbr-installer.sh 
./ovz-bbr-installer.sh

firewalld:

systemctl disable firewalld 
systemctl stop firewalld

卸载:

 
./ovz-bbr-installer.sh uninstall

多端口:

vim /usr/local/haproxy-lkl/etc/port-rules

启动、停止、重启:

systemctl {start|stop|restart} haproxy-lkl
service haproxy-lkl {start|stop|restart}

更新 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

检查 glibc:

ldd --version

https://www.vultr.com/docs/how-to-deplo … n-centos-7
https://www.bandwagonhost.net/268.html
https://www.bandwagonhost.net/1082.html
https://www.bandwagonhost.net/bandwagonhost-bbr.html


BBR (Bottleneck Bandwidth and RTT) is a new congestion control algorithm which is contributed to the Linux kernel TCP stack by Google. With BBR in place, a Linux server can get significantly increased throughput and reduced latency for connections. Besides, it's easy to deploy BBR because this algorithm requires only updates on the sender side, not in the network or on the receiver side.

In this article, I will show you how to deploy BBR on a Vultr CentOS 7 KVM server instance.

Prerequisites
A Vultr CentOS 7 x64 server instance.
A sudo user.
Step 1: Upgrade the kernel using the ELRepo RPM repository
In order to use BBR, you need to upgrade the kernel of your CentOS 7 machine to 4.9.0. You can easily get that done using the ELRepo RPM repository.

Before the upgrade, you can take a look at the current kernel:

uname -r

This command should output a string which resembles:

3.10.0-514.2.2.el7.x86_64

As you see, the current kernel is 3.10.0.

Install the ELRepo repo:

sudo rpm --import [url]https://www.elrepo.org/RPM-GPG-KEY-elrepo.org[/url]
sudo rpm -Uvh [url]http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm[/url]

Install the 4.9.0 kernel using the ELRepo repo:

sudo yum --enablerepo=elrepo-kernel install kernel-ml -y

Confirm the result:

rpm -qa | grep kernel

If the installation is successful, you should see kernel-ml-4.9.0-1.el7.elrepo.x86_64 among the output list:

kernel-ml-4.9.0-1.el7.elrepo.x86_64
kernel-3.10.0-514.el7.x86_64
kernel-tools-libs-3.10.0-514.2.2.el7.x86_64
kernel-tools-3.10.0-514.2.2.el7.x86_64
kernel-3.10.0-514.2.2.el7.x86_64
Now, you need to enable the 4.9.0 kernel by setting up the default grub2 boot entry.

Show all entries in the grub2 menu:

sudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'

The result should resemble:

CentOS Linux 7 Rescue a0cbf86a6ef1416a8812657bb4f2b860 (4.9.0-1.el7.elrepo.x86_64)
CentOS Linux (4.9.0-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux (3.10.0-514.2.2.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-bf94f46c6bd04792a6a42c91bae645f7) 7 (Core)

Since the line count starts at 0 and the 4.9.0 kernel entry is on the first line, set the default boot entry as 0:

sudo grub2-set-default 0

Reboot the system:

sudo shutdown -r now

When the server is back online, log back in and rerun the uname command to confirm that you are using the correct Kernel:

uname -r

You should see the result as below:

4.9.0-1.el7.elrepo.x86_64

Step 2: Enable BBR
In order to enable the BBR algorithm, you need to modify the sysctl configuration as follows:

echo 'net.core.default_qdisc=fq' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Now, you can use the following commands to confirm that BBR is enabled:

sudo sysctl net.ipv4.tcp_available_congestion_control

The output should resemble:

net.ipv4.tcp_available_congestion_control = bbr cubic reno

Next, verify with:

sudo sysctl -n net.ipv4.tcp_congestion_control

The output should be:

bbr

Finally, check that the kernel module was loaded:

lsmod | grep bbr

The output will be similar to:

tcp_bbr                16384  0

Step 3 (optional): Test the network performance enhancement
In order to test BBR's network performance enhancement, you can create a file in the web server directory for download, and then test the download speed from a web browser on your desktop machine.

sudo yum install httpd -y
sudo systemctl start httpd.service
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload
cd /var/www/html
sudo dd if=/dev/zero of=500mb.zip bs=1024k count=500

Finally, visit the URL http://[your-server-IP]/500mb.zip from a web browser on your desktop computer, and then evaluate download speed.

That's all. Thank you for reading.

离线

#2 2019-05-01 21:31:53

caizhengzhu
管理员

回复: centos开启BBR

【2017-11-26】更新:更新了《搬瓦工 OpenVZ 版本安装 BBR 的教程》。以及为了方便大家复制,新建了一个页面,大家可以前往该页面复制命令:https://www.bandwagonhost.net/bandwagonhost-bbr.html

使用环境
虚拟化:KVM、Xen等,除了OpenVZ基本都行

系统:CentOS 6+,Debian 7+,Ubuntu 12+

内存:128MB以上

方法
使用root登陆VPS,输入下面命令:

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

完成后,提示重启,输入y并重启VPS。

重启后,验证是否成功安装,输入:

uname -r

查看内核版本,含有 4.10 就表示 OK 了

sysctl net.ipv4.tcp_available_congestion_control

返回值一般为:
net.ipv4.tcp_available_congestion_control = bbr cubic reno

sysctl net.ipv4.tcp_congestion_control

返回值一般为:
net.ipv4.tcp_congestion_control = bbr

sysctl net.core.default_qdisc

返回值一般为:
net.core.default_qdisc = fq

lsmod | grep bbr

返回值有 tcp_bbr 模块即说明bbr已启动。

参考文章:https://teddysun.com/489.html

离线

#3 2019-12-04 12:03:31

caizhengzhu
管理员

回复: centos开启BBR

一键安装最新内核并开启 BBR 脚本     https://teddysun.com/489.html

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


关于本脚本
1、本脚本已在 Vultr 上的 VPS 全部测试通过。
2、当脚本检测到 VPS 的虚拟方式为 OpenVZ 时,会提示错误,并自动退出安装。
3、脚本运行完重启发现开不了机的,打开 VPS 后台控制面板的 VNC, 开机卡在 grub 引导, 手动选择内核即可。
4、由于是使用最新版系统内核,最好请勿在生产环境安装,以免产生不可预测之后果。

使用方法
使用root用户登录,运行以下命令:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh
安装完成后,脚本会提示需要重启 VPS,输入 y 并回车后重启。
重启完成后,进入 VPS,验证一下是否成功安装最新内核并开启 TCP BBR,输入以下命令:

uname -r
查看内核版本,显示为最新版就表示 OK 了

sysctl net.ipv4.tcp_available_congestion_control
返回值一般为:
net.ipv4.tcp_available_congestion_control = bbr cubic reno
或者为:
net.ipv4.tcp_available_congestion_control = reno cubic bbr

sysctl net.ipv4.tcp_congestion_control
返回值一般为:
net.ipv4.tcp_congestion_control = bbr

sysctl net.core.default_qdisc
返回值一般为:
net.core.default_qdisc = fq

lsmod | grep bbr
返回值有 tcp_bbr 模块即说明 bbr 已启动。注意:并不是所有的 VPS 都会有此返回值,若没有也属正常。

离线

在此主题中在线的注册用户:0, 访客:1
[Bot] ClaudeBot

论坛底部