Many people who buy vps want to build their own private VPN, but due to factors such as network routing, your vpn connection speed is not so fast, which does not make you very satisfied, so I recommend bbr to you.
This article introduces one-click fool-style upgrade of the kernel and installation of BBR acceleration. Affirm: The tutorial for one-click installation of BBR was created by Teddy! Google's TCP BBR congestion control algorithm has been included in various versions starting from Linux 4.9. This one-click BBR installation package is only applicable to operating systems such as CentOS 6+, Debian 7+, Ubuntu 12+ and KVM, Xen, VMware and other virtual environments (Excluding OpenVZ). Original: https://teddysun.com/489.html, the author is in the host evaluation group.
Log in as the root user and run the following command:
- wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh
After the installation is complete, the script will prompt that the VPS needs to be restarted. Enter y and press Enter to restart. After the restart is complete, enter the VPS, verify whether the latest kernel is successfully installed and enable TCP BBR, enter the following command:
uname -r
Check the kernel version, the latest version means OK
sysctl net.ipv4.tcp_available_congestion_control
The return value is generally:
net.ipv4.tcp_available_congestion_control = bbr
cubic reno sysctl net.ipv4.tcp_congestion_control
The return value is generally:
net.ipv4.tcp_congestion_control = bbr
sysctl net.core.default_qdisc
The return value is generally:
net.core.default_qdisc = fq
lsmod | grep bbr
If the return value has the tcp_bbr module, it means that bbr has been started. Note: Not all VPS will have this return value, if not, it is normal.
Installation method of the latest kernel headers under CentOS Originally, I planned to install kernel-ml-headers directly in the script, but there will be conflicts with the original kernel headers. So after adding a script here, manually install the latest version of the kernel headers tutorial. Execute the following command
yum --enablerepo=elrepo-kernel -y install kernel-ml-headers
Depending on the CentOS version, an error message similar to the following will generally appear at this time:
Error: kernel-ml-headers conflicts with kernel-headers-2.6.32-696.20.1.el6.x86_64
Error: kernel-ml-headers conflicts with kernel-headers-3.10.0-693.17.1.el7.x86_64
Therefore, you need to uninstall the original kernel headers first, and then install the latest kernel headers. Excuting an order:
yum remove kernel-headers
After confirming that it is correct, enter y and press Enter to start unloading. Note that sometimes this operation will also uninstall some installation packages that depend on the kernel headers, such as gcc, gcc-c++ and the like. But it doesn't matter, we can reinstall it after installing the latest version of the kernel headers. After the uninstallation is complete, execute the installation command given above again.
yum --enablerepo=elrepo-kernel -y install kernel-ml-headers
After successful installation, install the installation packages that were previously dependent on the kernel headers, such as gcc, gcc-c++, and so on.
Why install the latest kernel headers? This is because the x-libev version has a tcp fast open function, which cannot be turned on if it is not installed.
Kernel upgrade method If it is a CentOS system, execute the following command to upgrade the kernel:
yum --enablerepo=elrepo-kernel -y install kernel-ml kernel-ml-devel
If you have manually installed the new version of the kernel headers, you also need the following command to upgrade the headers:
yum --enablerepo=elrepo-kernel -y install kernel-ml-headers
For CentOS 6, execute the command:
sed -i's/^default=.*/default=0/g' /boot/grub/grub.conf
For CentOS 7, execute the command:
grub2-set-default 0 If it is a Debian/Ubuntu system, you need to manually download the latest version of the kernel to install the upgrade.
Go here to download the latest version of the kernel deb installation package. If the system is 64-bit, download the deb package generic in the linux-image of amd64; If the system is 32-bit, download the deb package generic in the linux-image of i386; The installation command is as follows (take the latest version of 64-bit 4.12.4 as an example, please replace it with the downloaded deb package):
dpkg -i linux-image-4.12.4-041204-generic_4.12.4-041204.201707271932_amd64.deb
After the installation is complete, execute the command:
/usr/sbin/update-grub
then, restart the VPS.
Special Note
If you are using Google Cloud Platform (GCP) to replace the kernel, sometimes you will encounter a situation where the entire disk becomes read-only after restarting. Just execute the following command to restore:
mount -o remount rw /