Page 1 of 1

How to Enable Google’s TCP BBR on a Linux VPS ( KVM )

Posted: Tue Sep 29, 2020 6:47 pm
by Wamuran4512CH
What da fark is this BBR thingy ??

https://en.wikipedia.org/wiki/TCP_conge ... ol#TCP_BBR

More:

From Google about the BBR
BBR ("Bottleneck Bandwidth and Round-trip propagation time") is a new congestion control algorithm developed at Google. Congestion control algorithms — running inside every computer, phone or tablet connected to a network — that decide how fast to send data.
Google’s TCP BBR, or “Bottleneck Bandwidth and Round-trip propagation time,” is a congestion control system based on cutting-edge technology. It is the same system used for traffic through Google.com, as well as YouTube. It was the reason that YouTube’s network throughput was increased by 4% annually. Moreover, Google’s BBR also significantly reduces latency as the querying, and queuing delays are minimised.

This guide is for you so that you can enable Google’s BBR on your Linux virtual private server aka VPS.

There would be two steps in the guide, where step 1 can be optional in some instances. Let us start!

Step 1. Check and upgrade your existing Linux kernel

We need Linux kernel version 4.9.0 or higher to support Google’s BBR. We will guide you on how to update it for both CentOS 7 and Ubuntu.

To check your current kernel version, run this command on terminal:

Code: Select all

uname -r
If this command returns a kernel version higher than 4.9.0, then you can skip step 1.

Image

For CentOS 7 Based Systems:
https://en.wikipedia.org/wiki/CentOS

1) Install Elrepo repo

To update the CentOS kernel, we need to install the Elrepo repo via the following commands:

Code: Select all

sudo rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
and

Code: Select all

sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
2) Update your kernel

To install the updated kernel, run the following two commands:

Code: Select all

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

Code: Select all

yum list installed kernel
3) Set default boot entry

Run this command to see the list of kernels:

Code: Select all

sudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \’
You should find your newly installed kernel at the top of the list. Then run the following command:

Code: Select all

sudo grub2-set-default 0
4) Reboot and verify

Now reboot your VPS, and after it turns back on, rerun the following command to verify the install:

Code: Select all

uname -r

Ubuntu 18.04 Based Systems
https://en.wikipedia.org/wiki/Ubuntu

The kernel version should be compatible with Google’s BBR if you are running Ubuntu 18.04. However, you can still upgrade the kernel using the following commands.

Code: Select all

cd /tmp/

Code: Select all

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

Code: Select all

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-headers-5.4.13-050413-[color=#408000]generic[/color]_5.4.13-050413.202001171431_amd64.deb

Code: Select all

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-headers-5.4.13-050413-[color=#80BFBF]lowlatency[/color]_5.4.13-050413.202001171431_amd64.deb

Code: Select all

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

Code: Select all

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

Code: Select all

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

Code: Select all

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
and run them all !

Code: Select all

sudo dpkg -i *.deb
After running the commands, reboot your VPS by running the “reboot” command.

Step 2. Enabling Google’s TCP BBR

The instructions below are the same for both CentOS and Ubuntu.

To start, open “/etc/sysctl.conf” in any text editor, or run the command to open it in vim or nano ( your preferred text editor ) - the lazier me would edit it from Webmin's File Manager

Code: Select all

sudo vim /etc/sysctl.conf
At the end of the config file, add the following lines:

Code: Select all

net.core.default_qdisc=fq
and

Code: Select all

net.ipv4.tcp_congestion_control=bbr
Image

Then save the file, and refresh your configuration using this command:

Code: Select all

sudo sysctl -p
Google’s BBR congestion control system has now been enabled on your VPS, to verify this, run this command:

Code: Select all

sysctl net.ipv4.tcp_congestion_control
If the enabling process were successful, the output would be:

Code: Select all

net.ipv4.tcp_congestion_control = bbr
Image

You have now successfully enabled Google’s TCP BBR on your VPS!

Image