From 0bb9d90668c7c6c896b42b4d7ff5f9c16b18b0a3 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Wed, 7 Sep 2022 02:32:12 -0500 Subject: [PATCH] Enable TCP BBR - Improve VPN performance by enabling the TCP BBR congestion control algorithm on supported systems (e.g. Ubuntu 18.04+, Debian 10+, CentOS 8+) during VPN setup. References: https://cloud.google.com/blog/products/networking/tcp-bbr-congestion-control-comes-to-gcp-your-internet-just-got-faster https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/bbr.md --- vpnsetup_centos.sh | 6 ++++++ vpnsetup_ubuntu.sh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index c81c078..97188dd 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -549,6 +549,12 @@ net.core.rmem_max = 12582912 net.ipv4.tcp_rmem = 10240 87380 12582912 net.ipv4.tcp_wmem = 10240 87380 12582912 EOF + if modprobe -q tcp_bbr; then +cat >> /etc/sysctl.conf <<'EOF' +net.core.default_qdisc = fq +net.ipv4.tcp_congestion_control = bbr +EOF + fi fi } diff --git a/vpnsetup_ubuntu.sh b/vpnsetup_ubuntu.sh index ee6c566..dcc592b 100755 --- a/vpnsetup_ubuntu.sh +++ b/vpnsetup_ubuntu.sh @@ -499,6 +499,12 @@ net.core.rmem_max = 12582912 net.ipv4.tcp_rmem = 10240 87380 12582912 net.ipv4.tcp_wmem = 10240 87380 12582912 EOF + if modprobe -q tcp_bbr; then +cat >> /etc/sysctl.conf <<'EOF' +net.core.default_qdisc = fq +net.ipv4.tcp_congestion_control = bbr +EOF + fi fi }