本文使用的v2ray
版本是v4.4.0
。
v2ray core
从这里下载最新的v2ray
程序。
解压后将相关程序拷贝到对应目录。
1 2 3 4 5
| cp -f v2ray ~/.local/bin cp -f geoip.dat ~/.local/bin cp -f geosite.dat ~/.local/bin cp -f config.json ~/.local/etc/v2ray.conf # 我这里重命名了 sudo cp -f systemd/system/v2ray.service /etc/systemd/system/
|
修改配置
vim ~/.local/etc/v2ray.conf
,具体内容根据机场提供的节点修改:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| }], // List of outbound proxy configurations. "outbounds": [{ + "protocol": "vmess", + "settings": { + "vnext": [{ + "address": "服务器地址", + "port": 端口号, + "users": [{ + "id": "用户UUID", + "alterId": 1 + }] + }] + }, + "streamSettings": { + "network": "传输协议", + "wsSettings": { + "path": "路径" + } + } + },{ // Protocol name of the outbound proxy. "protocol": "freedom",
|
注意新增的vmess
协议紧跟着outbounds
之后,否则会不生效,还是走的其他协议。
基础配置可参考如下:
参考配置reference_link1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| { "inbounds": [ { "port": 1080, "protocol": "socks", "sniffing": { "enabled": true, "destOverride": ["http", "tls"] }, "settings": { "auth": "noauth" } } ], "outbounds": [ { "protocol": "vmess", "settings": { "vnext": [ { "address": "**节点地址**", "port": 443, "users": [ { "id": "**V2Ray UUID**", "alterId": 1 } ] } ] }, "streamSettings": { "network": "ws", "security": "tls", "wsSettings": { "path": "/v2" } } } ] }
|
或者参考:这里。
系统服务
sudo vim /etc/systemd/system/v2ray.service
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| [Unit] Description=V2Ray Service Documentation=https://www.v2fly.org/ After=network.target nss-lookup.target
[Service] User=nobody CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE NoNewPrivileges=true ExecStart=/XXXXXX/v2ray -config /XXXXXX/v2ray.json # 根据实际路径修改 Restart=on-failure RestartPreventExitStatus=23
[Install] WantedBy=multi-user.target
|
运行
1 2 3 4 5
| systemctl start v2ray 或者 service v2ray start 或者 v2ray -config ~/.local/etc/v2ray.json &
|