How to Install V2Ray Vmess on IPv6 VPS

Posted on

V2ray and Xray are different cores, but the installation method is same so choose the one you like, in this tutorial I’m using the Xray core.

  1. If you dont have a VPS yet, you can create a free ipv6 VPS on Hax.co.id, Hax’s free VPS is hosted in Singapore so connection may be slow to EU/US except in Asia so use this server for learning only , this is my IPv6:
    2001:470:1:be9:0000:0002:098f:db26
  2. Check this tutorial for how to connect to ipv6 vps
  3. Requirements, i’m using Ubuntu 20.04 and IPv6 VPS
  4. Get your IPv4 and Port by using this tool: IPv4 to access IPv6
    we will open port 443 on our VPS so you have to set the destination is [ipv6]:443 and the protocol is TCP, for IPv4 port, you can use random port for SNI Trick and use the port that compatible with Cloudflare’s proxy for WS or Reverse Trick, check the image below, in this tutorial i will use port 2083

  5. Connect to your Virtual Machine(VM) then install curl, nano, nginx
  6. apt update -y
    apt install curl nano -y
    apt install nginx -y
  7. Next, install Vmess
    bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install -u root

  8. Generate a self signed certificate and type in anything you like
    cd ~;openssl genrsa -out key.pem 2048
    openssl req -new -x509 -key key.pem -out cert.pem -days 4095

  9. Set nginx to open port 443 and forward to vmess
    rm /etc/nginx/sites-enabled/default
    nano /etc/nginx/sites-enabled/default

    paste the configuration below

    server {
        listen [::]:443 ssl http2 ipv6only=on;
        server_name _;
        ssl_certificate /root/cert.pem;
        ssl_certificate_key /root/key.pem;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; 
        ssl_verify_client off;
            location  /fastssh {
                proxy_http_version 1.1;
                proxy_ssl_verify off;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://[::1]:1234;
            }
    }
    

     

  10. create vless configuration
    rm /usr/local/etc/xray/config.json
    nano /usr/local/etc/xray/config.json

    remember “81f1f510-3ca7-4734-8956-0f4fce670af5” is the uuid for login. you can generate a random uuid here https://hax.co.id/uuid

    {
        "log": {
            "loglevel": "none"
        },
        "inbounds": [
            {
                "port": 1234,
                "protocol": "vmess",
                "settings": {
                    "clients": [
                        {
                            "id": "81f1f510-3ca7-4734-8956-0f4fce670af5", 
                            "level": 1,
                            "email": "[email protected]",
                            "alterId":32
                        }
                    ],
    				"disableInsecureEncryption": false,
                    "decryption": "none"
                },
    		    "dns": {
    				"servers": [
    				  "2001:67c:2b0::4",
    				  "2001:67c:2b0::6"
    				]
    		    },
                "streamSettings": {
                    "network": "ws",
                    "security": "none",
                    "wsSettings": {
                        "path": "/fastssh" 
                    }				
                }
            }
        ],
      "outbounds": [
        {
    	  "domainStrategy": "UseIPv6",
          "tag": "direct",
          "protocol": "freedom",
          "settings": {}
        },	
        {
          "tag": "blocked",
          "protocol": "blackhole",
          "settings": {}
        }
      ]
    }

     

  11. Restart both services and verify it
    service nginx restart
    service xray restart

  12. Finally, you can connect to the server using this configuration (replace ip address, port and uuid)
    vmess://eyJhZGQiOiIxMDMuMjUzLjI0LjQwIiwiYWlkIjoiMzIiLCJob3N0Ijoicy55b3V0dWJlLmNvbSIsImlkIjoiODFmMWY1MTAtM2NhNy00NzM0LTg5NTYtMGY0ZmNlNjcwYWY1IiwibmV0Ijoid3MiLCJwYXRoIjoiL2Zhc3Rzc2giLCJwb3J0IjoiMjA4MyIsInBzIjoidm1lc3MiLCJzbmkiOiJzLnlvdXR1YmUuY29tIiwidGxzIjoidGxzIiwidHlwZSI6IiIsInYiOiIyIn0=

    Please import to any V2Ray client, dont forget to change the DNS to IPv6 DNS

    2001:67c:2b0::4

    Tested using Xray VPN and it works, also this vmess support SNI Trick

     

 

See also  How to Install OpenVPN on IPv6 VPS