How to Enable BBR on a CentOS 7 KVM Server

BBR, short for Bottleneck Bandwidth and Round-Trip Time, is an advanced congestion control algorithm developed by Google and integrated into the Linux kernel’s TCP stack. Implementing BBR can result in notably enhanced throughput and lower latency for network connections on a Linux server. A major advantage of BBR is its simplicity in deployment—it only requires changes on the sender’s end, with no adjustments needed on the network infrastructure or the receiver’s system.

Requirements

  • A CentOS 7 x64 virtual server
  • User access with sudo privileges

Step 1: Kernel Upgrade via ELRepo Repository

To activate BBR, the Linux kernel on your CentOS 7 machine must be upgraded to version 4.9.0. This can be done smoothly using the ELRepo RPM repository.

Check the Current Kernel Version

Before proceeding with the upgrade, verify your current kernel version:

This should return a string similar to:

This indicates that your current kernel is version 3.10.0.

Enable the ELRepo Repository

Install the ELRepo GPG key and repository package:

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 Latest Kernel

Now, use the ELRepo source to install the mainline kernel version 4.9.0:

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

Verify Installed Kernels

Ensure that the kernel has been successfully installed:

Among the results, you should see entries like:

kernel-ml-4.9.0-1.el7.elrepo.x86_64
kernel-3.10.0-514.el7.x86_64
kernel-tools-libs-3.10.0-514.2.2.el7.x86_64
kernel-tools-3.10.0-514.2.2.el7.x86_64
kernel-3.10.0-514.2.2.el7.x86_64

Set Default Kernel to 4.9.0

Configure GRUB2 to boot with the new kernel by default. First, list the available menu entries:

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

The output may include entries such as:

CentOS Linux 7 Rescue a0cbf86a6ef1416a8812657bb4f2b860 (4.9.0-1.el7.elrepo.x86_64)
CentOS Linux (4.9.0-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux (3.10.0-514.2.2.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-bf94f46c6bd04792a6a42c91bae645f7) 7 (Core)

Since the 4.9.0 entry is at position 1, configure it as default:

Restart and Confirm

Restart your system to apply the changes:

After the server reboots, reconnect and check the current kernel version again:

You should now see:

Step 2: Activating the BBR Congestion Control Mechanism

To switch on the BBR algorithm, you’ll need to adjust the system’s sysctl configuration settings as shown below:

echo 'net.core.default_qdisc=fq' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

After making these changes, you can verify that BBR has been properly enabled using the following commands:

sudo sysctl net.ipv4.tcp_available_congestion_control

This command should output something like:

net.ipv4.tcp_available_congestion_control = bbr cubic reno

Next, check which congestion control algorithm is currently active:

sudo sysctl -n net.ipv4.tcp_congestion_control

The expected output is:

To ensure the BBR kernel module is actively loaded, run this:

The terminal should return something similar to:

Step 3 (Optional): Verifying Network Speed Improvements with BBR

To determine the performance improvements achieved by BBR, you can conduct a file download test through a web browser from your desktop. Begin by installing and starting Apache HTTP Server:

sudo yum install httpd -y
sudo systemctl start httpd.service

Next, adjust your firewall settings to permit HTTP traffic:

sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload

Now create a dummy file for download testing:

cd /var/www/html
sudo dd if=/dev/zero of=500mb.zip bs=1024k count=500

Finally, open a browser on your local machine and navigate to:

http://[your-server-IP]/500mb.zip

This will allow you to download the test file and observe the download speed for performance assessment.

Conclusion

By following the steps above, you’ve successfully enabled BBR on your CentOS 7 server. This modern congestion control algorithm can significantly boost your server’s network throughput and minimize latency, especially under heavy traffic conditions. The process involves updating your kernel, modifying system configurations, and optionally testing performance improvements through a simple HTTP download.

Since BBR only requires changes on the sender side, it’s ideal for server administrators looking to optimize data transmission without making changes to clients or network infrastructure. With BBR now active, your server is better equipped to handle demanding network conditions with improved efficiency.

Source: vultr.com

Create a Free Account

Register now and get access to our Cloud Services.

Posts you might be interested in: