Skip to content

Instantly share code, notes, and snippets.

@recolic
Created September 1, 2017 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save recolic/965ff5bded3859d7cac716fe90099d24 to your computer and use it in GitHub Desktop.
Save recolic/965ff5bded3859d7cac716fe90099d24 to your computer and use it in GitHub Desktop.
One-key enable bbr.
#!/bin/bash
uname -r | grep -E '^4\.(1[^\.]|9)' > /dev/null
(( $? == 1 )) && echo 'Linux kernel version must >= 4.9' && exit 1
[[ `whoami` != root ]] && echo 'You must be root' && exit 1
lsmod | grep bbr > /dev/null
(( $? == 1 )) &&
modprobe tcp_bbr &&
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf &&
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf &&
sysctl -p
sysctl net.ipv4.tcp_available_congestion_control
sysctl net.ipv4.tcp_congestion_control
sysctl net.ipv4.tcp_congestion_control | grep bbr > /dev/null && echo 'Success.' || echo 'Failed.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment