How to create V2ray Vmess proxy to tunnel the system — vpn ( Linux / Windows )

Milad Soltanian
3 min readOct 9, 2022

--

Hey folks, I hope you doing well.

in this article, we’re going to learn that :

  • how to setup a vmess proxy
  • how to tunnel the whole system on linux / windows with vmess
  • how to use a packet forwarder for censorship bypass

#Requirements :

  • - a server for vmess proxy
  • - a server for forwarding requests to vmess proxy server ( bypass geo censorship/filtering )

1–1 Setup Vmess :

  • install docker
curl -fsSL https://get.docker.com -o get-docker.sh ; sh get-docker.sh
  • create a docker-compose.yaml file with the following content
version: '3'
services:
v2ray:
image: v2fly/v2fly-core
restart: always
network_mode: host
environment:
- V2RAY_VMESS_AEAD_FORCED=false
volumes:
- ./config.json:/etc/v2ray/config.json:ro
  • create the config.json file and configure it as you wish

( link to the vmess configuration )

remember to replace *** in “id” filed with a valid uuid that you can generate it from here https://uuidonline.com/

{
"log": {
"loglevel": "info"
},
"inbounds": [
{
"port": 80,
"protocol": "vmess",
"allocate": {
"strategy": "always"
},
"settings": {
"clients": [
{
"id": "****",
"level": 1,
"alterId": 0,
"email": "asd@bsd.com"
}
],
"disableInsecureEncryption": true
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"connectionReuse": true,
"path": "/api"
},
"security": "none",
"tcpSettings": {
"header": {
"type": "http",
"response": {
"version": "1.1",
"status": "200",
"reason": "OK",
"headers": {
"Content-Type": [
"application/octet-stream",
"application/x-msdownload",
"text/html",
"application/x-shockwave-flash"
],
"Transfer-Encoding": ["chunked"],
"Connection": ["keep-alive"],
"Pragma": "no-cache"
}
}
}
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

till now you can officially connect to your vmess server by a client, you can use the following structure and change it based on your ip address and config file :

{
"add": "IP_ADDRESS",
"aid": "0",
"host": "",
"id": "UUID",
"net": "ws",
"path": "/api",
"port": "80",
"ps": "Vmessproxy",
"scy": "auto",
"sni": "",
"tls": "",
"type": "",
"v": "2"
}

after all, you need to convert it to base64 and add “vmess://” to the beginning part of the string

vmess://ewogICAgImFkZCI6ICJJUF9BRERSRVNTIiwKICAgICJhaWQiOiAiMCIsCiAgICAiaG9zdCI6ICIiLAogICAgImlkIjogIlVVSUQiLAogICAgIm5ldCI6ICJ3cyIsCiAgICAicGF0aCI6ICIvYXBpIiwKICAgICJwb3J0IjogIjgwIiwKICAgICJwcyI6ICJWbWVzc3Byb3h5IiwKICAgICJzY3kiOiAiYXV0byIsCiAgICAic25pIjogIiIsCiAgICAidGxzIjogIiIsCiAgICAidHlwZSI6ICIiLAogICAgInYiOiAiMiIKfQ==

1–2 Connect to vmess proxy ( system tunnel )

now it’s time to tunnel our system to a vmess proxy, to do this we’re going to use V2rayA script for Linux, and here are the installation steps :

curl -Ls https://mirrors.v2raya.org/go.sh | sudo bash
sudo systemctl disable v2ray --now
wget -qO - https://apt.v2raya.org/key/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/v2raya.asc
echo "deb https://apt.v2raya.org/ v2raya main" | sudo tee /etc/apt/sources.list.d/v2raya.list
sudo apt update
sudo apt install v2raya

after installation run the interface and import your vmess proxy, then set the following settings :

you can start the system tunnel proxy now by selecting and pressing the start button in the interface :

on windows you can use Nekoray program :

1–3 Bypass censorship/filtering

in order to bypass the filtering mechanism, you can use a middle-man server to forward the packets to the vmess server, we use glider script for doing such, although you can use Iptables as well ~!~

here is the syntax :

keep in mind that you can use socks,forward and … lots of other ways to forward packets to your vmess server ~!~

glider -listen tcp://:80 -forward ssh://root:password@middle_man_server_IP:22,tcp://VmessServerIP:80 -verbose

If you have further questions/issues you can contact me on Telegram

#linux | #networking | #bypass | #hacking | #v2ray | #vmess | #proxy | #vpn

--

--

No responses yet