v2ray 免流 配置

SSR 和v2ray 都可以免流, SSR相关的文章网上有很多,这里就不介绍了,有兴趣的自己GOOGL搜索一下。

引用

http://www.right.com.cn/forum/thread-319054-1-1.html

说明

上一篇文章我们已经介绍了 v2ray 的使用,由于使用web + websocket,还是很稳定的, 最近几次墙的比较厉害, v2ray的小鸡还是一切正常(哈哈)
链接在这: v2ray + websocket + web + nginx 配置与使用

今天简单讨论一下 v2ray 免流配置,我在网上找了相关的文章并不多,即使有可能说明也不完整,
当时找到了恩山一篇文章还是比较完整的,链接: 路由器设置v2ray客户端(免流)

客户端配置

恩山文章里介绍的客户端配置文件是可以,我们也可以使用客户端软件v2rayN生成一个类似的(主要配置节点都是一样的)
恩山文章里的配置如下:

{
  "log": {
    "error": "/tmp/syslog.log",
    "loglevel": "warning"
  },
  "inbound": {
    "port": 1088,
    "listen": "192.168.123.1",
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": true,
      "ip": "192.168.123.1"
    }
  },
  "inboundDetour": [
    {
      "port": "1099",
      "listen": "0.0.0.0",
      "protocol": "dokodemo-door",
      "settings": {
        "network": "tcp,udp",
        "timeout": 30,
        "followRedirect": true
      }
    }
  ],
  "outbound": {
    "protocol": "vmess",
    "settings": {
        "vnext": [
            {
                "address": "填你的服务器ip",
                "port": 填你的端口,
                "users": [
                    {
                        "id": "填你的uuid",
                        "alterId": 填你的alterid
                    }
                ]
            }
        ]
    },
    "streamSettings": {
      "network": "tcp",
      "tcpSettings": {
        "connectionReuse": true,
        "header": {
          "type": "http",
          "request": {
            "version": "1.1",
            "method": "GET",
            "path": ["/"],
            "headers": {
              "Host": ["你的免流host"],
              "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
                        "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
              ],
              "Accept-Encoding": ["gzip, deflate"],
              "Connection": ["keep-alive"],
              "Pragma": "no-cache"
            }
          },
          "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"
            }
          }
        }
      }
    }
  },
  "outboundDetour": [
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    }
  ],
  "dns": {
    "servers": [
      "8.8.8.8",
      "8.8.4.4",
      "localhost"
    ]
  },
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPIfNonMatch",
      "rules": []
    }
  }
}

v2rayN 软件配置说明

  • 地址:就是你服务器IP地址或域名
  • 端口:目前免流端口一般是80,其它未测试
  • 用户ID:填写服务器配置文件里的UUID
  • 额外ID:填写服务器配置文件里的alterId
  • 加密方式:不确定我选择的是none
  • 传输协议:选择tcp
  • 伪装类型:选择http
  • 伪装域名/其他项: 填写你手机卡的免流域名(我的是联通工行e卡,所以填写: mail.icbc.com.cn)
  • 底层传输安全:选择空

v2rayN 软件配置截图 https://i.loli.net/2018/07/21/5b521af531e1a.png

v2rayN 点击保存生成的配置如下:
根据V2rayN的软件配置不同略有不同

{
  "log": {
    "access": "",
    "error": "",
    "loglevel": ""
  },
  "inbound": {
    "port": 1080,
    "listen": "0.0.0.0",
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": true,
      "ip": "127.0.0.1",
      "clients": null
    },
    "streamSettings": null
  },
  "outbound": {
    "tag": "agentout",
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "test.v2ray.com",
          "port": 80,
          "users": [
            {
              "id": "4d1af378-d80c-4ed7-a3c8-7c79621e1be0",
              "alterId": 64,
              "security": "none"
            }
          ]
        }
      ],
      "servers": null
    },
    "streamSettings": {
      "network": "tcp",
      "security": "",
      "tcpSettings": {
        "connectionReuse": true,
        "header": {
          "type": "http",
          "request": {
            "version": "1.1",
            "method": "GET",
            "path": [
              "/"
            ],
            "headers": {
              "Host": [
                "mall.icbc.com.cn" //这里需要修改为自己手机卡支持的免流域名
              ],
              "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
                "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
              ],
              "Accept-Encoding": [
                "gzip, deflate"
              ],
              "Connection": [
                "keep-alive"
              ],
              "Pragma": "no-cache"
            }
          },
          "response": {
            "version": "1.1",
            "status": "200",
            "reason": "OK",
            "headers": {
              "Content-Type": [
                "application/octet-stream",
                "video/mpeg"
              ],
              "Transfer-Encoding": [
                "chunked"
              ],
              "Connection": [
                "keep-alive"
              ],
              "Pragma": "no-cache"
            }
          }
        }
      },
      "kcpSettings": null,
      "wsSettings": null
    },
    "mux": {
      "enabled": false
    }
  },
  "inboundDetour": null,
  "outboundDetour": [
    {
      "protocol": "freedom",
      "settings": {
        "response": null
      },
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "settings": {
        "response": {
          "type": "http"
        }
      },
      "tag": "blockout"
    }
  ],
  "dns": {
    "servers": [
      "8.8.8.8",
      "8.8.4.4",
      "localhost"
    ]
  },
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPIfNonMatch",
      "rules": []
    }
  }
}

v2ray Android 客户端 BifrostV 使用

BifrostV 是一个基于 V2Ray 内核的 Android 应用,它支持 VMess、Shadowsocks、Socks 协议。

首先把上面生成的客户端配置文件发送到手机,然后在手机打开BifrostV, 选择从导入即可。

v2ray 服务器配置

其实,只需要在我们上一篇文章中服务器配置文件中添加一个inboundDetour就行了,

  • 端口:和客户端保持一致, 这里是80
  • 客户ID:和客户端保持一致,//"id": "4d1af378-d80c-4ed7-a3c8-7c79621e1be0",
  • 额外ID:和客户端保持一致,//"alterId": 64,
  • streamSettings:直接拷贝客户端配置即可

inboundDetour 配置:

"inboundDetour":[
   {
        "port": 80,
        "listen": "0.0.0.0",
        "protocol": "vmess",
        "settings": {
           "clients": [
            {
              "id": "4d1af378-d80c-4ed7-a3c8-7c79621e1be0",
              "alterId": 64
            }
          ]
        },
        "streamSettings": {
          "network": "tcp",
          "tcpSettings": {
                "connectionReuse": true,
                "header": {
                  "type": "http",
                  "request": {
                        "version": "1.1",
                        "method": "GET",
                        "path": ["/"],
                        "headers": {
                          "Host": ["mall.icbc.com.cn"], //这里需要修改为自己手机卡支持的免流域名
                          "User-Agent": [
                                "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
                                                "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
                          ],
                          "Accept-Encoding": ["gzip, deflate"],
                          "Connection": ["keep-alive"],
                          "Pragma": "no-cache"
                        }
                  },
                  "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"
                        }
                  ··}
                }
          ··}
        }
    }
]

总结

  • v2ray 对比 SSR 免流,个人测试结果还是v2ray效果相对较好。
  • 免流需要开全局,相对于国内的一些网站和应用,使用效果一般(这个主要还是和服务器有关)
  • 如果有什么不清楚的地方欢迎讨论

免流 短信 截图 https://i.loli.net/2018/07/21/5b52258fd8ac3.png

打赏

如果您认为本文对你有很大帮助,不妨小额赞助我一下[金额您随意],让我有动力继续写出高质量的文章。

微信

请打开微信App,使用“扫一扫”付款

支付宝

请打开支付宝App,使用“扫一扫”付款

评论

dd

websocket + web + nginx的模式可以弄免流吗?

system
回复 @dd

我并没有做相应的测试,不是很清楚,你做测试了吗? 免流一般是80端口,你可以看到配置中使用HTTP请求,不是很清楚为什么还需要nginx转发?

肖哥Blog

免流端口80 和网站冲突的呀 443也冲突,用了咪咕音乐的18088端口 host:uem.migu.cn 不免流呀 除了80端口没办法吗?大佬

Admin
回复 @肖哥Blog

肖哥, 免流应该是运营商来决定的, 他们规定了免流端口, 一般都80, 不是免流端口,不能免流, 这个应该没有什么好方法,
为什么不用80端口?

肖哥Blog
回复 @Admin

因为网站用了80,443端口 V2ray在用80端口有冲突呀,对了User-Agent和Content-Type我用的手机上抓包到的参数,应该就是这样才免流吧

Admin
回复 @肖哥Blog

首先, 我认为端口要正确, 然后才是其它参数.

匿名
回复 @肖哥Blog

web、ml混淆复用80端口 https://www.hostloc.com/forum.php?mod=viewthread&tid=501902&page=1#pid6125513

jason8118
回复 @匿名

请问大佬,有https://www.hostloc.com/论坛的注册邀请码吗?

system
回复 @jason8118

你至少留个邮箱吧!

我是之前用bifrostv翻墙下磁力的时候,发现免流了,没有设置你上述的那些东西,这会不会是另一种免流的方法?

Admin
回复 @吗

你可以贴出你的配置文件? 或者 参数设置截图吗?
大家一起看下, 在没有任何信息的情况下, 不好说!

kakinz

大佬,可以发一下你的完整版服务端tcp http免流的配置吗?教程里的看得我一头雾水~( TロT)σ

Admin
回复 @kakinz

大佬, 先参考这个一篇, 看看V2ray是否可以正常工作,v2ray + websocket + web + nginx 配置与使用
v2ray正常工作后, 再参考此博文把相应的免流配置添加上即可. 实际免流效果看个人了, 不同的运营商, 不同的卡, 效果不同.

gzzz

我设置的电信天翼视讯怎么不免啊?v2rayng客户端怎么设置。能给个详细说明吗?

Admin
回复 @gzzz

v2rayNG 没有使用过, 不过应该把电脑端的配置文件直接导入手机端, 应该是可以工作的,
先确定v2ray是否正常工作, 然后再检查免流相关设置, 比如: 免流Host, 端口, 路径等

lilith

博主,你现在还可以用v2ray免流吗?我抓了三四个host,全失败了。求教

lilith
回复 @lilith

配置本身可以开启google,就是无法免流

lilith
回复 @lilith

如果能联系我的邮箱的话,感激不尽

匿名

现在还能免吗 感觉以及不行了

dd

请问“inboundDetour配置”是将/etc/v2ray/config.json的内容取代,还是在原config.json中添加?如果是添加的话,在哪一行加入?

dd

额,我己经ok了。是我编辑json时第一行没有加左花符号。参考的是“https://toutyrater.github.io/advanced/httpfake.html”这篇文章(可能需要翻墙),只要把 "Host": ["你的HOST"]添加至"header"下即可。以下是我的配置: { "inbounds": [ { "port": 6000, "protocol": "vmess", "settings": { "clients": [ { "id": "12345,上山打老虎", "level": 1, "alterId": 64 } ] }, "streamSettings": { "network": "tcp", "tcpSettings": { "header": { "Host": ["免流HOST"],
"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": {} }, { "protocol": "blackhole", "settings": {}, "tag": "blocked" } ], "routing": { "strategy": "rules", "settings": { "rules": [ { "type": "field", "ip": [ "geoip:private" ], "outboundTag": "blocked" } ] } } }

system
回复 @dd
{
    "inbounds": [{
        "port": 6000,
        "protocol": "vmess",
        "settings": {
            "clients": [{
                "id": "12345,上山打老虎",
                "level": 1,
                "alterId": 64
            }]
        },
        "streamSettings": {
            "network": "tcp",
            "tcpSettings": {
                "header": {
                    "Host": ["免流HOST"],
                    "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": {

        }
    },
    {
        "protocol": "blackhole",
        "settings": {

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

请问“User-Agent"是否有必要加上?

system
回复 @dd

建议加上

匿名

湖南地区用不了了…… 之前爱看的host还是可以的…… 我自己又抓了包…… 不行……