This tutorial is only applicable to Ubuntu 16.04 and later versions. It is based on Python 3. Since the package manager pip3 corresponding to Python 3 is not pre-installed, first install pip3:
sudo apt install python3-pip
Install shadowsocks
sudo pip3 install https://github.com/shadowsocks/shadowsocks/archive/master.zip
**Check Shadowsocks version: **
sudo ssserver --version
New configuration file
sudo mkdir /etc/shadowsockssudo
vim /etc/shadowsocks/shadowsocks.json
Add configuration information for multiple users
//Multi-user{"server":"::","local_address":"127.0.0.1","local_port":1080,"port_password":{"8888":"123456789","9999":"123456789"},"timeout":300,"method":"aes-256-cfb","fast_open":false}
Add configuration information single user
//Single user{"server":"::","server_port":8388,"local_address":"127.0.0.1","local_port":1080,"password":"123456789","timeout":300,"method":"aes-256-cfb","fast_open":false}
Parameter Description:
server: Shadowsocks server address
server_port: Shadowsocks server port
local_address: local IP
local_port: local port
password: Shadowsocks connection password
timeout: waiting timeout time
method: encryption method
workers:Number of worker threads
fast_open: true or false
Configure auto-start
sudo vim /etc/systemd/system/shadowsocks.service
The content is as follows:
[ Unit]
Description=Shadowsocks
[ Service]
TimeoutStartSec=0
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks/shadowsocks.json
[ Install]
WantedBy=multi-user.target
sudo systemctl enable shadowsocks.service
sudo systemctl start shadowsocks.service
sudo systemctl status shadowsocks.service
At this point, Shadowsocks has been configured. The following part is the optimization of Shadowsocks[server] (https://cloud.tencent.com/product/cvm?from=10680) side.
BBR is the latest TCP congestion control algorithm developed by Google. It currently has a better bandwidth improvement effect, and is not even worse than the old brand's sharp speed. BBR was introduced in Linux kernel 4.9. First check the server kernel version:
uname -r
If the displayed version is below 4.9.0, you need to upgrade the Linux kernel, otherwise please ignore the following.
Update package manager:
sudo apt update
View the available Linux kernel versions:
sudo apt-cache showpkg linux-image
Find a Linux kernel version you want to upgrade, such as "linux-image-4.10.0-22-generic":
sudo apt install linux-image-4.10.0-22-generic
Wait for the installation to complete and restart the server:
sudo reboot
Delete the old Linux kernel:
sudo purge-old-kernels
Open BBR, run lsmod | grep bbr, if there is no tcp_bbr in the result, run first:
modprobe tcp_bbrecho "tcp_bbr">>/etc/modules-load.d/modules.conf
run:
echo "net.core.default_qdisc=fq">>/etc/sysctl.confecho "net.ipv4.tcp_congestion_control=bbr">>/etc/sysctl.conf
run:
sysctl -p
Save takes effect. run:
sysctl net.ipv4.tcp_available_congestion_controlsysctl net.ipv4.tcp_congestion_control
If both have bbr, then BBR is successfully turned on.
For more high-quality content, please pay attention to [Youth Coder]
Recommended Posts