欢迎光临
我们一直在努力

CENTOS7安装4.9内核并开启BBR

跟随Linux 4.9内核一起来的是 全新的TCP BBR 拥塞控制算法,能够更高效的利用带宽和降低延迟,具体优势可以看李博杰在知乎上的回答。

CentOS7,直接使用Elrepo编译好的内核进行安装
先更新系统

yum update -y

安装内核

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
yum --enablerepo=elrepo-kernel install kernel-ml

安装完成后使用下面命令查看当前已安装的内核

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg

出现类似返回

[root@VM_91_140_centos ~]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (4.9.0-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-514.2.2.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-327.36.3.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-327.28.2.el7.x86_64) 7 (Core)
4 : CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)
5 : CentOS Linux, with Linux 3.10.0-123.el7.x86_64
6 : CentOS Linux, with Linux 0-rescue-3f57f163dfaf1ec9ed891518d1d2fafe

把CentOS Linux (4.9.0-1.el7.elrepo.x86_64)内核设置为默认

grub2-set-default 0

重启

reboot

编辑/etc/sysctl.conf加入或修改这两行

net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

保存后,输入此命令使之生效!

sysctl -p

这时使用命令
lsmod | grep bbr

显示tcp_bbr说明BBR已正常启动。


如果你的内存比较大可以尝试自己编译内核
下载内核源码

wget https://cdn.kernel.org/pub/linux/kernel/v4.x/testing/linux-4.9-rc8.tar.xz

解压

xz -d linux-4.9-rc8.tar.xz
tar xf linux-4.9-rc8.tar

准备环境

yum group install "Development Tools" -y
yum install ncurses-devel openssl-devel elfutils-libelf-devel -y

配置编译参数

cd ./linux-4.9-rc8
make menuconfig

这时候会出现一个界面
使用方向键选择回车键确定
Networking Support—Network options—TCP: Advanced congestion algorithm
找到BBR,在其上按M
左右移动方向键选择Save–回车–回车
再左右移动方向键选择Exit,一路退出

编译内核

make prepare
make

安装模块和内核

make modules_install
make install

再使用上面的步骤将新内核设为默认,再启用BBR就可以了。

未经允许不得转载:798VPS » CENTOS7安装4.9内核并开启BBR

相关推荐

  • 暂无文章