Enable BBR on Debian

How to Enable BBR on Debian 11

Are you looking for ways to overcome congestion issues, improve bandwidth and optimize the web surfing experience by learning how to enable BBR on Debian 11? In this article, we will go over all the steps you need to achieve this. So if you want to learn how to enable BBR, continue reading the article!

Bottleneck Bandwidth and Round-Trip Propagation Time (BBR)

Bottleneck Bandwidth and Round-Trip Propagation Time (BBR) is a congestion control algorithm developed by Google to overcome bandwidth issues. TCP BBR can handle higher bandwidth and lower latencies for traffic. This new algorithm powers Youtube and Google, enabling the network to transmit data fast. You can also enable BBR on Debian 11 machines if you run a kernel above 4.9.

Why Use BBR Congestion Control

BBR is a congestion control mechanism by TCP, and several features differentiate it from Reno and CUBIC:

  • BBR measures both bottleneck bandwidth and round trip time to determine the packet sending rate, whereas the other two algorithms only use packet loss.
  • Reno and Cubic reduce their packet sending rate at the sign of packet loss. On the other hand, BBR does not reduce its packet-sending rate. Instead, it calculates better throughput and adjusts its sending rate.
  • Also, Reno and Cubic congestion control relies on packet loss at a signal of congestion. They do not consider the available bandwidth and RRT, which can lead to lower performance in high-speed and high-latency networks.

Prerequisite

For this tutorial, you’ll need a Debian 11 machine with sudo access. Alternatively, root privilege will also work. In addition, the kernel version should be 4.9 or above.

How to Enable BBR on Debian 11

To enable BBR on Debian machines, we’ll first ensure that the Linux kernel is suitable for BBR. Also, Linux kernels often use Reno and Cubic. Both of these are widely used Congestion Control Algorithms (CCA). 

However, BBR causes 100x more packet retransmission. Hence, we can utilize the capability of TCP BBR to improve bandwidth and packet retransmission. 

In this tutorial, we’ll first look at the general syntax of the commands for the Ubuntu version. Then, we’ll add the commands for the Debian machines. Follow the steps given below to enable BBR on Debian 11.

Check CCA on Linux Kernel

We’ll first identify which CCA our Linux machine is using. What you need to do first is open the Terminal by pressing “Ctrl + Alt + T”. After that, use the sysctl command. Specifically, type:

sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = cubic reno

You should get a similar output:

Check CCA on Debian

We can see our machine’s list of available congestion control algorithms from above. And to check which specific congestion mechanism is in use, type:

sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = cubic

Output:

Enable BBR on Debian

This shows that the BBR is not enabled on this Linux machine. 

Check Linux Kernel Version

The next thing we need to ensure is the correct Linux kernel version. To check the kernel version on any Linux machine, type:

uname -r

You should get the kernel version of your machine as shown below:

check kernel version

Any kernel version below 4.9 will not support TCP BBR. for this step, we’ll first update the system to upgrade its kernel level:

sudo apt update && sudo apt upgrade
sudo apt install --install-recommends linux-generic-hwe-16.04

After that, restart the system using the restart command. Next, we’ll check the kernel version using the uname command. For instance, type:

uname -r

Now that we have the supported kernel, we can set the BBR as our default CCA.

Alternatively, you can also check the kernel modules from the config file using the grep command. We’ll check for the following modules:

  • CONFIG_TCP_CONG_BBR
  • CONFIG_NET_SCH_FQ
  • CONFIG_NET_SCH_FQ_CODEL

To check kernel modules, type:

sudo cat /boot/config-$(uname -r) | grep 'CONFIG_TCP_CONG_BBR'

After filtering the information from the grep command, the cat command will display the file content given in the config file. 

For other modules, the command would look something like this:

sudo cat /boot/config-$(uname -r) | grep 'CONFIG_NET_SCH_FQ'
sudo cat /boot/config-$(uname -r) | grep ‘CONFIG_NET_SCH_FQ_CODEL’

Set BBR as Default CCA

Open the Terminal by pressing “Ctrl + Alt + T”. After that, open the /etc/sysctl.conf file using your favorite text editor. Specifically, type:

# for nano editor
sudo nano /etc/sysctl.conf
# for vim editor
sudo vim /etc/sysctl.conf

Output:

Enable BBR on Debian

At the bottom of the file, add the following lines:

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

Press “Ctrl + S” to save the changes and “Ctrl + X” to exit the editor. 

After that, we’ll reload the file to apply the changes using the sysctl command. Specifically, type:

sudo sysctl -p

Once done, we’ll now check the CCA once again, as shown below:

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

Alternatively, you can also use the echo command to edit the /etc/sysctl.conf file. For this step< execute the commands given below:

sudo bash -c 'echo "" >> /etc/sysctl.conf'
sudo bash -c 'echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf' sudo bash -c 'echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf'
sudo sysctl -p

Disable TCP BBR

In case you no longer want to use BBR as the default congestion control, you can disable it. For this step, first, open the /etc/sysctl.conf file as shown below:

# for nano editor
sudo nano /etc/sysctl.conf
# for vim editor
sudo vim /etc/sysctl.conf

After that, remove the following lines:

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

Hit “Ctrl + S” to save and “Ctrl + X” to exit the editor.

Lastly, restart the machine:

sudo reboot

Keep Windows TCP Scaling Enabled

While you adjust the congestion control algorithm settings, enable windows TCP scaling. Disabling TCP Scaling will greatly affect the network performance. To enable Windows TCP Scaling, open the /etc/sysctl.conf file as shown below:

# for nano editor
sudo nano /etc/sysctl.conf
# for vim editor
sudo vim /etc/sysctl.conf

After that, add the following lines at the end of the file:

net.ipv4.tcp_window_scaling = 1

Output:

Enable TCP Windows

Lastly, apply the changes by restarting the service:

sudo sysctl -p

And that’s a wrap! In this tutorial, we’ve covered how to enable BBR on Debian 11. Enabling BBR on your Linux machine will give you a smoother browsing experience because of its capability to control bandwidth. Additionally, you can disable it if you no longer need BBR as a congestion control mechanism.

If you liked this article, please share it.

Related Posts