V2Ray setup 2026: VMess and VLESS, step by step

Complete guide: set up V2Ray with VMess and VLESS protocols to bypass censorship in China, Iran, Russia. More stable than Shadowsocks in 2026. Includes server config, client apps (Windows/Mac/Android/iOS).

By Eric GerardFounder · VPNSmith - Self-host VPN & GDPR VPS specialist

Updated 13 min read13 min

Affiliate links: we may earn a commission, at no extra cost to you. Method

See the installation stepsGenerate my REALITY config

Plain WireGuard packet blocked by DPI, VLESS + REALITY packet passing as HTTPS to microsoft.comDPIWG UDP 51820plain WireGuardsignature matchflow droppedTCP 443 TLS 1.3SNI microsoft.comYOUR VPSXray REALITYlooks like HTTPSprobe gets the real microsoft cert
fig. 01 / tunneling-obfuscation

Quick answer: for China, Iran or Russia in 2026, run Xray-core (the maintained V2Ray fork) with VLESS + REALITY on a small VPS such as Contabo: your traffic then looks like ordinary HTTPS to a well-known site. VMess + WebSocket + TLS stays the compatible fallback. Both configs, the clients (v2rayNG, Shadowrocket, v2rayN) and the fixes are below.

Plain WireGuard packet blocked by DPI, VLESS + REALITY packet passing as HTTPS to microsoft.comDPIWG UDP 51820plain WireGuardsignature matchflow droppedTCP 443 TLS 1.3SNI microsoft.comYOUR VPSXray REALITYlooks like HTTPSprobe gets the real microsoft cert
fig. 01 / tunneling-obfuscation

Free tools, run in your browser: the VLESS REALITY config generator (keys, UUID, server and client files) and the VMess / VLESS link converter (decodes a vmess:// or vless:// link and flags security=none or a missing pbk).

VMess vs VLess vs Xray: picking the right tool

VMess (V2Ray, 2015): the historical protocol. Application-layer encryption inside V2Ray + UUID + alterId for auth. Robust but "marked": its fingerprint eventually became detectable by advanced DPI since 2021.

VLess (V2Ray, 2020): lighter version. No application-layer encryption (we delegate everything to TLS), no alterId, UUID alone for auth. Faster (less compute), stealthier (no characteristic "VMess signature").

Xray-core (RPRX fork, 2021): a more actively maintained V2Ray fork, which introduced XTLS (optimized TLS without double encryption) then REALITY (borrows the cert of a target site). In 2026, Xray-core is technically superior for China. Deciding between the focused Xray core and the all-in-one sing-box core? See our sing-box vs Xray comparison.

2026 recommendation:

  • New setup, China focus: Xray-core + VLess + REALITY.
  • New setup, rest of the world (Iran, Russia, corporate): Xray-core + VLess + WS + TLS (or VMess for compat).
  • Maintaining an existing setup: stay on V2Ray + VMess + WS + TLS, it still works very well outside aggressive GFW.

For the rest, we install Xray-core (which supports VMess + VLess + Trojan + SS in the same binary - strictly more complete than V2Ray-core).

Xray-core install on a Contabo VPS

Contabo Cloud VPS 4 (4 vCPU, 8 GB RAM, €5.50/month, see deal) on Ubuntu 24.04. For China, pick the Singapore or Tokyo datacenter; for Iran/Turkey, Düsseldorf or Nuremberg; for Russia, same Europe. If you would rather have a US host with a 30-day money-back guarantee, Ultahost VPS Basic is 5.52 $ a month on a 24-month term (1 GB RAM, dedicated IPv4, read on 21 October 2026).

Bank card declined? Ultahost also takes Bitcoin and other cryptocurrencies, Alipay, WeChat Pay and Qiwi (its payments page, read on 25 October 2026). This is an affiliate link; check its terms for your country before ordering.

Step 1 - Official install script

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install

The script installs Xray in /usr/local/bin/xray, creates a xray.service systemd unit, and drops the default config into /usr/local/etc/xray/config.json. Verify:

xray version
systemctl status xray

Step 2 - Domain and TLS cert (for VMess/VLess + WS + TLS)

Prerequisite: cdn.yourdomain.com pointing to the VPS IP. This guide uses Caddy as reverse proxy for automatic Let's Encrypt management:

apt update && apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
apt update && apt install -y caddy

For REALITY, no domain required - REALITY borrows the cert of a target site. One of the major advantages for fast deployments.

Config 1: VMess + WebSocket + TLS

This is the "2020-2023 classic" config that still passes very well in 2026 outside of aggressive GFW. Compatible with all historical V2Ray clients.

/usr/local/etc/xray/config.json:

{
  "log": { "loglevel": "warning" },
  "inbounds": [
    {
      "port": 10000,
      "listen": "127.0.0.1",
      "protocol": "vmess",
      "settings": {
        "clients": [
          { "id": "UUID-CLIENT-1-GENERATE", "alterId": 0, "email": "user1@vpnsmith" },
          { "id": "UUID-CLIENT-2-GENERATE", "alterId": 0, "email": "user2@vpnsmith" }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
          "path": "/cdn-static/vmess-ws",
          "headers": { "Host": "cdn.yourdomain.com" }
        }
      }
    }
  ],
  "outbounds": [
    { "protocol": "freedom", "tag": "direct" },
    { "protocol": "blackhole", "tag": "block" }
  ]
}

Generate one UUID per user with xray uuid or uuidgen. Keep each UUID in a secret manager - it's the auth key.

Matching Caddyfile (/etc/caddy/Caddyfile):

cdn.yourdomain.com {
  root * /var/www/html
  file_server

  @vmess {
    path /cdn-static/vmess-ws
    header Connection *Upgrade*
    header Upgrade websocket
  }
  reverse_proxy @vmess 127.0.0.1:10000
}

Drop a dummy HTML site in /var/www/html/index.html (crucial for active-probing camouflage). Start:

systemctl restart xray caddy
journalctl -u xray -f

Config 2: VLess + REALITY (anti-GFW 2026)

This is the recommended config for mainland China in 2026. REALITY makes your server look exactly like www.microsoft.com (or another popular whitelisted site) from a DPI's point of view.

First generate a REALITY keypair:

xray x25519
# Private key: ...
# Public key: ...

Prefer not to assemble it by hand? Our VLESS REALITY config generator creates the key pair, UUID and short ID in your browser and writes the matching server config, client config and vless:// link.

Keeping the values straight is where most REALITY setups break. Our free VLESS REALITY Cheat Sheet (3-page PDF, direct download, no sign-up) puts the Xray, sing-box and vless:// names of each field side by side, with the server checks and the usual failure causes. Download the cheat sheet.

REALITY needs a server you control

More RAM for the same job? see the Contabo Cloud VPS offer

Affiliate link: we may earn a commission, at no extra cost to you. The generator stays free and does not depend on it.

See HostPapa VPS Lite, 2.95 $/mo on 3 years

Runs entirely in your browser: keys, UUID and configs are generated locally and never sent anywhere.

Your VPS public IP (or a domain pointing to it). Used in the client config and the share link.

443 is the norm: REALITY imitates HTTPS.

A third-party site with TLS 1.3 and HTTP/2, reachable from your clients. See the checklist below the tool.

uTLS fingerprint (client)

The TLS fingerprint the client imitates. chrome is the usual choice.

X25519 key pair

The private key goes on the server only. The public key goes to every client.

Hex, even length, up to 16 characters.

  • The keys are missing or invalid (32 bytes, base64url, 43 characters). Generate a pair or paste yours.

vless:// share link

vless://@203.0.113.10:443?encryption=none&flow=xtls-rprx-vision&security=reality&sni=www.example.com&fp=chrome&pbk=&sid=&type=tcp&headerType=none#my-reality

Import it in v2rayN, v2rayNG, Hiddify, Streisand or Shadowrocket, or scan the QR code.

config.json
{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "listen": "0.0.0.0",
      "port": 443,
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "",
            "flow": "xtls-rprx-vision",
            "email": "my-reality"
          }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "show": false,
          "target": "www.example.com:443",
          "xver": 0,
          "serverNames": [
            "www.example.com"
          ],
          "privateKey": "",
          "shortIds": [
            ""
          ]
        }
      },
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls",
          "quic"
        ],
        "routeOnly": true
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "tag": "block"
    }
  ]
}
client-xray.json
{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 10808,
      "protocol": "socks",
      "settings": {
        "udp": true
      }
    },
    {
      "listen": "127.0.0.1",
      "port": 10809,
      "protocol": "http"
    }
  ],
  "outbounds": [
    {
      "protocol": "vless",
      "tag": "proxy",
      "settings": {
        "vnext": [
          {
            "address": "203.0.113.10",
            "port": 443,
            "users": [
              {
                "id": "",
                "flow": "xtls-rprx-vision",
                "encryption": "none"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "serverName": "www.example.com",
          "fingerprint": "chrome",
          "publicKey": "",
          "shortId": "",
          "spiderX": "/"
        }
      }
    },
    {
      "protocol": "freedom",
      "tag": "direct"
    }
  ]
}
install.sh
# Install Xray-core with the official script (systemd service included)
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install

# Optional: confirm the public key matches the private key
xray x25519 -i ""

# Check that the target answers in TLS 1.3 and HTTP/2
xray tls ping www.example.com

# Open the port
sudo ufw allow 443/tcp

# Paste the server config, test it, then start the service
sudo nano /usr/local/etc/xray/config.json
xray run -test -c /usr/local/etc/xray/config.json
sudo systemctl restart xray && sudo systemctl enable xray

# Follow the log while the first client connects
sudo journalctl -u xray -f

REALITY needs a server you control

A REALITY server is a VPS with a public IP and port 443 free, nothing more. Contabo's entry VPS includes a public IPv4, root access and a large traffic allowance, and you can pick the datacenter closest to your users.

Second option, a US host with a 30-day money-back guarantee: Ultahost VPS Basic, 5.52 $/mo on a 24-month term, 1 CPU, 1 GB DDR5 and a dedicated IPv4 (read on 21 October 2026), enough for one Xray server. It also takes Bitcoin and other cryptocurrencies, Alipay, WeChat Pay and Qiwi (its payments page, read on 25 October 2026), which helps if your bank card is declined; check its terms for your country before ordering. See Ultahost VPS

Affiliate link: we may earn a commission, at no extra cost to you. The generator stays free and does not depend on it.

See the Contabo VPS

Want files already tested end to end?

The VLESS + REALITY config pack holds a commented Xray server on port 443, a desktop client (local SOCKS5 and HTTP proxy), a vless:// template for v2rayN, v2rayNG and Shadowrocket, and two things this generator does not write: a server variant with per-device traffic counters, and a README with a 10-point troubleshooting checklist. Every JSON file passes xray run -test on Xray-core 26.10.31. Xray-core only, no sing-box files.

See the VLESS + REALITY config pack (4.90 EUR)

Our own product, one payment, ZIP of text files. Templates for your own server, not a VPN subscription, and no promise that REALITY keeps passing a given DPI. The files generated above work without it.

Pick a target site (dest) that responds in TLS 1.3 + HTTP/2 and isn't blacklisted in the target country. For China: www.microsoft.com, dl.microsoft.com, update.microsoft.com are excellent choices.

Note: since Xray 26.10.31, choosing www.microsoft.com as the target prints a startup warning that it raises the odds of the server IP being blocked by the GFW. It still works, but prefer a less common TLS 1.3 + H2 site hosted near your VPS.

/usr/local/etc/xray/config.json:

{
  "log": { "loglevel": "warning" },
  "inbounds": [
    {
      "port": 443,
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "UUID-CLIENT-GENERATE",
            "flow": "xtls-rprx-vision",
            "email": "user1@vpnsmith"
          }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "show": false,
          "dest": "www.microsoft.com:443",
          "xver": 0,
          "serverNames": ["www.microsoft.com"],
          "privateKey": "YOUR_X25519_PRIVATE_KEY",
          "shortIds": ["", "a1b2c3d4"]
        }
      }
    }
  ],
  "outbounds": [
    { "protocol": "freedom", "tag": "direct" }
  ]
}

How it works:

  • When a REALITY client connects, it sends a TLS 1.3 ClientHello with SNI www.microsoft.com and a shared secret in an extension.
  • Xray detects the shared secret, takes over, and establishes the VLess tunnel.
  • When a "non-REALITY" client shows up (GFW probe, for instance), Xray does passthrough to www.microsoft.com:443 - the client sees the real Microsoft page, valid cert, normal behavior.
  • DPI cannot distinguish your server from a Microsoft cache.

It's the state of the art for anti-DPI in 2026. Hard to blacklist without blacklisting Microsoft.

REALITY limits:

  • TCP only (no WS, no HTTP/2). If the firewall throttles generic TCP, REALITY doesn't help.
  • Client must support REALITY: v2rayNG ≥ 1.8, Shadowrocket ≥ 2.2.20, sing-box ≥ 1.5. Old SS or VMess WS clients = incompatible.

Multiplexing (mux) to share connections

Glowing fibre-optic network cables
Glowing fibre-optic network cables

V2Ray/Xray supports multiplexing: multiple user TCP flows share a single physical TCP connection to the server. Benefits: fewer visible connections (useful against DPI doing connection counting), reduced latency after the first session, TLS handshake savings.

Server side, no config needed - Xray detects automatically.

Client side (v2rayNG, Shadowrocket, sing-box), enable "Mux" with concurrency 8 (recommended value).

Warning: on unstable networks (4G mobile near the edge of coverage), mux can amplify head-of-line blocking. If you see weird slowdowns, disable mux for that profile.

Clients: v2rayNG (Android), Shadowrocket (iOS), v2rayN (Windows), sing-box (Linux/macOS)

Already have a vmess:// or vless:// link and a client that refuses it? Paste it in our vmess / vless link converter: it shows every field, flags settings that break or weaken the connection (security=none, allowInsecure, Vision over WebSocket) and writes the Xray-core, sing-box or Clash Meta config, without the link leaving your browser.

Android - v2rayNG (open source, F-Droid or Play Store): the reference client. For VMess + WS + TLS, import manually with:

  • Address: cdn.yourdomain.com
  • Port: 443
  • ID: your UUID
  • Encryption: auto
  • Network: ws
  • Path: /cdn-static/vmess-ws
  • Host: cdn.yourdomain.com
  • TLS: tls
  • SNI: cdn.yourdomain.com
  • Allow insecure: false

For VLess + REALITY:

  • Address: VPS IP
  • Port: 443
  • ID: your UUID
  • Flow: xtls-rprx-vision
  • Network: tcp
  • Security: reality
  • SNI: www.microsoft.com
  • Fingerprint: chrome
  • Public key: your x25519 public key
  • Short ID: a1b2c3d4 (one from the server list)

iOS - Shadowrocket ($2.99 one-time on AppStore). Native VMess support, VLess + REALITY since 2.2.20. Import the vless:// or vmess:// URI generated by Xray (xray generate config) or via the UI.

Windows - v2rayN (open source, GitHub). Classic Windows UI, supports the whole V2Ray/Xray ecosystem. Handles system proxy well (System Proxy mode).

Linux/macOS - sing-box (open source, more modern than V2Ray client). JSON configuration. More performant and lighter than V2Ray client.

Performance and operational cost

We don't publish benchmark numbers. Throughput and latency depend entirely on your own path (server region, your ISP, distance, load), so any figure we'd quote would mislead more than help. What's stable is the qualitative ordering that follows from the design:

  • VLess + REALITY (xtls-vision) carries the least overhead, because XTLS Vision avoids the TLS-then-VLess double encryption.
  • VLess + WS + TLS is lighter than VMess + WS + TLS: VLess has no application-layer encryption and delegates everything to TLS.
  • WebSocket + TLS setups (VMess, VLess, Trojan) add WebSocket framing on top of TLS, so they carry more overhead than REALITY.

Measure your own path. Run iperf3 -c <server> and ping, with and without the tunnel: only those numbers tell you what your region, ISP and VPS plan deliver.

Hardening

1. Per-user unique UUID auth. NEVER share the same UUID between people. If a UUID leaks (badly handled clipboard, Telegram screenshot), you know whom to revoke.

2. UUID rotation every 3-6 months. Generate new UUIDs, push to users, remove the old from the Xray config. Trivial to script.

3. fail2ban on Caddy 404. As with wstunnel, ban IPs that scan nonexistent paths:

# /etc/fail2ban/jail.d/caddy-404.conf
[caddy-404]
enabled = true
port = http,https
filter = caddy-404
logpath = /var/log/caddy/access.log
maxretry = 10
findtime = 60
bantime = 3600

4. SSH key-only + UFW. Standard. Disable SSH password in /etc/ssh/sshd_config (PasswordAuthentication no), open only 22, 80, 443 in UFW (ufw allow 443/tcp, etc.).

5. Short log retention. In config.json, keep loglevel: warning (not info or debug), and configure logrotate to purge old logs. Ideally: no persistent DNS/connection logs if the jurisdiction is sensitive.

V2Ray vs alternatives - When to move on

NeedPick
Simplest setup, corporate bypass onlywstunnel (5 min setup)
No VPS, just obfuscate an existing WireGuardCloak
Multi-user + GFW bypass + pro setupXray-core + VLess + REALITY
Mobile-first, plug & play setupCommercial VPN (NordVPN, etc.)
Academic anti-censorship researchTor + obfs4 or Snowflake

If you have fewer than 3 users and never go to mainland China, V2Ray is overkill - prefer wstunnel or WireGuard + Cloak. If you want a turnkey mobile solution with no VPS to manage, check NordVPN with its obfuscated servers.

Common troubleshooting

Symptom: connection established but no traffic flows. Check outbounds - if you forgot freedom, everything black-holes. Add {"protocol": "freedom", "tag": "direct"}.

Symptom: "TLS handshake error" on the client. Wrong client SNI, or expired server cert (check caddy logs or acme.sh status depending on your setup).

Symptom: REALITY doesn't work, client sees the real dest page. The server-side shortIds don't match what the client sends. Verify the client sends a1b2c3d4 (or another valid server-listed value).

Measured on Xray 26.10.31 (1 Nov 2026, server and client on one machine, server log level warning). A wrong public key (password in current client configs) and a shortId missing from the server list give the same client error: REALITY: received real certificate (potential MITM or redirection). A serverName absent from serverNames gives no REALITY error at all, only accepted lines and a failed TLS session. In all three cases the server logs nothing. Check the key first, then the short ID, then the SNI, and test on loopback before blaming the network.

Symptom: poor performance despite a good link. Enable mux client-side (concurrency 8). Check the server isn't CPU-bound (top then htop). If the CPU turns out to be the limit, a larger plan such as Cloud VPS 8 (8 vCPU, 24 GB RAM, €14/month) gives more headroom.

A VPN changes your IP. It does not change your browser.

A tunnel replaces the address a service sees. It changes nothing about what your browser announces on its own - fonts, screen, time zone, graphics stack - and that combination is often stable enough to recognise you across sessions, tunnel or no tunnel.

Measure your own browser fingerprint - passive, no questions, no account, no email.

Further reading

Sources and official docs:


Published 2026-06-03. REALITY evolves fast - review the quarterly Xray-core changelogs before critical deployment.

Legal reminder: V2Ray/Xray are open-source tools, legal in the EU, US, Canada, and most countries. Anti-censorship usage in China, Iran, Russia is locally illegal with variable penalties. VPNSmith publishes this guide for educational purposes.

All of this runs on a server you rent. Our cheapest-VPS comparison compares the providers on the specs these setups need.

Still choosing the host? How to pick a VPS for V2Ray and Xray compares the options on location, IP reputation and traffic.

Affiliate link

Price checked 17 Oct 2026, 24-month term

Frequently asked questions

What is V2Ray and why use it?
V2Ray is a proxy platform that supports multiple protocols (VMess, VLESS, Shadowsocks). It is more resistant to censorship than traditional VPNs, making it popular in China, Iran, and Russia where VPNs are often blocked.
VMess vs VLESS: which is better?
VLESS is faster and more lightweight than VMess. Use VLESS for better performance. VMess offers more compatibility with older clients. Both bypass censorship effectively in 2026.
Is V2Ray legal?
V2Ray is open-source software and legal to install. However, using it to bypass censorship may violate local laws in China, Iran, or Russia. Check local regulations before use.
V2Ray vs Shadowsocks: which should you use in 2026?
Shadowsocks is simpler and lighter, fine for basic geo-unblocking on an uncensored network. V2Ray (and its Xray fork) is harder to detect under deep packet inspection thanks to VLESS/REALITY and protocol obfuscation, which matters in China, Iran and Russia where Shadowsocks signatures are increasingly blocked. For resilient censorship circumvention in 2026, V2Ray/Xray is the stronger choice.