From db54638f5e9e4f32e57885f6eaec372dd8d9fdc4 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Thu, 8 Sep 2022 00:29:18 -0500 Subject: [PATCH] Check kernel version - Only enable TCP BBR congestion control if the server's Linux kernel version is 4.20 or newer. - BBR requires the "fq" qdisc for older kernels < 4.20. That setting may not take effect on existing network interfaces without a reboot. - References: https://github.com/google/bbr/blob/master/Documentation/bbr-quick-start.md 0bb9d90 --- vpnsetup_centos.sh | 3 ++- vpnsetup_ubuntu.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index 7b355c9..ec789fc 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -549,7 +549,8 @@ net.core.rmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 87380 16777216 EOF - if modprobe -q tcp_bbr; then + if modprobe -q tcp_bbr \ + && printf '%s\n%s' "4.20" "$(uname -r)" | sort -C -V; then cat >> /etc/sysctl.conf <<'EOF' net.core.default_qdisc = fq net.ipv4.tcp_congestion_control = bbr diff --git a/vpnsetup_ubuntu.sh b/vpnsetup_ubuntu.sh index fa55400..186b2db 100755 --- a/vpnsetup_ubuntu.sh +++ b/vpnsetup_ubuntu.sh @@ -499,7 +499,8 @@ net.core.rmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 87380 16777216 EOF - if modprobe -q tcp_bbr; then + if modprobe -q tcp_bbr \ + && printf '%s\n%s' "4.20" "$(uname -r)" | sort -C -V; then cat >> /etc/sysctl.conf <<'EOF' net.core.default_qdisc = fq net.ipv4.tcp_congestion_control = bbr