Just run this in your terminal (works on root or non-root):
bash <(curl -fsSL https://raw.githubusercontent.com/emadtoranji/NetworkOptimizer/main/optimize.sh)- β
Enables Google's BBR congestion control (
tcp_bbr) β BBRv2 if using a patched kernel, otherwise defaults to BBRv1 - β
Configures
fqqueueing discipline for optimal performance - β Enables TCP Fast Open, MTU probing, and aggressive memory windows
- β Safe for production environments
- β
Writes clean configurations to
/etc/sysctl.d/ - β No external dependencies or systemd required
- β Easy to install and uninstall
β οΈ BBRv2 is not enabled by default in Linux. It requires a patched kernel such as BBRv2 backports.
- π§ Linux Kernel 5.4 or higher (recommended: 5.10+ for full BBRv2 support)
- π Root or
sudoaccess - π‘
bashshell (pre-installed on all major Linux distributions)
To check your kernel version:
uname -rAfter running the script, confirm BBR is active (usually BBRv1 unless you use a custom kernel with BBRv2 patches):
-
Check TCP congestion control:
sysctl net.ipv4.tcp_congestion_control
Expected output:
net.ipv4.tcp_congestion_control = bbr -
Verify BBR module:
lsmod | grep bbrExpected output:
tcp_bbr 20480 1 -
Inspect active TCP sessions:
ss -tin
Look for
bbrin the congestion control field.
While this script enables BBR (tcp_bbr), Linux does not currently offer a user-selectable distinction between BBRv1 and BBRv2. Most systems will run BBRv1 unless a custom kernel with BBRv2 support is used.
The script performs the following:
- Loads the
tcp_bbrkernel module - Configures module auto-loading on boot
- Creates
/etc/sysctl.d/99-bbrv2.confwith optimized settings:net.core.default_qdisc=fq net.ipv4.tcp_congestion_control=bbr net.ipv4.tcp_notsent_lowat=16384 net.ipv4.tcp_fastopen=3 net.ipv4.tcp_mtu_probing=1 net.ipv4.tcp_slow_start_after_idle=0 net.ipv4.tcp_window_scaling=1 net.ipv4.tcp_rmem=4096 87380 67108864 net.ipv4.tcp_wmem=4096 65536 67108864
- Applies changes instantly with
sysctl --system
To revert changes:
sudo rm -f /etc/sysctl.d/99-network-optimizer.conf
sudo rm -f /etc/modules-load.d/bbrv2.conf
sudo sysctl --system
sudo reboot| Distribution | Kernel | Status |
|---|---|---|
| Ubuntu 20.04 | 5.15.x | β |
| Ubuntu 22.04 | 5.19+ | β |
| Debian 11 | 5.10.x | β |
| Debian 12 | 6.1.x | β |
| AlmaLinux 9 | 5.14.x | β |
| Oracle Linux 8 | 5.15+ (UEK) | β |
| Alpine Edge | 6.1+ | β |
After enabling BBR (v1 or v2, depending on your kernel), you can expect:
- π Faster CDN/Cloudflare traffic
- π°οΈ Reduced SSH/RDP latency
- π¦ Improved TCP-based download speeds (HTTP, Git, APT/YUM, etc.)
- π‘ Enhanced stability for VPNs (WireGuard, OpenVPN, Shadowsocks)
- BBR not active: Ensure your kernel supports tcp_bbr (5.4+). BBRv2 requires experimental kernel patches and is not enabled by default in mainline kernels. Upgrade your kernel if needed:
sudo apt update && sudo apt install linux-generic-hwe-22.04 - Permission denied: Run the script with
sudo. - Module not found: Verify the
tcp_bbrmodule is available:modprobe tcp_bbr
This project is licensed under the MIT License. Feel free to use, fork, modify, and share!
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/YourFeature). - Commit your changes (
git commit -m 'Add YourFeature'). - Push to the branch (
git push origin feature/YourFeature). - Open a Pull Request.
Please ensure your changes are well-tested and include a description of the changes.