SS-REDIR(1)

πŸ’… SS-REDIR(1) β€” okay bestie, this is the shadowsocks-libev manual page, and yes we're reading it together 🫢

So this is ss-redir from the Shadowsocks-libev manual β€” it's the shadowsocks client as transparent proxy, libev port. Sit down, grab a drink, we're gonna get through it πŸ’–

✨ NAME ✨

ss-redir β€” shadowsocks client as transparent proxy, libev port. That's the whole vibe. She redirects, she proxies, she's transparent about it πŸ’…

🌸 SYNOPSIS 🌸

ss-redir [-uUv6] [-h|--help] [-s <server_host>] [-p <server_port>] [-l
<local_port>] [-k <password>] [-m <encrypt_method>] [-f <pid_file>] [-t
<timeout>] [-c <config_file>] [-b <local_address>] [-a <user_name>] [-n
<nofile>] [--mtu <MTU>] [--no-delay] [--plugin <plugin_name>]
[--plugin-opts <plugin_options>] [--password <password>] [--key
<key_in_base64>]

No cap, that's the whole shape of her πŸŽ€

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so β€” Shadowsocks-libev is a lightweight and secure socks5 proxy, and it's a port of the original shadowsocks created by clowwindy. It's written in pure C and it takes advantage of libev so it gets both high performance and low resource consumption. Like, obsessed. Main character energy fr πŸ”₯

Shadowsocks-libev consists of five components. ss-redir is the one that works as a transparent proxy on local machines to proxy TCP traffic β€” and here's the catch bestie, she requires netfilter's NAT module 😭. For more info, go check out shadowsocks-libev(8) and the EXAMPLE section below, iykyk.


πŸ’– OPTIONS πŸ’–

  • -s <server_host> β€” sets the server's hostname or IP. Where we're going ✈️
  • -p <server_port> β€” sets the server's port number.
  • -l <local_port> β€” sets the local port number.
  • -k <password>, --password <password> β€” sets the password. The server and the client should use the same password β€” like matching friendship bracelets but for crypto 🫢
  • --key <key_in_base64> β€” sets the key directly. The key should be encoded with URL-safe Base64.
  • -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 β€” she's the moment ⭐

Heads up bestie: if it's built with PolarSSL or custom OpenSSL libraries, some of these ciphers may not work. Not me finding that out the hard way πŸ’€
  • -a <user_name> β€” run as a specific user.
  • -f <pid_file> β€” start 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> β€” use a configuration file. Refer to shadowsocks-libev(8) CONFIG FILE section for more details.
  • -n <number> β€” specify max number of open files. Only available on Linux.
  • -b <local_address> β€” specify the local address to use while this client is making outbound connections to the server.
  • -u β€” enable UDP relay. TPROXY is required in redir mode, and you may need root permission πŸ‘‘
  • -U β€” enable UDP relay and disable TCP relay.
  • -T β€” use tproxy instead of redirect. (for tcp)
  • -6 β€” resolve hostname to IPv6 address first.
  • --mtu <MTU> β€” specify the MTU of your network interface.
  • --mptcp β€” enable Multipath TCP. Only available with MPTCP enabled Linux kernel.
  • --reuse-port β€” enable port reuse. Only available with Linux kernel > 3.9.0.
  • --no-delay β€” enable TCP_NODELAY.
  • --tcp-incoming-sndbuf <size> β€” set TCP send buffer size for incoming connections.
  • --tcp-incoming-rcvbuf <size> β€” set TCP receive buffer size for incoming connections.
  • --tcp-outgoing-sndbuf <size> β€” set TCP send buffer size for outgoing connections.
  • --tcp-outgoing-rcvbuf <size> β€” set TCP receive buffer size for outgoing connections.
  • --plugin <plugin_name> β€” enable SIP003 plugin. (Experimental) πŸ™ˆ
  • --plugin-opts <plugin_options> β€” set SIP003 plugin options. (Experimental)
  • -v β€” enable verbose mode. She talks now πŸ—£οΈ
  • -h|--help β€” print help message.

πŸ”₯ EXAMPLE πŸ”₯

ss-redir requires netfilter's NAT function β€” no NAT, no party. Here's 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 route add local default dev lo table 100
ip rule add fwmark 1 lookup 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
Bestie, that # It's very IMPORTANT, just be careful. comment is in the original and I'm keeping it because it's giving warnings from a wise elder 🌈 Don't skip the RETURN rules, fr fr.

πŸŽ€ SEE ALSO πŸŽ€

ss-local(1), ss-server(1), ss-tunnel(1), ss-manager(1), shadowsocks-libev(8), iptables(8), /etc/shadowsocks-libev/config.json β€” go read the whole friend group πŸ’œ


And that's the page! Here's the cute sign-off: this served you Shadowsocks-libev 3.3.6, dated 10/11/2026, and it's the SS-REDIR(1) page β€” slay, you read the whole thing, I'm so proud of you πŸ§šβœ¨πŸ“