Home  >  All Categories  >  Dev  >  Shadowsocks Rust Setup for Debian

Shadowsocks Rust Setup for Debian

Shadowsocks Repo: https://github.com/shadowsocks/shadowsocks-rust

Setup rust first: Debian 初始化 Rust 环境

Install🔗

rustup default nightly
cargo install shadowsocks-rust

Configure🔗

mkdir ss

Server config sample:

{
  "servers": [
    {
      "address": "::",
      "port": 9982,
      "method": "chacha20-ietf-poly1305",
      "password": "strong-password",
      "mode": "tcp_and_udp",
      "fast_open": false,
      "timeout": 7200
    }
  ]
}

Add as a system service🔗

sudo vim /etc/systemd/system/ss.service

Note: Change username to your own username

[Unit]
Description=ssserver service
After=network.target

[Service]
ExecStart=/home/username/.cargo/bin/ssserver -c /home/username/ss/config.json
ExecStop=/usr/bin/killall ssserver
Restart=on-failure
StandardOutput=syslog               # Output to syslog
StandardError=syslog                # Output to syslog
SyslogIdentifier=ss
User=username
Group=admin

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now ss

Run🔗

Status🔗

sudo systemctl status ss

Stop🔗

sudo systemctl stop ss

Update🔗

cargo install shadowsocks-rust

Multiple Ports🔗

Also see here

sudo iptables -t nat -A PREROUTING -p tcp --dport 12000:12010 -j REDIRECT --to-port 9982
sudo iptables -t nat -A PREROUTING -p udp --dport 12000:12010 -j REDIRECT --to-port 9982

Show if success:🔗

sudo iptables -t nat -L PREROUTING -nv --line-number

Delete the rule:🔗

sudo iptables -t nat -D PREROUTING <number>

Other Resources🔗

Category: Dev 
TagsTools
Published:  · Updated:   📝 Edit this page

该博客没有评论系统,我正在实验有意义的讨论是否更易在社群中发生,不知道为什么,人在社群中,似乎会有更好的行为规范。然后如果有高质量的讨论,我会手动再精选到原文。为此,我建立了一个 Telegram 讨论群组,你可以在里面讨论这篇文章,点此复制文章标题和链接