v2rayNG icon indicating copy to clipboard operation
v2rayNG copied to clipboard

custom DNS settings in custom config do not work at all when "local dns" is enabled

Open mmmray opened this issue 1 year ago • 4 comments

在提出问题前请先自行排除服务器端问题,同时也请通过搜索确认是否有人提出过相同问题。

预期行为 (expected behavior)

DNS settings can be customized using JSON subs, just like with regular core.

实际行为 (actual behavior)

When using a JSON subscription or custom JSON config with dns section, and enabling the "enable local dns" option, v2rayNG fails all DNS queries by timeout/hang.

复现方法 (reproduction method)

contents of json subscription:

[
  {
    "inbounds": [
      {
        "listen": "127.0.0.1",
        "port": 2080,
        "protocol": "socks",
        "settings": {
          "udp": true
        }
      }
    ],
    "routing": {},
    "log": {
      "loglevel": "warning"
    },
    "dns": {
      "servers": [
        "1.1.1.1"
      ],
      "queryStrategy": "UseIPv4",
      "tag": "dns-in"
    },
    "outbounds": [
      // redacted
    ],
    "remarks": "test"
  }
]
  1. host above as a file somewhere for subs, add an outbound, add it to v2rayNG
  2. "enable local DNS" in settings (keep everything else as-is)
  3. observe dig google.com hanging in termux, similar behavior from chrome (tried with/without chrome's DoH)
  4. disabling "enable local DNS" fixes it again

日志信息

There are no relevant logs. The core starts successfully and then no logs are printed. The log output is identical to when it works (step 4) vs when it doesn't work (step 3).

通过adb logcat -s com.v2ray.ang GoLog V2rayConfigUtilGoLog Main获取日志。请自行删减日志中可能出现的敏感信息。

如果问题可重现,建议先执行adb logcat -c清空系统日志再执行上述命令,再操作重现问题。

10-08 10:19:11.284  4525  4525 I GoLog   : start core
10-08 10:19:11.290  4525  4547 I GoLog   : [Warning] core: Xray 24.9.30 started
10-08 10:19:11.335  4525  4525 D com.v2ray.ang: [/data/app/com.v2ray.ang-DfSxD05GmpgnNrmw36O_Kw==/lib/arm64/libtun2socks.so, --netif-ipaddr, 26.26.26.2, --netif-netmask, 255.255.255.252, --socks-server-addr, 127.0.0.1:10808, --tunmtu, 1500, --sock-path, sock_path, --enable-udprelay, --loglevel, notice, --dnsgw, 127.0.0.1:10853]
10-08 10:19:11.340  4525  4525 D com.v2ray.ang: Process[pid=7083, hasExited=false]
10-08 10:19:11.340  4525  4525 D com.v2ray.ang: /data/user/0/com.v2ray.ang/files/sock_path
10-08 10:19:11.341  4525  7084 D com.v2ray.ang: libtun2socks.so check
10-08 10:19:11.355  4525  4525 D com.v2ray.ang: runPlugin
10-08 10:19:11.391  4525  4573 D com.v2ray.ang: sendFd tries: 0
10-08 10:19:13.950  4525  4555 I GoLog   : Using Prepared: 188.114.96.10

环境信息

v2rayng 1.9.6, tested with two completely different servers and protocols, one of them has no server side routing

额外信息(可选)

changing the dns server in the json config makes no difference

the same config works ok when launched with core directly (checking with curl -x socks5h://..)

mmmray avatar Oct 08 '24 08:10 mmmray

it's true

w0l4i avatar Oct 08 '24 08:10 w0l4i

also we need that dns query will be resolve trough proxy tunnel it self !

w0l4i avatar Oct 08 '24 08:10 w0l4i

https://github.com/2dust/v2rayNG/blob/819ff2995a268d486e29b481fc7f13fa1e799dcd/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt#L240

Check the code here, there are some changes to the configuration file when this is enabled.

Using the in-app function Export full configuration to clipboard you can see the full configuration

2dust avatar Oct 09 '24 02:10 2dust

i'm not able to see these changes when using Export full configuration. Are you saying this is expected behavior or should I look into this code to fix the bug?

mmmray avatar Oct 11 '24 22:10 mmmray

在提出问题前请先自行排除服务器端问题,同时也请通过搜索确认是否有人提出过相同问题。

预期行为 (expected behavior)

DNS settings can be customized using JSON subs, just like with regular core.

实际行为 (actual behavior)

When using a JSON subscription or custom JSON config with dns section, and enabling the "enable local dns" option, v2rayNG fails all DNS queries by timeout/hang.

复现方法 (reproduction method)

contents of json subscription:

[
  {
    "inbounds": [
      {
        "listen": "127.0.0.1",
        "port": 2080,
        "protocol": "socks",
        "settings": {
          "udp": true
        }
      }
    ],
    "routing": {},
    "log": {
      "loglevel": "warning"
    },
    "dns": {
      "servers": [
        "1.1.1.1"
      ],
      "queryStrategy": "UseIPv4",
      "tag": "dns-in"
    },
    "outbounds": [
      // redacted
    ],
    "remarks": "test"
  }
]
  1. host above as a file somewhere for subs, add an outbound, add it to v2rayNG
  2. "enable local DNS" in settings (keep everything else as-is)
  3. observe dig google.com hanging in termux, similar behavior from chrome (tried with/without chrome's DoH)
  4. disabling "enable local DNS" fixes it again

日志信息

There are no relevant logs. The core starts successfully and then no logs are printed. The log output is identical to when it works (step 4) vs when it doesn't work (step 3).

环境信息

v2rayng 1.9.6, tested with two completely different servers and protocols, one of them has no server side routing

额外信息(可选)

changing the dns server in the json config makes no difference

the same config works ok when launched with core directly (checking with curl -x socks5h://..)

I confirm @2dust

ghost avatar Nov 19 '24 06:11 ghost

When local dns is active, the sites are not loaded. When it is disabled, they are loaded Screenshot_۲۰۲۴-۱۱-۱۹-۱۰-۲۱-۱۵-۶۹۸_com kiwibrowser browser-edit And also the noise settings don't work in Json

ghost avatar Nov 19 '24 06:11 ghost