kuoruan / luci-app-v2ray

LuCI support for V2Ray
1.18k stars 284 forks source link

Some workaround and tips for enabling udp and dns #211

Open Yochee opened 4 years ago

Yochee commented 4 years ago

As being discussed the udp and dns functionality has been long broken, mostly because of infinite loop caused by iptables setting. Here are some workaround:

  1. disable dns service from dnsmasq by adding "port=0" to /etc/dnsmasq.conf, to free the local 53/udp port.
  2. add a dokodemo-door inbound "dns-in" that listens 53/udp and forwards to 8.8.8.8:53/udp, or whatever ip you like.
  3. add an outbound "dns-out", set protocol to dns.
  4. setup and enable internal DNS of v2ray.
  5. route "dns-in" to "dns-out". Now v2ray acts as a dns server on localhost:53/udp.
  6. you might also need to set "domainStrategy" to "UseIP" for your freedom outbound.
  7. this does the trick: in LAN, set dns to the IP of your device, 192.168.1.1 for example, it makes sense as it is now indeed a dns server. Then add your subnet, 192.168.1.0/24 for example, to the extra direct list in v2ray setting, so that to avoid infinite loop. Now everything works fine.
Yochee commented 4 years ago

And if you need to use port mapping, do NOT use TProxy