v2fly / v2ray-step-by-step

This repo is a fork of ToutyRater/v2ray-guide, we aim to provide a new step-by-step guide of v2ray
https://guide.v2fly.org
Creative Commons Attribution 4.0 International
700 stars 420 forks source link

V2RAY是否支持把DNS解析转发到服务器,由服务器解析以后把结果发回来? #286

Open chainofhonor opened 1 year ago

chainofhonor commented 1 year ago

比如V2RAY监听5353端口 然后把dnsmasq的上游服务器设置为127.0.0.1#5353

类似于trojan里面的forward模式

这个需求是因为我总感觉移动的dns有问题,经常卡一下 我就想把DNS解析发送到国内的云服务器上,用云服务器解析应该就不会这样莫名的卡了

请问v2ray有这样的功能吗 配置文件要怎么写?

rp-hello commented 3 months ago

你好,可以实现的。 我这边没有类似的环境,可以说一下思路

  1. 如何让dns走v2ray
    1. 可以通过tproxy来劫持所有的dns请求(在路由器上这样做比较方便)
    2. 也可以像你说的,将dnsmasq的上游设置为127.0.0.1#5353
  2. v2ray如何代理dns协议
    1. 加一个inbound,监听5353端口
    2. 这个inbound的流量全部转发到proxy outbound上(类似v2ray将所有的5353端口流量转发到proxy上,不对内容做解析)
    3. 或者,如果你需要dns分流的话,将这个inbound的流量转发到任意一个dns协议的outbound上,然后经过dns分流查询