静看光阴荏苒
不管不顾不问不说也不念

V2Ray端口转发/透明代理让BT下载不走代理

V2Ray的端口转发配置很简单,用到dokodemo-door(任意门)协议即可。下面是一个配置示例:

{
  "inbounds": [
    {
      "protocol": "dokodemo-door",
      "port": 50006,
      "settings": {
        "address": "1.1.1.1",
        "port": 3389,
        "network": "tcp,udp"
      }
    },
    {
      "protocol": "dokodemo-door",
      "port": 50007,
      "settings": {
        "address": "1.1.1.1",
        "port": 22,
        "network": "tcp,udp"
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}

在上面的这个配置中,本地的50006端口转发到1.1.1.1的3389端口,50007端口转发到1.1.1.1的22端口。有多少个需要转发的地址/端口就添加几个这样的配置块即可。

另外前两天水的这篇文章:

V2Ray透明代理/透明网关/广告屏蔽/路由器翻墙

一直以来有一个问题困扰我的是BT流量无法过滤,因为我是一个十足的BT党= =硬盘里面的片片基本都靠BT下载的,自从这样配置了之后BT下载速度大幅下降,并且因为BT流量都走了代理,导致VPS流量也不够用。

之前我一直想的是如何去过滤出BT流量,然后RETURN,但是因为太麻烦以及效率/性能是个问题就放弃了。转而我换了个思路,既然不好过滤出BT流量,那我干脆就只让指定端口的流量进入V2Ray链不就行了么。。

并且我的翻墙需求很简单,只是看看网页/视频之类的。所以iptables的规则如下:

iptables -t nat -N V2RAY
iptables -t nat -A V2RAY -d 192.168.0.0/16 -j RETURN
iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 12315
iptables -t nat -A PREROUTING -p tcp --dport 22 -j V2RAY
iptables -t nat -A PREROUTING -p tcp --dport 80 -j V2RAY
iptables -t nat -A PREROUTING -p tcp --dport 443 -j V2RAY

这样配置了之后,就只有22/80/443端口的流量会进入V2Ray,并且往后也很好继续添加新规则,比如某个软件使用了8999端口,我想让它走代理,就再加一条类似这样的规则即可:

iptables -t nat -A PREROUTING -p tcp --dport 8999 -j V2RAY

如果一个软件占用的端口随机变化,还可以添加端口范围:

iptables -t nat -A PREROUTING -p tcp --dport 10000:10500 -j V2RAY

赞(9)
未经允许不得转载:荒岛 » V2Ray端口转发/透明代理让BT下载不走代理
分享到: 更多 (0)

评论 12

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    大佬,我需要中转ws协议的教程,解决运营商网络的问题,博主能出一个这样的教学吗

    小裴5年前 (2019-10-04) Safari 537.36 Safari 537.36 GNU/Linux x64 GNU/Linux x64回复
    • 链式代理?是的话可以看这里:https://toutyrater.github.io/advanced/outboundproxy.html

      LALA5年前 (2019-10-06) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  2. #2

    我只想说 终于又挂了 :wink:

    橘子5年前 (2019-10-04) Google Chrome 75.0.3770.120 Google Chrome 75.0.3770.120 Windows 7 x64 Edition Windows 7 x64 Edition回复
  3. #3

    V2Ray支持探测BT流量啊,并使用V2Ray自身的路由功能直接去freedom的outbound

    灰灰5年前 (2019-10-05) Google Chrome 77.0.3865.90 Google Chrome 77.0.3865.90 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 我试过,但好像不行,有空我再试试看吧,如果你的配置确实可以,能贴个配置文件嘛?

      LALA5年前 (2019-10-06) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  4. #4

    不愧是lala大佬看着看着打开了新网站

    lala5年前 (2019-10-05) Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
  5. #5

    没考虑单开一台虚拟机下bt么?直接屏蔽它的IP,不做转发就可以了。

    terkey5年前 (2019-10-05) Google Chrome 77.0.3865.90 Google Chrome 77.0.3865.90 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 我这台PVE的硬盘不行,IO非常烂,也不知道是怎么回事,再开一台虚拟机下BT恐怕硬盘要炸。。

      LALA5年前 (2019-10-06) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  6. #6

    lala大佬的博客被GFW解封了啊,恭喜啊!

    Gabreel5年前 (2019-10-06) Google Chrome 77.0.3865.90 Google Chrome 77.0.3865.90 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 并没有

      ixuner5年前 (2019-10-06) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 解封是不阔能解封的,估计又是偶尔的GFW抽风。

      LALA5年前 (2019-10-06) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿