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

> Learn to set up a Shadowsocks server with V2Ray on Ubuntu/Debian. Follow this 6 step guide for a fast and secure connection using any standard Shadowsocks client.

- Repository: [如何翻墙/fanqiang](https://github.com/bannedbook/fanqiang)
- Tags: how-to-guide
- Published: 2026-09-06

---

**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`](https://github.com/bannedbook/fanqiang/blob/main//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`](https://github.com/bannedbook/fanqiang/blob/master/v2ss/%E8%B4%AD%E4%B9%B0Vultr%20VPS%E5%9B%BE%E6%96%87%E6%95%99%E7%A8%8B.md)

---

## Step 2: Connect via SSH and Enable BBR

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

```bash

# 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: 
- [`v2ss/SSH连接VPS教程.md`](https://github.com/bannedbook/fanqiang/blob/master/v2ss/SSH%E8%BF%9E%E6%8E%A5VPS%E6%95%99%E7%A8%8B.md)
- [`v2ss/最简单的Google BBR 一键加速VPS教程.md`](https://github.com/bannedbook/fanqiang/blob/master/v2ss/%E6%9C%80%E7%AE%80%E5%8D%95%E7%9A%84Google%20BBR%20%E4%B8%80%E9%94%AE%E5%8A%A0%E9%80%9FVPS%E6%95%99%E7%A8%8B.md)

---

## 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
bash <(curl -L -s https://install.direct/go.sh)

```

Or use the repository's documented method referencing [`v2ss/V2ray官方一键安装脚本.md`](https://github.com/bannedbook/fanqiang/blob/master/v2ss/V2ray%E5%AE%98%E6%96%B9%E4%B8%80%E9%94%AE%E5%AE%89%E8%A3%85%E8%84%9A%E6%9C%AC.md).

Verify installation:

```bash
v2ray -version

```

---

## Step 4: Configure Shadowsocks in V2Ray

Edit [`/etc/v2ray/config.json`](https://github.com/bannedbook/fanqiang/blob/main//etc/v2ray/config.json) to add a **Shadowsocks inbound**. The repository recommends **AEAD ciphers only** for security.

```json
{
  "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`](https://github.com/bannedbook/fanqiang/blob/master/v2ss/%E8%87%AA%E5%BB%BAShadowsocks%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%AE%80%E6%98%8E%E6%95%99%E7%A8%8B.md)

---

## Step 5: Verify and Restart V2Ray

Test your configuration before applying:

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

```

Expected output: `Configuration OK.`

Restart the service to apply changes:

```bash
systemctl restart v2ray
systemctl status v2ray

```

Check that your port is listening:

```bash
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/main/android/Shadowsocks.md)](https://github.com/bannedbook/fanqiang/blob/master/android/Shadowsocks.md) | APK download links, clipboard import, QR scan |
| Windows | [shadowsocks-windows releases](https://github.com/shadowsocks/shadowsocks-windows/releases) | Official client with GUI configuration |
| macOS | [ShadowsocksX-NG](https://github.com/shadowsocks/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`](https://github.com/bannedbook/fanqiang/blob/main//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`](https://github.com/bannedbook/fanqiang/blob/main//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