Publish: 2018-01-19 | Modify: 2018-01-19
Google BBR is a TCP acceleration tool that requires a Linux kernel version higher than 4.9. I previously shared an article "CentOS One-Click Kernel Upgrade and Enable Google BBR", which provides a convenient method. However, I found that the upgrade failed on Raksmart, so I tried to manually upgrade the kernel.
# Import ELRepo public key
wget https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm --import RPM-GPG-KEY-elrepo.org
# Install ELRepo
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
# Upgrade to the latest kernel
yum --enablerepo=elrepo-kernel install kernel-ml -y
After the kernel upgrade, the old and new kernels will coexist. CentOS 7 uses the grub2 bootloader, so you need to adjust the priority of the latest kernel. First, run the command cat /boot/grub2/grub.cfg|grep menuentry
to find all the kernels and identify the full name of the latest kernel. Record it as shown in the screenshot below.
# Set the latest kernel (please enter the full name of the latest kernel obtained above)
grub2-set-default "CentOS Linux (4.14.14-1.el7.elrepo.x86_64) 7 (Core)"
# After setting, run the following command to check if it was successful
grub2-editenv list
[root@test2018119 ~]# grub2-editenv list
saved_entry=CentOS Linux (4.14.14-1.el7.elrepo.x86_64) 7 (Core)
# Okay, no problem. Reboot the server to take effect
reboot
# Import ELRepo public key
wget https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm --import RPM-GPG-KEY-elrepo.org
# Install ELRepo
rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
# Upgrade to the latest kernel
yum --enablerepo=elrepo-kernel install kernel-ml -y
After the upgrade, modify /etc/grub.conf
to change default=0
to default=1
, and then reboot the server with the reboot
command.
Run the command uname -r
to view the current kernel. If it is higher than 4.9, the upgrade was successful. If you find that your network is not working after the operation, it may be because the upgrade failed. In this case, you can only enter the VNC console and modify it to start with the old kernel using the method mentioned above.
# Kernel version is higher than 4.9
[root@test2018119 ~]# uname -r
4.14.14-1.el7.elrepo.x86_64
Simply copy the following command:
# Modify the configuration
cat >>/etc/sysctl.conf << EOF
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
EOF
# Make the configuration take effect
sysctl -p
Run the following command to check. If the returned result includes "bbr", it means that the BBR is successfully enabled, as shown in the screenshot below.
[root@test2018119 ~]# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = bbr cubic reno
[root@test2018119 ~]# lsmod | grep bbr
tcp_bbr 20480 0
I recommend using the one-click script by Qiushui Yibing to upgrade the kernel "CentOS One-Click Kernel Upgrade and Enable Google BBR". If it fails, you can try the above method to manually upgrade. This method is suitable for KVM/XEN virtualization. Please do not use it for OpenVZ virtualization VPS, as it is unlikely to be successful. It is also recommended not to perform this operation in a production environment to avoid any issues.
This article references the following sources:
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.