SHADOWSOCKS-LIBEV(8)

🌸 NAME 🌸

okay bestie, welcome to the Shadowsocks-libev Manual page for shadowsocks-libev β€” the lightweight and secure socks5 proxy, no cap. πŸ’…

It’s a port of the original shadowsocks created by clowwindy, and it’s written in pure C while taking advantage of libev to achieve both high performance and low resource consumption. ✨


✨ SYNOPSIS ✨

The whole squad lines up like this, exactly:

ss-local|ss-redir|ss-server|ss-tunnel|ss-manager [-s <server_host>] [-p <server_port>] [-l <local_port>] [-k <password>] [-m <encrypt_method>] [-f <pid_file>] [-t <timeout>] [-c <config_file>]

πŸ¦‹ DESCRIPTION πŸ¦‹

shadowsocks-libev is literally a lightweight and secure socks5 proxy. It’s a port of the original shadowsocks created by clowwindy, written in pure C, and it uses libev to get both high performance and low resource consumption. iconic behavior, honestly. πŸ‘‘

The squad has five components. ss-server(1) runs on a remote server and provides the secured tunnel service. ss-local(1) and ss-redir(1) are clients on your local machines that proxy traffic (TCP/UDP or both). ss-tunnel(1) is the tool for local port forwarding. 🫢

ss-local(1) works as a standard socks5 proxy, while ss-redir(1) works as a transparent proxy and requires netfilter’s NAT module. For more information, check out the EXAMPLE section, bestie. πŸ”₯

ss-manager(1) is the controller for multi-user management and traffic statistics, using a UNIX domain socket to talk with ss-server(1). It also provides a UNIX domain socket or IP based API for other software. For the details of this API, please refer to the PROTOCOL section. 🌈


πŸ‘‘ OPTIONS πŸ‘‘

Every flag, every caveat, every little detail β€” kept intact, fr fr:

  • -s <server_host> β€” sets the server’s hostname or IP. 🌐
  • -l <local_port> β€” sets the local port number. Not available in server nor manager mode. 🚫
  • -k <password>, --password <password> β€” sets the password. The server and the client should use the same password. πŸ”
  • --key <key_in_base64> β€” sets the key directly. The key should be encoded with URL-safe Base64. Not available in manager mode. πŸ—οΈ
  • -m <encrypt_method> β€” sets the cipher. shadowsocks-libev accepts 19 different ciphers: aes-128-gcm, aes-192-gcm, aes-256-gcm, rc4-md5, aes-128-cfb, aes-192-cfb, aes-256-cfb, aes-128-ctr, aes-192-ctr, aes-256-ctr, bf-cfb, camellia-128-cfb, camellia-192-cfb, camellia-256-cfb, chacha20-ietf-poly1305, xchacha20-ietf-poly1305, salsa20, chacha20 and chacha20-ietf. The default cipher is chacha20-ietf-poly1305. If built with PolarSSL or custom OpenSSL libraries, some of these ciphers may not work. 😭
  • -a <user_name> β€” runs as a specific user. πŸ‘€
  • -f <pid_file> β€” starts shadowsocks as a daemon with a specific pid file. 🧚
  • -t <timeout> β€” sets the socket timeout in seconds. The default value is 60. ⏳
  • -c <config_file> β€” uses a configuration file. πŸ“„
  • -n <number> β€” specifies the max number of open files. Not available in manager mode. Only available on Linux. 🐧
  • -i <interface> β€” sends traffic through a specific network interface. For example, there are three interfaces on your device: lo (127.0.0.1), eth0 (192.168.0.1) and eth1 (192.168.0.2). Meanwhile, you configure shadowsocks-libev to listen on 0.0.0.0:8388 and bind to eth1. That results in the traffic going out through eth1, but not lo nor eth0. This option is useful to control traffic in a multi-interface environment. Not available in redir mode. πŸ›°οΈ
  • -b <local_address> β€” specifies the local address to bind. For servers: specify the local address to use while this server is making outbound connections to remote servers on behalf of the clients. For clients: specify the local address to use while this client is making outbound connections to the server. Not available in manager mode. 🎯
  • -u β€” enables UDP relay. TPROXY is required in redir mode. You may need root permission. ⚑
  • -U β€” enables UDP relay and disables TCP relay. Not available in local mode. πŸ”„
  • -T β€” uses tproxy instead of redirect (for tcp). Only available in redir mode. πŸŒ€
  • -L <addr:port> β€” specifies the destination server address and port for local port forwarding. Only available in tunnel mode. πŸš‡
  • -d <addr> β€” sets up name servers for the internal DNS resolver (libc-ares). The default server is fetched from /etc/resolv.conf. Only available in server and manager mode. 🧠
  • --fast-open β€” enables TCP fast open. Not available in redir nor tunnel mode, with Linux kernel > 3.7.0. πŸš€
  • --reuse-port β€” enables port reuse. Only available with Linux kernel > 3.9.0. ♻️
  • --no-delay β€” enables TCP_NODELAY. πŸ“¨
  • --tcp-incoming-sndbuf <size> β€” sets the TCP send buffer size for incoming connections. Not available in manager mode. πŸ“₯
  • --tcp-incoming-rcvbuf <size> β€” sets the TCP receive buffer size for incoming connections. Not available in manager mode. πŸ“¦
  • --tcp-outgoing-sndbuf <size> β€” sets the TCP send buffer size for outgoing connections. Not available in manager mode. πŸ“€
  • --tcp-outgoing-rcvbuf <size> β€” sets the TCP receive buffer size for outgoing connections. Not available in manager mode. 🧺
  • --acl <acl_config> β€” enables ACL (Access Control List) and specifies the config file. Not available in redir nor tunnel mode. πŸ›‚
  • --manager-address <path_to_unix_domain> β€” specifies the UNIX domain socket address. Only available in server and manager mode. πŸ”Œ
  • --executable <path_to_server_executable> β€” specifies the executable path of ss-server. Only available in manager mode. 🧭
  • -D <path>, --workdir <path> β€” specifies the working directory of ss-manager. Only available in manager mode. πŸ“
  • --nftables-sets <family:table:set> β€” specifies nftables sets for reporting malicious IPs. Only available in server mode, when built with nftables support. πŸ›‘οΈ
  • -v β€” enables verbose mode. πŸ—£οΈ
  • -h|--help β€” prints the help message. πŸ’–
tiny note, bestie: -p <server_port> is in the synopsis above, but the original options list doesn’t give it its own description here β€” so I’m not inventing one. 🫢

πŸŽ€ CONFIG FILE πŸŽ€

Okay so the config file is written in JSON, and bestie, it is so easy to edit. Like, genuinely. No cap. ✨

The config file equivalent of the command line options is listed as an example below πŸ’– β€” one lil bullet per vibe, command line on the left, JSON on the right:

  • -s some.server.net β†’ "server": "some.server.net"
  • -s some.server.net -p 1234 (client) β†’ "server": "some.server.net:1234"
  • -p 1234 β†’ "server_port": "1234"
  • -b 0.0.0.0 β†’ "local_address": "0.0.0.0"
  • -b 10.0.0.2 β†’ "local_ipv4_address": "10.0.0.2"
  • -b 2620:129:35::33 β†’ "local_ipv6_address": "2620:129:35::33"
  • -l 4321 β†’ "local_port": "4321"
  • -k "PasSworD" β†’ "password": "PasSworD"
  • -m "aes-256-cfb" β†’ "method": "aes-256-cfb"
  • -t 60 β†’ "timeout": 60
  • -a nobody β†’ "user": "nobody"
  • --acl "/path/to/acl" β†’ "acl": "/path/to/acl"
  • --fast-open β†’ "fast_open": true
  • --reuse-port β†’ "reuse_port": true
  • --no-delay β†’ "no_delay": true
  • --plugin "obfs-server" β†’ "plugin": "obfs-server"
  • --plugin-opts "obfs=http" β†’ "plugin_opts": "obfs=http"
  • -6 β†’ "ipv6_first": true
  • -n "/etc/nofile" β†’ "nofile": "/etc/nofile"
  • -d "8.8.8.8" β†’ "nameserver": "8.8.8.8"
  • -L "somedns.net:53" β†’ "tunnel_address": "somedns.net:53"
  • -u β†’ "mode": "tcp_and_udp"
  • -U β†’ "mode": "udp_only"
  • no -u nor -U options (default) β†’ "mode": "tcp_only"
  • -T β†’ "tcp_tproxy": true
  • (only in ss-manager’s config) β†’ "port_password": {"1234":"PasSworD"}
πŸ‘€ Eyes on that last one β€” port_password is only a thing in ss-manager’s config. Don't come for me, I'm just the messenger 🫢

🌈 EXAMPLE 🌈

So ss-redir requires netfilter's NAT function β€” that's the whole vibe check it needs to pass. Here is an example πŸ’…:

# Create new chain
iptables -t nat -N SHADOWSOCKS
iptables -t mangle -N SHADOWSOCKS

# Ignore your shadowsocks server's addresses
# It's very IMPORTANT, just be careful.
iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN

# Ignore LANs and any other addresses you'd like to bypass the proxy
# See Wikipedia and RFC5735 for full list of reserved networks.
# See ashi009/bestroutetb for a highly optimized CHN route list.
iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN

# Anything else should be redirected to shadowsocks's local port
iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345

# Add any UDP rules
ip rule add fwmark 0x01/0x01 table 100
ip route add local 0.0.0.0/0 dev lo table 100
iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01

# Apply the rules
iptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS
iptables -t mangle -A PREROUTING -j SHADOWSOCKS

# Start the shadowsocks-redir
ss-redir -u -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid
πŸ’€ Real talk though β€” that 123.123.123.123 line is very IMPORTANT, so just be careful, okay? Like actually. Don't skip it. πŸ”₯

πŸ›°οΈ PROTOCOL (the actual fun part)

okay so ss-manager(1) is literally serving several APIs through a UDP protocol and honestly? iconic. here's the whole vibe πŸ‘‘

Send UDP commands in this exact format to the manager-address you handed to ss-manager(1):

command: [JSON data]

that's it, that's the whole handshake bestie πŸ’… like, command, colon, JSON. periodt.


πŸ’– To add a port

add: {"server_port": 8001, "password":"7cd308cc059"}

boom, new port, slay ✨ (copy that JSON exactly, the quotes and spacing are doing the lord's work)

πŸ—‘οΈ To remove a port

remove: {"server_port": 8001}

bye bye port, you had a good run 🫢

πŸ“ To receive a pong

ping

no JSON, no drama, just vibes. it's giving "just checking in" 😌


Then β€” and this is the good part β€” ss-manager(1) will send back the traffic statistics:

stat: {"8001":11370}

like it literally reports back with the numbers, main character energy fr fr πŸ”₯ (the key is the port, the value is the traffic stat β€” that's the shape of it, iykyk)

⚠️ heads up bestie: this is all UDP. no TCP, no retries, no little helping hand catching your packet if it gets lost. keep that in mind before you go trusting every ping πŸ’€

πŸ‘€ SEE ALSO

go read the rest of the family, they're all icons in their own right πŸŽ€


okay that's the whole page bestie, you made it to the end πŸŽ‰πŸ’– go forth and configure responsibly. this one's Shadowsocks-libev 3.3.6, dated 10/11/2026 β€” so yes, future-dated manual page, we stan a time traveler ⭐ no cap. mwah πŸ’‹πŸŒΈ