TCP BBR Congestion Control & Linux Kernel Network Tuning
Enable Google BBR to accelerate cross-border transit, optimize Linux network socket buffers, and maximize throughput on AS4837, AS9929, and AS60068.
Cross-border transit links between Los Angeles and Asia-Pacific/China inherently experience moderate round-trip latency (130ms~170ms) and occasional mild packet drop. Traditional loss-based congestion algorithms like Cubic aggressively slash the TCP congestion window upon detecting minimal packet drops, collapsing throughput. Google BBR (Bottleneck Bandwidth and RTT) models the physical delivery rate and round-trip time, saturating the full link bandwidth even during periods of packet loss.
1. Checking Kernel Version and BBR Support
The BBR algorithm has been built into the Linux kernel since version 4.9. FlawlessNode official distributions (Debian 12/13, Ubuntu 24.04/26.04, Rocky Linux 9/10) ship with modern 6.x or 7.x kernels, offering full native support.
Connect to your instance via SSH and check the active kernel version:
uname -r
# Example output: 6.8.0-45-generic or 6.12.0-18-amd64
Inspect the currently active congestion control algorithm:
sysctl net.ipv4.tcp_congestion_control
# Standard default: net.ipv4.tcp_congestion_control = cubic
Verify that bbr is listed in the available congestion control modules:
sysctl net.ipv4.tcp_available_congestion_control
# Output should contain: reno cubic bbr
[!NOTE] If
bbris missing from the available list, manually load the kernel module:modprobe tcp_bbr. You can ensure it loads on boot by adding a linetcp_bbrto/etc/modules-load.d/bbr.conf.
2. Enabling BBR Congestion Control
Set the default queueing discipline to fq (Fair Queueing) and the TCP congestion algorithm to bbr:
# Write to a dedicated sysctl configuration file
cat << 'EOF' | sudo tee /etc/sysctl.d/99-bbr.conf
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
EOF
# Reload all sysctl settings immediately
sudo sysctl --system
Verifying BBR Activation
Run the following checks to confirm BBR is active:
sysctl net.ipv4.tcp_congestion_control
# Expected output: net.ipv4.tcp_congestion_control = bbr
lsmod | grep bbr
# Expected output: tcp_bbr 20480 14 (indicates the module is loaded and active)
Once bbr is shown, the TCP network stack is utilizing BBR for all outbound packet scheduling.
3. Kernel Network Tuning for High-Bandwidth, High-Latency Links
Enabling BBR prevents premature throughput throttling, but saturating a 1Gbps~2.5Gbps port over a 150ms round-trip latency requires increasing TCP socket buffers to match the Bandwidth-Delay Product (BDP).
Recommended Production Kernel Configuration
Create /etc/sysctl.d/99-flawlessnode-tuning.conf:
sudo cat << 'EOF' > /etc/sysctl.d/99-flawlessnode-tuning.conf
# =======================================================
# FlawlessNode High-Bandwidth & High-Concurrency Network Tuning
# =======================================================
# 1. BBR & Queue Discipline
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
# 2. Enable Window Scaling (RFC 1323)
net.ipv4.tcp_window_scaling = 1
# 3. Increase Core Socket Max Buffers (Supports 1Gbps+ transpacific links)
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.rmem_default = 1048576
net.core.wmem_default = 1048576
# 4. Tune TCP Buffer Allocations (min, default, max)
# For 150ms RTT / 1Gbps BDP (~18MB), set max to 64MB
net.ipv4.tcp_rmem = 4096 1048576 67108864
net.ipv4.tcp_wmem = 4096 1048576 67108864
# 5. Connection Queue & SYN Backlog Tuning
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 32768
net.ipv4.tcp_syncookies = 1
# 6. TIME_WAIT Socket Recycling
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_max_tw_buckets = 262144
# 7. TCP Fast Open (Reduces initial handshake latency)
net.ipv4.tcp_fastopen = 3
# 8. TCP Keepalive Optimization
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_keepalive_probes = 5
# 9. System File Descriptor Limit
fs.file-max = 2097152
EOF
Apply the new parameters:
sudo sysctl -p /etc/sysctl.d/99-flawlessnode-tuning.conf
[!TIP] With these optimizations applied, single-stream HTTP downloads, SCP file transfers, and reverse proxy throughput often see 300% to 800% speed improvements across transpacific links during peak network congestion periods.
4. Tuning User-Level File Descriptors (ulimit)
When serving high-traffic web applications with Nginx, Caddy, Node.js, Go, or proxy daemons, increase the allowed open file descriptors per process:
Edit /etc/security/limits.conf and append:
* soft nofile 1048576
* hard nofile 1048576
* soft nproc 524288
* hard nproc 524288
root soft nofile 1048576
root hard nofile 1048576
To ensure systemd services also inherit this elevated limit, configure /etc/systemd/system.conf and /etc/systemd/user.conf:
[Manager]
DefaultLimitNOFILE=1048576
Log out and back into your SSH session, then verify:
ulimit -n
# Expected output: 1048576
5. Reverting to Defaults
If you encounter protocol anomalies within specialized overlay networks (such as specific container CNI or encrypted tunneling encapsulation), revert to the Linux defaults:
sudo sysctl -w net.ipv4.tcp_congestion_control=cubic
sudo sysctl -w net.core.default_qdisc=pfifo_fast
# Remove the configuration files
sudo rm -f /etc/sysctl.d/99-bbr.conf /etc/sysctl.d/99-flawlessnode-tuning.conf