[GH-ISSUE #5853] [Bug]: WireGuard Outbound: DNS queries use system DNS instead of being resolved inside the WireGuard tunnel / خروجی WireGuard: درخواست‌های DNS از DNS سیستم استفاده می‌کنند و داخل تونل Wir… #4066

Closed
opened 2026-10-31 20:36:54 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @montiego on GitHub (Jul 7, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5853

Describe the bug

English

When using WireGuard as an outbound, DNS queries are currently forwarded to the configured DNS server instead of being resolved directly through the WireGuard tunnel.

It would be useful to have an option in the WireGuard outbound settings to specify DNS servers that are used inside the WireGuard tunnel, similar to the DNS option in a standard WireGuard configuration.

This would ensure that DNS requests are sent through the WireGuard interface itself, preventing DNS leaks and improving privacy and compatibility in some network environments.

فارسی

هنگام استفاده از WireGuard به عنوان خروجی (Outbound)، درخواست‌های DNS در حال حاضر به DNS سرور تنظیم‌شده در هسته ارسال می‌شوند و مستقیماً داخل تونل WireGuard حل نمی‌شوند.

پیشنهاد می‌شود در تنظیمات خروجی WireGuard گزینه‌ای برای تعیین DNS سرور مخصوص خود WireGuard اضافه شود؛ مشابه گزینه DNS در فایل پیکربندی استاندارد WireGuard.

با این قابلیت، درخواست‌های DNS از داخل رابط WireGuard ارسال و حل می‌شوند که می‌تواند از نشت DNS جلوگیری کرده و حریم خصوصی و سازگاری با برخی شبکه‌ها را بهبود دهد.

How to reproduce the problem

English

When using WireGuard as an outbound, DNS queries are currently forwarded to the configured DNS server instead of being resolved directly through the WireGuard tunnel.

It would be useful to have an option in the WireGuard outbound settings to specify DNS servers that are used inside the WireGuard tunnel, similar to the DNS option in a standard WireGuard configuration.

This would ensure that DNS requests are sent through the WireGuard interface itself, preventing DNS leaks and improving privacy and compatibility in some network environments.

فارسی

هنگام استفاده از WireGuard به عنوان خروجی (Outbound)، درخواست‌های DNS در حال حاضر به DNS سرور تنظیم‌شده در هسته ارسال می‌شوند و مستقیماً داخل تونل WireGuard حل نمی‌شوند.

پیشنهاد می‌شود در تنظیمات خروجی WireGuard گزینه‌ای برای تعیین DNS سرور مخصوص خود WireGuard اضافه شود؛ مشابه گزینه DNS در فایل پیکربندی استاندارد WireGuard.

با این قابلیت، درخواست‌های DNS از داخل رابط WireGuard ارسال و حل می‌شوند که می‌تواند از نشت DNS جلوگیری کرده و حریم خصوصی و سازگاری با برخی شبکه‌ها را بهبود دهد.

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.4.2

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

ubuntu24

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @montiego on GitHub (Jul 7, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5853 ### Describe the bug ### English When using **WireGuard** as an outbound, DNS queries are currently forwarded to the configured DNS server instead of being resolved directly through the WireGuard tunnel. It would be useful to have an option in the WireGuard outbound settings to specify DNS servers that are used **inside the WireGuard tunnel**, similar to the `DNS` option in a standard WireGuard configuration. This would ensure that DNS requests are sent through the WireGuard interface itself, preventing DNS leaks and improving privacy and compatibility in some network environments. ### فارسی هنگام استفاده از **WireGuard** به عنوان خروجی (Outbound)، درخواست‌های DNS در حال حاضر به DNS سرور تنظیم‌شده در هسته ارسال می‌شوند و مستقیماً داخل تونل WireGuard حل نمی‌شوند. پیشنهاد می‌شود در تنظیمات خروجی WireGuard گزینه‌ای برای تعیین DNS سرور مخصوص خود WireGuard اضافه شود؛ مشابه گزینه `DNS` در فایل پیکربندی استاندارد WireGuard. با این قابلیت، درخواست‌های DNS از داخل رابط WireGuard ارسال و حل می‌شوند که می‌تواند از نشت DNS جلوگیری کرده و حریم خصوصی و سازگاری با برخی شبکه‌ها را بهبود دهد. ### How to reproduce the problem ### English When using **WireGuard** as an outbound, DNS queries are currently forwarded to the configured DNS server instead of being resolved directly through the WireGuard tunnel. It would be useful to have an option in the WireGuard outbound settings to specify DNS servers that are used **inside the WireGuard tunnel**, similar to the `DNS` option in a standard WireGuard configuration. This would ensure that DNS requests are sent through the WireGuard interface itself, preventing DNS leaks and improving privacy and compatibility in some network environments. ### فارسی هنگام استفاده از **WireGuard** به عنوان خروجی (Outbound)، درخواست‌های DNS در حال حاضر به DNS سرور تنظیم‌شده در هسته ارسال می‌شوند و مستقیماً داخل تونل WireGuard حل نمی‌شوند. پیشنهاد می‌شود در تنظیمات خروجی WireGuard گزینه‌ای برای تعیین DNS سرور مخصوص خود WireGuard اضافه شود؛ مشابه گزینه `DNS` در فایل پیکربندی استاندارد WireGuard. با این قابلیت، درخواست‌های DNS از داخل رابط WireGuard ارسال و حل می‌شوند که می‌تواند از نشت DNS جلوگیری کرده و حریم خصوصی و سازگاری با برخی شبکه‌ها را بهبود دهد. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.4.2 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system ubuntu24 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:36:54 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jul 7, 2026):

This is confirmed as a missing feature, not an existing setting that is misbehaving.

What I checked:

  • The WireGuard outbound settings schema (frontend/src/schemas/protocols/outbound/wireguard.ts) only defines address, secretKey/pubKey, domainStrategy, mtu, noKernelTun, reserved, and per-peer publicKey/preSharedKey/allowedIPs/endpoint/keepAlive. There is no dns field, and the outbound form (frontend/src/pages/xray/outbounds/protocols/wireguard.tsx) does not expose one either — so there is currently no panel option equivalent to the DNS = line in a standard wg-quick config.
  • On the backend, outbound configs are passed through to Xray-core largely as raw JSON (internal/web/service/xray.go), so this isn't a case of the server stripping a field you can already set — the panel's form/schema simply doesn't offer it. Even if you hand-edited the raw outbound JSON to add a dns key, it would be dropped the next time the outbound is saved through the form, since the Zod schema only keeps the fields listed above.
  • A near-identical request, #3453 ("DNS support in WireGuard outbound"), was filed and closed by the maintainer as completed on 2026-05-29, but I don't see a corresponding change to the WireGuard outbound schema in the file history, so the feature does not appear to actually be implemented yet in the current codebase (3.4.2 or later).

Possible existing workaround (untested by me, worth trying): the panel's DNS settings support a per-server tag (frontend/src/schemas/dns.ts), and routing rules support matching on inboundTag with an outboundTag (frontend/src/schemas/routing.ts). In Xray-core, a tagged DNS server's queries can be matched by a routing rule via that tag and redirected to a specific outbound. If that holds for your Xray-core version, you could add a DNS server tagged e.g. wg-dns in the DNS settings and a routing rule inboundTag: ["wg-dns"] -> outboundTag: "<your-wireguard-outbound-tag>" to force that resolver's queries through the tunnel, without a dedicated per-outbound DNS field. Please verify this actually resolves through the tunnel in your setup before relying on it, since I have not tested it against a running instance.

Labeling this as an enhancement — a first-class DNS option inside the WireGuard outbound settings (mirrored in the form, schema, and any relevant locale strings) would still be the more direct fix.


این مورد یک قابلیت گمشده است، نه یک تنظیم موجود که به‌درستی کار نمی‌کند. طبق بررسی کد فعلی، تنظیمات خروجی WireGuard در پنل فیلدی برای DNS ندارد. به‌عنوان راه‌حل موقت (که خودم تست نکرده‌ام)، می‌توانید در تنظیمات DNS یک سرور با tag مشخص اضافه کنید و در Routing Rules با inboundTag همان تگ، ترافیک را به outboundTag خروجی WireGuard هدایت کنید.

This reply was generated automatically and a maintainer may follow up.

<!-- gh-comment-id:4905536844 --> @github-actions[bot] commented on GitHub (Jul 7, 2026): This is confirmed as a missing feature, not an existing setting that is misbehaving. **What I checked:** - The WireGuard outbound settings schema (`frontend/src/schemas/protocols/outbound/wireguard.ts`) only defines `address`, `secretKey`/`pubKey`, `domainStrategy`, `mtu`, `noKernelTun`, `reserved`, and per-peer `publicKey`/`preSharedKey`/`allowedIPs`/`endpoint`/`keepAlive`. There is no `dns` field, and the outbound form (`frontend/src/pages/xray/outbounds/protocols/wireguard.tsx`) does not expose one either — so there is currently no panel option equivalent to the `DNS =` line in a standard `wg-quick` config. - On the backend, outbound configs are passed through to Xray-core largely as raw JSON (`internal/web/service/xray.go`), so this isn't a case of the server stripping a field you can already set — the panel's form/schema simply doesn't offer it. Even if you hand-edited the raw outbound JSON to add a `dns` key, it would be dropped the next time the outbound is saved through the form, since the Zod schema only keeps the fields listed above. - A near-identical request, #3453 ("DNS support in WireGuard outbound"), was filed and closed by the maintainer as completed on 2026-05-29, but I don't see a corresponding change to the WireGuard outbound schema in the file history, so the feature does not appear to actually be implemented yet in the current codebase (3.4.2 or later). **Possible existing workaround (untested by me, worth trying):** the panel's DNS settings support a per-server `tag` (`frontend/src/schemas/dns.ts`), and routing rules support matching on `inboundTag` with an `outboundTag` (`frontend/src/schemas/routing.ts`). In Xray-core, a tagged DNS server's queries can be matched by a routing rule via that tag and redirected to a specific outbound. If that holds for your Xray-core version, you could add a DNS server tagged e.g. `wg-dns` in the DNS settings and a routing rule `inboundTag: ["wg-dns"] -> outboundTag: "<your-wireguard-outbound-tag>"` to force that resolver's queries through the tunnel, without a dedicated per-outbound DNS field. Please verify this actually resolves through the tunnel in your setup before relying on it, since I have not tested it against a running instance. Labeling this as an enhancement — a first-class `DNS` option inside the WireGuard outbound settings (mirrored in the form, schema, and any relevant locale strings) would still be the more direct fix. --- این مورد یک قابلیت گمشده است، نه یک تنظیم موجود که به‌درستی کار نمی‌کند. طبق بررسی کد فعلی، تنظیمات خروجی WireGuard در پنل فیلدی برای DNS ندارد. به‌عنوان راه‌حل موقت (که خودم تست نکرده‌ام)، می‌توانید در تنظیمات DNS یک سرور با `tag` مشخص اضافه کنید و در Routing Rules با `inboundTag` همان تگ، ترافیک را به `outboundTag` خروجی WireGuard هدایت کنید. *This reply was generated automatically and a maintainer may follow up.*
bsakaguchi changed title from [GH-ISSUE #5853] [Bug]: WireGuard Outbound: DNS queries use system DNS instead of being resolved inside the WireGuard tunnel / خروجی WireGuard: درخواست‌های DNS از DNS سیستم استفاده می‌کنند و داخل تونل Wir… to [GH-ISSUE #5853] [Bug]: WireGuard Outbound: DNS queries use system DNS instead of being resolved inside the WireGuard tunnel / خروجی WireGuard: درخواست‌های DNS از DNS سیستم استفاده می‌کنند و داخل تونل Wir… 2026-11-07 20:38:21 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4066
No description provided.