If we’re running a web server, streaming service, or any application that demands fast and reliable data transfer, congestion control becomes a major factor in network performance. Traditional congestion control algorithms like Reno or Cubic are widely used, but newer algorithms like TCP BBR (Bottleneck Bandwidth and Round-trip propagation time) can significantly increase throughput and reduce latency.
Let’s explore what TCP BBR is, how it works, and how we can configure it on Ubuntu to improve our traffic performance.
What is TCP BBR?
TCP BBR is a modern congestion control algorithm developed by Google. Unlike traditional algorithms that rely on packet loss as a signal of congestion, BBR estimates the available bandwidth and round-trip time (RTT) to make smarter decisions. It maintains high throughput and low latency even in high-speed networks or lossy environments.
Key benefits of BBR:
- Avoids bufferbloat by controlling queuing delay
- Achieves faster recovery in high-latency or high-loss networks
- Improves video streaming, file transfers, and general web traffic performance
BBR is supported in the Linux kernel 4.9 and later, and is available by default in all modern Ubuntu distributions.
Step-by-Step: Enable TCP BBR on Ubuntu
Prerequisites
Before we begin, let’s ensure we have the following in place:
- A Ubuntu 24.05 dedicated server or KVM VPS.
- A basic programming knowledge.
Understanding and Configuring TCP BBR Congestion Control on Ubuntu for Faster Traffic
Let’s walk through enabling and verifying TCP BBR on our Ubuntu server or desktop.
Step 1: Check Linux Kernel Version
First, we must ensure our kernel version is 4.9 or higher.
uname -r
If our version is below 4.9, we need to upgrade the kernel before proceeding. Most Ubuntu LTS releases after 18.04 already meet this requirement.
Step 2: Check If BBR Is Already Enabled
Run the following to see the current congestion control algorithm:
sysctl net.ipv4.tcp_congestion_control
If the output is bbr, it’s already active. Otherwise, let’s proceed to enable it.
Also, verify if BBR is supported:
sysctl net.ipv4.tcp_available_congestion_control
This should show a list including bbr. If not, we may need to upgrade our kernel or check module loading.
Step 3: Load BBR Kernel Module
Load the BBR module using the modprobe command:
sudo modprobe tcp_bbr
To ensure it loads automatically at boot:
echo 'tcp_bbr' | sudo tee -a /etc/modules-load.d/modules.conf
Step 4: Set BBR as the Default Congestion Control
Edit or append the following lines in the sysctl configuration file:
sudo nano /etc/sysctl.conf
Add these lines at the bottom:
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
Apply changes:
sudo sysctl -p
Step 5: Verify That BBR Is Active
Let’s confirm BBR is running:
sysctl net.ipv4.tcp_congestion_control
Output should be:
net.ipv4.tcp_congestion_control = bbr
Also, we can verify it's in use with:
lsmod | grep bbr
And check network stats:
sudo sysctl net.ipv4.tcp_available_congestion_control
sudo sysctl net.ipv4.tcp_congestion_control
Optional: Benchmarking Performance Gains
To see the real impact, we can benchmark before and after enabling BBR using tools like:
- iperf3 for raw throughput testing
- ping for latency comparison
- curl -w for measuring file download times
Example:
iperf3 -c <remote_server_ip>
We should notice higher throughput and lower variation in latency.
Advanced: BBR v2 and Custom Tuning
As of kernel 5.4+, BBR v2 is in experimental stages and aims to handle fairness with competing Cubic flows more effectively.
To test BBR v2:
- Requires a custom kernel with BBRv2 support.
- Needs setting additional sysctl tuning options (advanced use only).
Unless we need bleeding-edge optimization, the standard BBR (v1) is reliable and production-safe.
Final Thoughts on Security and Compatibility
BBR doesn’t introduce security vulnerabilities, but we must ensure compatibility with middleboxes, proxies, or VPNs. Some edge devices may misinterpret newer congestion patterns, although this is rare today.
1. Benchmarking Tools to Measure TCP BBR Performance
Once BBR is enabled, we need reliable tools to measure its actual impact.
Tool 1: iperf3 (Bandwidth Test)
Installation:
sudo apt install iperf3 -y
Usage (on Server):
iperf3 -s
Usage (on Client):
iperf3 -c <server_ip>
Key Metrics:
- Throughput (in Mbps)
- Retransmissions (should be minimal with BBR)
Tool 2: ping (Latency Check)
Run:
ping -c 10 google.com
Look for:
- Lower average latency
- Reduced packet loss
Tool 3: curl (Web Download Speed)
curl -o /dev/null -s -w "%{time_starttransfer}\n" https://speed.example.com/100MB.bin
Lower time_starttransfer
means better congestion control.
Tool 4: nload or bmon (Real-Time Traffic Visualization)
sudo apt install nload bmon -y
nload
bmon
Useful during iperf3 or download testing to watch live bandwidth usage.
2. Automating BBR Setup
Option 1: Shell Script to Auto-Configure BBR
Save this as enable_bbr.sh
:
#!/bin/bash
echo "🔧 Enabling TCP BBR Congestion Control..."
# Load module
sudo modprobe tcp_bbr
# Persist BBR in sysctl
sudo tee -a /etc/sysctl.conf > /dev/null <<EOL
# TCP BBR Settings
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
EOL
# Apply changes
sudo sysctl -p
# Load BBR at boot
echo "tcp_bbr" | sudo tee -a /etc/modules-load.d/modules.conf
# Confirm status
echo "✅ Current TCP Congestion Control:"
sysctl net.ipv4.tcp_congestion_control
echo "✅ Available Congestion Algorithms:"
sysctl net.ipv4.tcp_available_congestion_control
Run it:
chmod +x enable_bbr.sh
./enable_bbr.sh
2: Ansible Playbook to Enable TCP BBR
Create enable_bbr.yml
:
nano enable_bbr.yml
Add content:
---
- name: Enable TCP BBR on Ubuntu
hosts: all
become: yes
tasks:
- name: Ensure tcp_bbr module is loaded
modprobe:
name: tcp_bbr
state: present
- name: Add BBR to /etc/modules-load.d
lineinfile:
path: /etc/modules-load.d/modules.conf
line: tcp_bbr
create: yes
- name: Set BBR parameters in sysctl
blockinfile:
path: /etc/sysctl.conf
marker: "# {mark} TCP BBR CONFIG"
block: |
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
- name: Apply sysctl changes
command: sysctl -p
Run it:
ansible-playbook -i inventory enable_bbr.yml
Replace inventory with your target server IP or hostname inventory file.
Pro Tip: Automate Benchmark After Setup
Add this to your script or Ansible playbook as a post-step:
echo "Testing BBR bandwidth with iperf3..."
iperf3 -c speedtest.serverius.net -t 10
Summary
- TCP BBR helps our Ubuntu systems achieve faster data transfer with less delay.
- Works by modeling network bandwidth and RTT instead of relying on packet loss.
- Easy to enable with kernel version 4.9+.
- Ideal for web servers, video streaming, VPNs, and high-traffic applications.
Enabling BBR is a one-time performance upgrade that benefits almost every workload running on Ubuntu.