1. 程式人生 > >Linux核心升級開啟BBR加速

Linux核心升級開啟BBR加速

Centos7核心升級至4.9以上(原3.1核心升級至4.18核心)

● 安裝源

#預設yum沒有kernel 4.9的源,先安裝 elrepo 擴充套件源;
[[email protected] ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[[email protected] ~]# rpm -Uvhttps://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

[[email protected] ~]#vi /etc/yum.repos.d/elrepo.repo
修改 `[elrepo-kernel]` 的 `enabled=0` 為 `enabled=1`

● 下載核心

[[email protected] ~]#yum install kernel-ml -y

修改 grub 的引導順序(根據系統版本找對應的命令,2選一):
[[email protected] ~]# grub2-set-default 0   #這是centos7的命令;
[[email protected] ~]# sed -i 's/^default=.*/default=0/g' /boot/grub/grub.conf  #CentOS6的命令

● 重啟

[[email protected] ~]#reboot

● 檢視核心版本

[[email protected] ~]# uname -a;
Linux localhost.localdomain 4.18.8-1.el7.elrepo.x86_64 #1 SMP Sat Sep 15 10:10:09 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ~]# 
#顯示的版本號 ≥4.9(4.18是大於4.9的) 就OK了;

● 修改配置,開啟bbr

[[email protected] ~]#echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
[
[email protected]
~]#echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf [[email protected] ~]#reboot #修改完成後再次重啟!

● 檢視bbr是否開啟成功

[[email protected] ~]# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic bbr
[[email protected] ~]# lsmod | grep bbr
tcp_bbr                20480  75 
[[email protected] ~]#