Skip to content

Instantly share code, notes, and snippets.

@duzun
Last active May 14, 2024 18:53
Show Gist options
  • Save duzun/1503ebefbb208b9072ef85b7190364a4 to your computer and use it in GitHub Desktop.
Save duzun/1503ebefbb208b9072ef85b7190364a4 to your computer and use it in GitHub Desktop.
Enable TCP BBR
#!/bin/bash
#
# A script to enable TCP BBR on a Linux system.
#
# @author Dumitru Uzun (DUzun.Me)
# @version 1.0.0
# @distro ArchLinux/Manjaro
#
old_cc=`sysctl net.ipv4.tcp_congestion_control | awk -F= '{print $2}' | sed -e s/\^\\s//`
echo old tcp_congestion_control: $old_cc;
# if [[ $old_cc == "bbr" ]]; then
# exit 0;
# fi
available_cc=`sysctl net.ipv4.tcp_available_congestion_control`
if [[ $available_cc != *"bbr"* ]]; then
sudo modprobe tcp_bbr
available_cc=`sysctl net.ipv4.tcp_available_congestion_control`
if [[ $available_cc != *"bbr"* ]]; then
echo "Looks like your kernel doesn't support BBR :-("
exit 1;
fi
fi
sudo sysctl net.ipv4.tcp_congestion_control=bbr && \
echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.d/10-custom-kernel-bbr.conf && \
echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.d/10-custom-kernel-bbr.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment