Introduction and Summary:
Shadowsocks uses the TCP protocol for transmitting information over the Internet. A new "congestion algorithm" has been released by Google that shows good potential for increasing maximum speeds for Shadowsocks, TCP BBR. Newer Linux Kernels support BBR natively, so the basic instructions below update your server to a recent kernel and then switch the TCP congestion controls to BBR. This only needs to be done on the server side; the client will receive TCP traffic control information from the server automatically.Note: This only works on servers that you have full control of, like a dedicated server or a KVM VPS. It will not work on OpenVZ VPS's or similar types of virtualization environments since you cannot modify most networking settings or the core OS.
Prerequisites:
- Linux Ubuntu 16.04 LTS Server
- Console Access
- Root level permissions
- The following Ubuntu packages (some might be obsolete or unnecessary, send me a message if you discover an improvement): wget
Instructions:
1. Update the Ubuntu Linux Kernel to the most recent generic release (Note: The minimum kernel is v4.9 - feel free to use newer or older kernels if you want. You can browse the current kernel builds here: http://kernel.ubuntu.com/~kernel-ppa/mainline/)sudo apt install linux-image-generic-hwe-16.04-edge
2. The server will reboot. Sign-in to the server again (console, ssh, etc.)
3. Enable BBR congestion algorithm
echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
4. Now check the results; you should see bbr as the current congestion control setting.
sysctl net.ipv4.tcp_available_congestion_control
sysctl net.ipv4.tcp_congestion_control
lsmod | grep bbr
5. Reboot the server to finalize the new settings
sudo reboot
Blog Formatting Guide:
- Commands written in Consolas in BLUE are LOCAL Client Shell Commands (I'm running an Ubuntu local client)
- Commands written in Consolas in RED are REMOTE Server Shell Commands (usually in SSH)
- All commands in Courier and BOLD are CUSTOM user variables that your should change for your configuration.
- All text written in Courier and PURPLE are file contents as shown in a text editor.
Helpful References, for Shadowsocks:
Shadowsocks-libev on GithubUbuntu Server documentation on Mainline Kernel implementations
Google's BBR code on Github
Google blog post on BBR
ACM.org blog post on BBR