Posts CentOS7开启BBR拥塞控制算法
Post
Cancel

CentOS7开启BBR拥塞控制算法

升级内核

首先查看你的Linux内核版本

1
uname -a

开启BBR拥塞控制算法的要求是Linux内核4.9以上版本,现在主流的Linux发行版内核还停留在2.x,我们需要先升级Linux内核版本。 首先,我们需要增加一个 ELRepo 源。 首先,让我们添加 ELRepo GPG key:

1
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

添加源:

1
rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

安装 fastestmirror

1
yum install yum-plugin-fastestmirror -y

安装最新Kernel

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

切换到刚刚下载的新内核

1
grub2-set-default 0

重启后,通过 uname -a 查看内核是否成功切换到最新的版本,确认后我们进入下一步开启BBR

开启BBR

/etc/sysctl.conf 中加入以下两句

1
2
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
1
sysctl -p

检查是否成功设置

1
2
3
4
[root@localhost /]# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = bbr cubic reno
[root@localhost /]# sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = bbr

检查BBR是否正常运行

1
2
[root@localhost /]# lsmod | grep tcp_bbr
tcp_bbr                20480  4

在开启前平均加载速度在2000以内,开启后一般可以稳定在8000以上,可见提升非常巨大。

http://elrepo.org/tiki/tiki-index.php

This post is licensed under CC BY 4.0 by the author.