ShadowSocks Rust 的配置与优化

五一期间重新整理了家里的网络,目标是看 4K 流媒体不卡顿。既然服务器要重新配置,干脆将旧方案迁移到新的 shadowsocks-rust 上。 系统更新 1 sudo apt update && sudo apt upgrade 安装并配置 SS 方案一:通过 Cargo 编译安装 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # 安装 Rust 工具链 curl https://sh.rustup.rs -sSf | sh # 配置 Cargo 环境变量(写入 .profile / .bash_profile 等) # CARGO_HOME 指定 Cargo 安装路径 # target-cpu=native 让 rustc 为目标 CPU 生成优化代码 CARGO_HOME=/root/cargo RUSTFLAGS="-C target-cpu=native" source .profile # 安装编译依赖 sudo apt install build-essential # 安装 shadowsocks-rust cargo install shadowsocks-rust 方案二:直接下载预编译二进制 1 2 3 4 wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.14.3/shadowsocks-v1.14.3.x86_64-unknown-linux-gnu.tar.xz tar -xf shadowsocks-v1.14.3.x86_64-unknown-linux-gnu.tar.xz cp ssserver /usr/local/bin chmod a+x /usr/local/bin/ssserver 配置文件 1 2 mkdir /etc/shadowsocks vi /etc/shadowsocks/config.json 1 2 3 4 5 6 { "server": "::", "server_port": 8888, "method": "aes-256-gcm", "password": "pw" } 测试运行: ...

2022年5月6日 · 2 分钟 · haoxiqiang

Shadowsocks 的配置与优化

最近办公室网络波动影响工作,在 VPS 上重新搭建了一套 Shadowsocks 用来拉取源码。以下步骤适用于大多数 Linux 发行版,已在 Ubuntu 16.04 和 18.04 上测试通过。 2024 更新说明: 本文使用的 Python 版 shadowsocks 已停止维护。推荐使用 shadowsocks-rust,它是当前官方活跃维护的实现,性能更好且支持现代加密协议。如从零开始搭建,建议直接参考 shadowsocks-rust 官方文档。下文仍保留 Python 版步骤供参考。 基础环境准备 1 apt update && apt upgrade -y 安装并配置 Shadowsocks (Python 版) 安装 1 2 apt install python3-pip -y pip3 install https://github.com/shadowsocks/shadowsocks/archive/master.zip 配置文件 1 2 mkdir /etc/shadowsocks vi /etc/shadowsocks/config.json 1 2 3 4 5 6 7 8 9 10 { "server":"::", "server_port":8888, "local_address": "127.0.0.1", "local_port":1080, "password":"your-password", "timeout":300, "method":"aes-256-cfb", "fast_open": true } 防火墙配置 1 2 3 4 5 iptables -I INPUT -p tcp --dport 8888 -j ACCEPT iptables -I INPUT -p udp --dport 8888 -j ACCEPT # 如果使用 UFW,则执行: ufw allow 8888 测试运行 1 ssserver -c /etc/shadowsocks/config.json 启用 BBR 加速 BBR (Bottleneck Bandwidth and Round-trip propagation time) 是 Google 开发的 TCP 拥塞控制算法,能显著提升网络吞吐量。 ...

2019年12月31日 · 3 分钟 · haoxiqiang