移动、联通、电信通用v2ray免流教程

商业转载请联系作者获得授权,非商业转载请注明出处。

For commercial use, please contact the author for authorization. For non-commercial use, please indicate the source.

协议(License):署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)

作者(Author):辉

链接(URL):https://blog.folklib.com/2021/02/04/32/

来源(Source):it库

1、下载v2ray
在opt下创建v2ray目录
进入v2ray目录
下载v2ray
解压zip包

mkdir /opt/v2ray
cd /opt/v2ray
wget https://github.com/v2fly/v2ray-core/releases/download/v4.31.0/v2ray-linux-64.zip
unzip v2ray-linux-64.zip
2、配置v2ray
在当前目录下(v2ray)新建v2ray.json文件,并写入配置内容(选择下面两种中的一种即可,端口(port)可以根据自己需要自定义)

touch /opt/v2ray/v2ray.json
vi /opt/v2ray/v2ray.json

提示:用vi打开后,按i进入编辑模式

编写好后,按esc退出编辑模式,按shift + ; 输入wq 保存并退出vi

通过 http 伪装 HOST 实现免流配置:

{
“inbounds”: [{
“port”: 80,
“protocol”: “vmess”,
“settings”: {
“clients”: [{
“id”: “18a28d40-fb08-942f-a220-01a34c1d608d”,
“level”: 1,
“alterId”: 64
}]
},
“streamSettings”: {
“network”: “tcp”,
“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”: {

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
    }
},
{
"protocol": "blackhole",
"settings": {

},
"tag": "blocked"
}],
"routing": {
"strategy": "rules",
"settings": {
"rules": [{
"type": "field",
"ip": ["geoip:private"],
"outboundTag": "blocked"
}]
}
}

}
通过 Websocket 协议实现免流:

{
“stats”: {},
“api”: {
“services”: [
“StatsService”
],
“tag”: “api”
},
“routing”: {
“strategy”: “rules”,
“settings”: {
“rules”: [
{
“inboundTag”: [
“api”
],
“type”: “field”,
“outboundTag”: “api”
}
]
}
},
“inbounds”: [
{
“streamSettings”: {
“wsSettings”: {
“path”: “/ray”
},
“network”: “ws”,
“kcpSettings”: {
“uplinkCapacity”: 5,
“downlinkCapacity”: 20,
“readBufferSize”: 1,
“mtu”: 1350,
“header”: {
“type”: “none”
},
“tti”: 20,
“congestion”: false,
“writeBufferSize”: 1
},
“tcpSettings”: {
“header”: {
“type”: “none”,
“response”: {
“status”: “200”,
“headers”: {
“Transfer-Encoding”: [
“chunked”
],
“Connection”: [
“keep-alive”
],
“Content-Type”: [
“application/octet-stream”,
“application/x-msdownload”,
“text/html”,
“application/x-shockwave-flash”
],
“Pragma”: “no-cache”
},
“reason”: “OK”,
“version”: “1.1”
}
}
}
},
“protocol”: “vmess”,
“port”: “80”,
“settings”: {
“clients”: [
{
“alterId”: 64,
“level”: 0,
“email”: “4”,
“id”: “18a28d40-fb08-942f-a220-01a34c1d608d”
}
]
}
},
{
“tag”: “api”,
“settings”: {
“address”: “127.0.0.1”
},
“protocol”: “dokodemo-door”,
“port”: 5001,
“listen”: “127.0.0.1”
}
],
“policy”: {
“levels”: {
“0”: {
“statsUserUplink”: true,
“statsUserDownlink”: true
}
},
“system”: {
“statsInboundDownlink”: true,
“statsInboundUplink”: true
}
},
“outbounds”: [
{
“protocol”: “freedom”,
“settings”: {}
},
{
“tag”: “blocked”,
“protocol”: “blackhole”,
“settings”: {}
}
]
}
3、编辑启动脚本
touch /opt/v2ray/start.sh
vi /opt/v2ray/start.sh
写入以下内容

!/bin/bash

count=ps -ef grep v2ray grep -v "grep" wc -l
if [ 0 == $count ];then
nohup /opt/v2ray/v2ray -config /opt/v2ray/v2ray.json>/dev/null 2>&1 &
fi
脚本授权

chmod u+x /opt/v2ray/start.sh
4、启动v2ray
/opt/v2ray/start.sh
5、配置计划任务(作用是程序崩溃时自动检测并重新启动)
你也可以不用此方式,建议加计划任务进行守护。
需要注意的是,如果你用如下的脚本,那必须保证这台服务器只能运行一个v2ray程序,否则会失效。

打开计划任务编辑器

crontab -e
在最后一行追加以下内容,以保证每分钟都会去检测服务是否存在,不存在则启动。

  • * * * * bash /home/shell.sh
    二、客户端(用户使用)
    1、下载支持v2ray的app(ios端推荐:Quantumult、Shadowrocket)
    以下信息参考修改就可以,重点是 host 为你的可免流应用的 host ,我提供的是联通,掌厅直播(全国免流)。如果你是其他卡,可以测试将你的免流应用(定向免流) host 填入测试。

连接信息
IP: 你的服务器IP
PORT: 80
ID: 18a28d40-fb08-942f-a220-01a34c1d608d
AlterID: 64
安全性:None
网络:tcp
标头类型: http
host: pull.free.video.10010.com
path: /

联通免流host
pull.free.video.10010.com掌厅直播 (全国免流)

2、配置图示

3、测试情况


移动、联通、电信通用v2ray免流教程
http://example.com/移动、联通、电信通用v2ray免流教程.html
作者
John Doe
发布于
2022年3月21日
许可协议