From 651c404bf6f30f5ba3bd866450a7e0e83b2ca2ad Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Sun, 20 Nov 2022 15:01:44 -0600 Subject: [PATCH] Improve sysctl settings - For enabling TCP BBR congestion control, add a check to make sure tcp_congestion_control exists. --- 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 26b6a0f..6cb5eb4 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -578,7 +578,8 @@ net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 87380 16777216 EOF if modprobe -q tcp_bbr \ - && printf '%s\n%s' "4.20" "$(uname -r)" | sort -C -V; then + && printf '%s\n%s' "4.20" "$(uname -r)" | sort -C -V \ + && [ -f /proc/sys/net/ipv4/tcp_congestion_control ]; 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 75f8afe..a8eea7c 100755 --- a/vpnsetup_ubuntu.sh +++ b/vpnsetup_ubuntu.sh @@ -559,7 +559,8 @@ net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 87380 16777216 EOF if modprobe -q tcp_bbr \ - && printf '%s\n%s' "4.20" "$(uname -r)" | sort -C -V; then + && printf '%s\n%s' "4.20" "$(uname -r)" | sort -C -V \ + && [ -f /proc/sys/net/ipv4/tcp_congestion_control ]; then cat >> /etc/sysctl.conf <<'EOF' net.core.default_qdisc = fq net.ipv4.tcp_congestion_control = bbr