Shadowsocks 服务端配置
1. Install Shadowsocks (Python)
Section titled “1. Install Shadowsocks (Python)”CentOS
Section titled “CentOS”-
Install Python and Pip:
Terminal window yum install python3 python3-pip -
Install Shadowsocks:
Terminal window pip3 install shadowsocks-py -
Configure Firewall:
Open port 8388 (or your chosen port) for both TCP and UDP.
Terminal window firewall-cmd --zone=public --add-port=8388/tcp --permanentfirewall-cmd --zone=public --add-port=8388/udp --permanentfirewall-cmd --reload -
Create Configuration File:
Create
/etc/shadowsocks.jsonwith the following content:{"server": "0.0.0.0","server_port": 8388,"local_address": "127.0.0.1","local_port": 1080,"password": "your_password","timeout": 300,"method": "aes-256-cfb","fast_open": false}[!NOTE]
servershould be0.0.0.0to listen on all interfaces.methodcan beaes-256-cfb,chacha20-ietf-poly1305, etc., depending on support.rc4-md5is considered weak. -
Start Server:
To start the server manually:
Terminal window ssserver -c /etc/shadowsocks.json -d startTo auto-start on boot, add the command to
/etc/rc.local.
2. Install ShadowsocksR (SSR)
Section titled “2. Install ShadowsocksR (SSR)”Use the auto-install script for a quick setup.
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ssr.sh && chmod +x ssr.sh && bash ssr.shRecommended Settings during installation:
- Encryption:
none - Protocol:
auth_chain_a - Obfuscation:
plain - Compatible Mode:
n(No)
3. Enable Google BBR
Section titled “3. Enable Google BBR”Google BBR (Bottleneck Bandwidth and RTT) is a TCP congestion control algorithm that can significantly improve network throughput. It requires Linux kernel 4.9 or later.
CentOS 7
Section titled “CentOS 7”-
Check Current Kernel:
Terminal window uname -r -
Install ELRepo and Mainline Kernel:
Terminal window rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.orgrpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpmyum --enablerepo=elrepo-kernel install kernel-ml -y -
Update GRUB:
List available kernels:
Terminal window rpm -qa | grep kernelSet the new kernel (usually index 0) as default:
Terminal window egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'grub2-set-default 0 -
Reboot:
Terminal window reboot -
Enable BBR:
After rebooting, run:
Terminal window echo "net.core.default_qdisc=fq" >> /etc/sysctl.confecho "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.confsysctl -p -
Verify:
Terminal window sysctl -n net.ipv4.tcp_congestion_control# Output should be: bbrlsmod | grep bbr# Output should show tcp_bbr
Debian 9+ / Ubuntu 18.04+
Section titled “Debian 9+ / Ubuntu 18.04+”Newer Debian and Ubuntu versions usually come with kernel 4.9+.
-
Enable BBR:
Terminal window echo "net.core.default_qdisc=fq" >> /etc/sysctl.confecho "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.confsysctl -p -
Verify:
Terminal window lsmod | grep bbr