linux:v2ray
                This is an old revision of the document!
Table of Contents
v2ray
Install
wget https://install.direct/go.sh sudo bash go.sh
The v2ray command will be located at
/usr/bin/v2ray/v2ray
/usr/bin/v2ray/v2ray -h
Usage of /usr/bin/v2ray/v2ray:
  -config string
    	Config file for V2Ray.
  -format string
    	Format of input file. (default "json")
  -test
    	Test config file only, without launching V2Ray server.
  -version
    	Show current version of V2Ray.
config
/etc/v2ray/config.json
start/stop
``` sudo systemctl start v2ray sudo systemctl restart v2ray ```
Mac Install
- https://github.com/v2ray/homebrew-v2ray
brew tap v2ray/v2ray brew install v2ray-core
Then you can run v2ray, and config file:
/usr/local/etc/v2ray/config.json
run v2ray-core without starting at login.
brew services run v2ray-core
or run v2ray-core and register it to launch at login via:
brew services start v2ray-core brew services restart v2ray-core
Router Install
Download the correct version
wget -cS https://github.com/v2ray/v2ray-core/releases/download/v4.20.0/v2ray-linux-arm.zip
unzip v2ray-linux-arm.zip
Then copy all the files to the router
scp -r v2ray root@miwifi.com:/userdisk/data/bin/v2ray
Add execution permission
chmod +x v2ray chmod +x v2ctl
Update the config.json, the run v2ray
./v2ray --config=config.json
Testing the connection
curl -x socks5://127.0.0.1:1088 google.com
Reference
Reference
Config file for server
{
  "inbounds": [{
    "port": 2710x,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "58ceb1c6-b580-4d2c-bf41-21b6a35ae62x",
          "level": 1,
          "alterId": 64
        }
      ]
    },
	"streamSettings": {
			"network": "mkcp",
			"kcpSettings": {
			  "uplinkCapacity": 50,
			  "downlinkCapacity": 100,
			  "congestion": true,
			  "header": {
				"type": "none"
			  }
			}
	}
  }
  ],
  "outbounds": [{
    "protocol": "freedom",
    "settings": {}
  },{
    "protocol": "blackhole",
    "settings": {},
    "tag": "blocked"
  }],
  "routing": {
    "rules": [
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
      }
    ]
  }
}
Config file for client
{
    "dns": {
        "hosts": {
            "domain:github.io": "pages.github.com",
            "domain:shadowsocks.org": "electronicsrealm.com",
            "domain:v2ray.com": "www.vicemc.net",
            "domain:wikipedia.org": "www.wikimedia.org"
        },
        "servers": [
            "1.1.1.1",
            {
                "address": "114.114.114.114",
                "domains": [
                    "geosite:cn"
                ],
                "port": 53
            },
            "8.8.8.8",
            "localhost"
        ]
    },
    "inbounds": [
        {
            "listen": "127.0.0.1",
            "port": 1080,
            "protocol": "socks",
            "settings": {
                "auth": "noauth",
                "ip": "127.0.0.1",
                "udp": false
            },
            "sniffing": {
                "destOverride": [
                    "http",
                    "tls"
                ],
                "enabled": true
            },
            "tag": "socks-inbound"
        },
		{
		  "timeout": 0,
		  "listen": "127.0.0.1",
		  "port": 8080,
		  "protocol": "http",
		  "allowTransparent": true,
		  "userLevel": 0,
		  "tag": "http-inbound"
		}
    ],
    "log": {
        "loglevel": "warning"
    },
    "other": {},
    "outbounds": [
        {
            "protocol": "vmess",
            "settings": {
                "vnext": [
                    {
                        "address": "ef.pjq.me",
                        "port": 27105,
                        "users": [
                            {
                                "id": "58ceb1c6-b580-4d2c-bf41-21b6a35ae62b"
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "kcpSettings": {
                    "congestion": true,
                    "downlinkCapacity": 100,
                    "header": {
                        "type": "none"
                    },
                    "uplinkCapacity": 50
                },
                "network": "mkcp"
            }
        },
        {
            "protocol": "freedom",
            "settings": {},
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "settings": {},
            "tag": "blocked"
        }
    ],
    "policy": {
        "levels": {
            "0": {
                "downlinkOnly": 0,
                "uplinkOnly": 0
            }
        },
        "system": {
            "statsInboundDownlink": false,
            "statsInboundUplink": false
        }
    },
    "routing": {
        "domainStrategy": "IPOnDemand",
        "rules": [
            {
                "domain": [
                    "geosite:cn"
                ],
                "outboundTag": "direct",
                "type": "field"
            },
            {
                "ip": [
                    "geoip:cn",
                    "geoip:private"
                ],
                "outboundTag": "direct",
                "type": "field"
            },
            {
                "domain": [
                    "geosite:category-ads"
                ],
                "outboundTag": "blocked",
                "type": "field"
            }
        ]
    }
}
/var/www/dokuwiki/wiki/data/attic/linux/v2ray.1563035736.txt.gz · Last modified: 2019/07/14 00:35 by percy
                
                