openwrt / openwrt/packages

SmartDNS: Starts before wireguard tunnels - DNS over VPN refused

Open
#28,539 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Makefile
Stars
4.6k
Forks
4k
Avg merge
3d 12h
Merged PRs (30d)
134

Description

Package Name

smartdns

Maintainer

@pymumu

OpenWrt Version

All

OpenWrt Target/Subtarget

All

Steps to Reproduce
  1. Setup a Wireguard tunnel (named vpn)
  2. Setup smartdns in port 53 (main server, no dnsmasq proxy) and bind it to the tunnel interface as well
  3. Reboot the router
  4. On a tunnel peer try to run a DNS query using the smartdns as server
root@Swift:~# cat /etc/config/smartdns

config smartdns
        option enabled '1'
        option server_name 'swift'
        option port '53'  <--- important, not set as dnsmasq upstream proxy
        option auto_set_dnsmasq '1'
        option tcp_server '1'
        option ipv6_server '1'
        option bind_device '1'
        option dualstack_ip_selection '1'
        option serve_expired '1'
        option cache_persist '1'
        option resolve_local_hostnames '1'
        option force_https_soa '1'
        option rr_ttl_min '60'
        option seconddns_port '6553'
        option seconddns_tcp_server '1'
        option bind_device_name 'br-lan,vpn' <--- bound to the br-lan and also the wireguard interface
        option old_port '53'
        option old_enabled '1'
        option old_auto_set_dnsmasq '1'
(...)
Actual Behaviour

SmartDNS replied from the LAN but not to wireguard peers.

  • Lan machine test => works fine.
  • Now a remote peer on the VPN, sometimes it works, others I get "connection refused".

Looks to me like there's some timing issue around wireguard and smartdns where smartdns starts before the tunnel is working properly and never binds to the tunnel IP.

Thank you.

Confirmation Checklist

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reboot sequence with smartdns bound to br-lan and vpn, then inspect the smartdns service startup configuration and how it handles the WireGuard interface. Done when remote WireGuard peers consistently receive DNS responses after startup, including when the tunnel is not ready before smartdns starts.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.