How to Set Up a Shadowsocks Server Using V2Ray: Complete 6-Step Guide

The fastest way to set up a Shadowsocks server is to install V2Ray on a fresh Ubuntu/Debian VPS, enable the built-in Shadowsocks inbound in /etc/v2ray/config.json, and connect with any standard Shadowsocks client.

The fanqiang repository by bannedbook provides battle-tested, cross-platform documentation for deploying Shadowsocks without relying on the legacy shadowsocks-libev server. This guide walks you through the exact workflow used in the repository, from VPS purchase to client connection.


Why Use V2Ray for Shadowsocks Server Setup?

V2Ray's native Shadowsocks implementation offers advantages over standalone servers:

  • AEAD cipher support: aes-256-gcm, chacha20-ietf-poly1305, and other modern encryption methods
  • Single binary management: One service handles multiple protocols
  • Better stability: Avoids DNS error crashes common in shadowsocks-libev

According to the fanqiang source code, V2Ray's Shadowsocks module receives more active maintenance and security updates than the original C implementation.


Step 1: Acquire a VPS

Choose any cloud provider. The repository specifically references:

  • Vultr (recommended for hourly billing and global locations)
  • 搬瓦工 (BandwagonHost) for budget-friendly options

Create a fresh Ubuntu 20.04+ or Debian 11+ instance with at least 512MB RAM.

Reference: v2ss/购买Vultr VPS图文教程.md


Step 2: Connect via SSH and Enable BBR

Log into your server and optionally enable Google's BBR congestion control for improved throughput:


# SSH connection

ssh root@YOUR_VPS_IP

# Enable BBR (one-line install from repository)

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh

References:


Step 3: Install V2Ray with Shadowsocks Support

Run the official V2Ray one-click installer. This downloads a single binary with native Shadowsocks protocol support:

bash <(curl -L -s https://install.direct/go.sh)

Or use the repository's documented method referencing v2ss/V2ray官方一键安装脚本.md.

Verify installation:

v2ray -version

Step 4: Configure Shadowsocks in V2Ray

Edit /etc/v2ray/config.json to add a Shadowsocks inbound. The repository recommends AEAD ciphers only for security.

{
  "log": {
    "loglevel": "warning",
    "access": "/dev/null",
    "error": "/dev/null"
  },
  "inbounds": [
    {
      "port": 51888,
      "protocol": "shadowsocks",
      "settings": {
        "method": "aes-256-gcm",
        "password": "YOUR_STRONG_PASSWORD",
        "network": "tcp,udp",
        "level": 0
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "allowed"
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "routing": {
    "rules": [
      {
        "domain": ["google.com", "apple.com", "oppomobile.com"],
        "type": "field",
        "outboundTag": "allowed"
      },
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
      }
    ]
  }
}

Critical configuration values:

Parameter Recommended Value Notes
port 51888 or custom Must be open in firewall/Security Group
method aes-256-gcm AEAD cipher; avoid deprecated aes-256-cfb
password 16+ random characters Shared secret between server and client
network tcp,udp Enables full UDP relay for QUIC/DNS

Reference: v2ss/自建Shadowsocks服务器简明教程.md


Step 5: Verify and Restart V2Ray

Test your configuration before applying:

v2ray -test -config /etc/v2ray/config.json

Expected output: Configuration OK.

Restart the service to apply changes:

systemctl restart v2ray
systemctl status v2ray

Check that your port is listening:

ss -tlnp | grep v2ray

Step 6: Configure Shadowsocks Clients

Import your server details into any standard Shadowsocks client using:

  • Server: YOUR_VPS_IP
  • Port: 51888 (or your custom port)
  • Password: YOUR_STRONG_PASSWORD
  • Encryption: aes-256-gcm

Client Resources from the Repository

Platform File Key Details
Android [android/Shadowsocks.md](https://github.com/bannedbook/fanqiang/blob/master/android/Shadowsocks.md) APK download links, clipboard import, QR scan
Windows shadowsocks-windows releases Official client with GUI configuration
macOS ShadowsocksX-NG Community-recommended fork

Security Best Practices for Shadowsocks Server Setup

  • Use AEAD ciphers only: aes-256-gcm, chacha20-ietf-poly1305, or xchacha20-ietf-poly1305. Legacy stream ciphers (rc4-md5, aes-256-cfb) are cryptographically broken.
  • Randomize your port: Avoid default ports like 8388 to reduce automated scanning.
  • Enable firewall rules: Restrict inbound to your client IP ranges when possible.
  • Rotate passwords regularly: Treat Shadowsocks passwords like SSH credentials.

Troubleshooting Common Issues

Symptom Cause Solution
Connection refused Port blocked or V2Ray down Check ufw/iptables, verify systemctl status v2ray
Authentication failed Cipher mismatch or wrong password Confirm client and server use identical method and password
Slow speeds No BBR, or CPU throttling Enable BBR, verify AES-NI support with lscpu | grep aes
DNS leaks Client misconfiguration Enable "Remote DNS" in client settings

Summary

  • V2Ray bundles Shadowsocks: A single binary handles both protocols with modern AEAD encryption
  • Six-step deployment: VPS → SSH → BBR → Install → Configure → Connect
  • Key file: /etc/v2ray/config.json with protocol: "shadowsocks" inbound
  • Recommended cipher: aes-256-gcm for balance of speed and security
  • Repository authority: All steps validated against bannedbook/fanqiang source documentation

Frequently Asked Questions

What port should I use for Shadowsocks?

Use any high port between 10000-65535. The repository examples use 51888, but any unused port works. Avoid 8388 (default) to reduce automated probing. Update your cloud provider's Security Group/firewall to allow inbound TCP and UDP on your chosen port.

Is V2Ray's Shadowsocks implementation compatible with standard clients?

Yes. V2Ray implements the standard Shadowsocks protocol with AEAD extensions. It works with Shadowsocks-Android, shadowsocks-windows, Shadowrocket (iOS), and any client supporting aes-256-gcm or chacha20-ietf-poly1305. The client does not need V2Ray-specific software.

Why does the fanqiang repository recommend V2Ray over shadowsocks-libev?

V2Ray's Shadowsocks module receives more frequent security updates and handles edge cases (particularly DNS resolution failures) without the crash bugs affecting shadowsocks-libev. Additionally, running one V2Ray binary simplifies server management if you later add VMess or Trojan protocols.

How do I migrate from an existing shadowsocks-libev server?

  1. Stop shadowsocks-libev: systemctl stop shadowsocks-libev && systemctl disable shadowsocks-libev
  2. Install V2Ray and configure the same port, password, and method in /etc/v2ray/config.json
  3. Update clients only if you change cipher (modern clients prefer AEAD)
  4. No client-side changes needed if parameters remain identical

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →