Hostwinds Tutorials

Search results for:


Table of Contents


Step 1: Upgrade Kernel Version (If Necessary)
CentOS 7:
Ubuntu 18.04:
Step 2: Enable Google's BBR Algorithm

How to Enable Google’s TCP BBR (Linux Cloud VPS)

Tags: Cloud Servers,  VPS,  Linux 

Step 1: Upgrade Kernel Version (If Necessary)
CentOS 7:
Ubuntu 18.04:
Step 2: Enable Google's BBR Algorithm

Bottleneck Bandwidth and Round-trip propagation time, or BBR, is a congestion control algorithm that powers traffic from google.com and YouTube.  Google developed the algorithm, and it can produce higher throughput and lower latency for traffic from your VPS.

Step 2 in the guide below will allow you to enable BBR on any Linux server with a kernel version 4.9.0 or later. Hostwinds' Ubuntu 18.04 and Debian 9 images have an eligible kernel.

Step 1 below explains how to upgrade the kernel on CentOS 7, which is required with Hostwinds' image. Step 1 also shows how to upgrade the kernel in Ubuntu 18.04. However, it is unnecessary for the Hostwinds image if you have installed Ubuntu 18.04 from the Operating System options on your server.

Step 1: Upgrade Kernel Version (If Necessary)

It is encouraged to update your Linux VPS before making any of the changes below. See our guide for help on updating your system. As always, make sure you have a good working backup by taking a snapshot is recommended.

Kernel version 4.9.0 or later is required to use the BBR algorithm. Check your current kernel version with:

uname -r

If you already have a kernel version 4.9.0 or later, you can skip to Step 2 below. Or you can upgrade if you like.

CentOS 7:

Hostwinds' CentOS 7 image kernel will need to be upgraded from CentOS Linux (3.10.0-693.2.2.el7.x86_64) 7 (Core). You can upgrade to the latest stable kernel version (currently kernel-ml.x86_64 0:5.4.13-1.el7.elrepo) with the following steps.

Install the ELRepo repo:

sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

Install the kernel-ml.x86_64 0:5.4.13-1.el7.elrepo kernel using the ELRepo repo:

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

Next, run:

yum list installed kernel

You should find your newly installed BBR-compatible kernel version on the list.

Now list all entries in the grub2 menu, using:

sudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'

Your newly installed kernel version should be at the top of the list. The top of the list in position 0 in the index. If your kernel version is listed at the top, use 0 in the command below. If it is second-from-the-top, use 1, and so on. See example output below:

CentOS Linux (5.4.13-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux 7 Rescue 4dd7e2d4553149f4943676c4f1794b0a (3.10.0-1062.9.1.el7.x86_64)
CentOS Linux (3.10.0-1062.9.1.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-693.2.2.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-514.26.2.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-de149d15bc21de2e4cc85376c8c61208) 7 (Core)

Set the default boot entry:

sudo grub2-set-default 0

Finally, reboot the server:

reboot

Verify the result. You should find your newly installed kernel version listed after running:

uname -r

Ubuntu 18.04:

Hostwinds' Ubuntu 18.04 image should return an eligible kernel version like below after running name -r:

4.15.0-22-generic

To upgrade to the latest stable kernel version, 5.4.13, run each of the following separately:

cd /tmp/

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-headers-5.4.13-050413_5.4.13-050413.202001171431_all.deb

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-headers-5.4.13-050413-generic_5.4.13-050413.202001171431_amd64.deb

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-headers-5.4.13-050413-lowlatency_5.4.13-050413.202001171431_amd64.deb

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-image-unsigned-5.4.13-050413-generic_5.4.13-050413.202001171431_amd64.deb

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-image-unsigned-5.4.13-050413-lowlatency_5.4.13-050413.202001171431_amd64.deb

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-modules-5.4.13-050413-generic_5.4.13-050413.202001171431_amd64.deb

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-modules-5.4.13-050413-lowlatency_5.4.13-050413.202001171431_amd64.deb

sudo dpkg -i *.deb

Finally, reboot the server:

reboot

Verify the result. You should find your newly installed kernel version listed after running:

uname -r

Step 2: Enable Google's BBR Algorithm

For this next step, use your favorite text editor to edit sysctl.conf:

sudo vim /etc/sysctl.conf

Add the following two lines at the end of sysctl.conf:

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

Save and exit sysctl.conf, then refresh with your new configuration:

sudo sysctl -p

For the final test, verify which congestion control algorithm your system is using:

sysctl net.ipv4.tcp_congestion_control

If you have the following output, you have successfully enabled Google's BBR algorithm:

net.ipv4.tcp_congestion_control = bbr

Written by Benjamin Bream  /  February 12, 2020