Skip to content

Instantly share code, notes, and snippets.

@Franco-Poveda
Created August 23, 2017 00:08
Show Gist options
  • Save Franco-Poveda/03ba54a55bb27febba39f8dc3754bfed to your computer and use it in GitHub Desktop.
Save Franco-Poveda/03ba54a55bb27febba39f8dc3754bfed to your computer and use it in GitHub Desktop.
This script enables TCP BBR congestion control. If current linux kernel has no build in BBR support, a newer one is installed.
#!/bin/bash
currentver="$(uname -r | cut -d"-" -f1)"
requiredver="4.9.0"
if [ "$(printf "$requiredver\n$currentver" | sort -V | head -n1)" == "$currentver" ] && [ "$currentver" != "$requiredver" ]; then
echo "No BBR suport in current kernel - installing a newer linux kernel"
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11/linux-headers-4.11.0-041100_4.11.0-041100.201705041534_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11/linux-headers-4.11.0-041100-generic_4.11.0-041100.201705041534_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11/linux-image-4.11.0-041100-generic_4.11.0-041100.201705041534_amd64.deb
dpkg -i linux-headers-4.11.0-041100* linux-image-4.11.0-041100-generic_4.11.0-041100.201705041534_amd64.deb
rm *.deb
else
echo "TCP BBR supported on current linux kernel - no need to upgrade"
fi
touch /etc/sysctl.d/11-custom-kernel-bbr.conf
echo "net.core.default_qdisc=fq" >> /etc/sysctl.d/11-custom-kernel-bbr.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.d/11-custom-kernel-bbr.conf
sysctl --system
echo "enjoy the super speed :-D"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment