BBR 是 Google 提出的一种新型拥塞控制算法,可以使 Linux 服务器显著地提高吞吐量和减少 TCP 连接的延迟。从 4.9 开始,Linux 内核已经用上了该算法。

首先查看内核,如果低于4.9就要更换内容,如果4.9以上可以跳过更换内核步骤(下面一至九的步骤)

[root@boxmoe ~] uname -r
3.10.0-1160.el7.x86_64

更换内核

//一.导入公钥
[root@boxmoe ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
//如果正常的话是空白无信息回应的
//可能遇到的错误信息
//curl: (35) Peer reports incompatible or unsupported protocol version.
//上方问题解决,yum update -y nss curl libcurl
二.Centos 7版本
[root@boxmoe ~]# yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
三.安装内核
[root@boxmoe ~]# yum --enablerepo=elrepo-kernel install kernel-ml -y
四.查看已安装的内核列表
[root@boxmoe ~]# rpm -qa | grep kernel
五.查看默认启动内核
[root@boxmoe ~]# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-1160.49.1.el7.x86_64) 7 (Core) //ps:低于4.9是要换的
六.查看所有内核
[root@boxmoe ~]# cat /boot/grub2/grub.cfg | grep menuentry
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
menuentry 'CentOS Linux (5.15.11-1.el7.elrepo.x86_64) 7 (Core)' --class ... //主要前面后面的省略
menuentry 'CentOS Linux (3.10.0-1160.49.1.el7.x86_64) 7 (Core)' --class ...//主要前面后面的省略
menuentry 'CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)' --class ...
menuentry 'CentOS Linux (0-rescue-8508293106917c25a979808779d9e8a1) 7 (Core)' --class ...//主要前面后面的省略
七.修改默认启动内核
[root@boxmoe ~]# grub2-set-default 'CentOS Linux (5.7.0-1.el7.elrepo.x86_64) 7 (Core)'
八.重启系统
[root@boxmoe ~]# reboot
九.重启系统开机后检查启动内核
[root@boxmoe ~]# grub2-editenv list
//内核大于4.9以上了,就可以继续安装BBR

开启bbr

一.加入命令行
[root@boxmoe ~]# echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
[root@boxmoe ~]# echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
二.加载参数
[root@boxmoe ~]# sysctl -p
三.查看是否开启成功-1
[root@boxmoe ~]# sysctl net.ipv4.tcp_available_congestion_control
//显示
net.ipv4.tcp_available_congestion_control = reno cubic bbr
//或者
net.ipv4.tcp_available_congestion_control = bbr cubic reno
四.查看是否开启成功-2
[root@boxmoe ~]# sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = bbr

检查BBR是否正常运行
[root@boxmoe ~]# lsmod | grep bbr
tcp_bbr                20480  7

到这里既Centos7 开启了bbr加速