I am running a pretty basic wireguard VPN and am at my wits end trying to get DNS working. The behavior is as follows (with the VPN up)
- Can ping IP address of a machine on my LAN, e.g.
192.168.50.24 - This machine has some hostname, e.g. "
lan_machine." Pings to this hostname fail (failure in name resolution). I.e.,ping lan_machinedoes not work.
I have the DNS line in my wireguard config set to my router, and attempts to resolve lan_machine through its address work (e.g., via dig). resolvectl status output is the following
$ sudo resolvectl status wg0 Link 3 (wg0) Current Scopes: DNS Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported Current DNS Server: 192.168.50.1 DNS Servers: 192.168.50.1 DNS Domain: ~. Default Route: yes
which seems "right" to me, but, of course, lan hostname look-ups (pings, ssh) fail.
The only thing I have gotten to work is literally echoing my router address to resolv.conf, a-la
echo 'nameserver 192.168.50.1' | sudo tee /etc/resolv.conf
This operation of course has to be done randomly because who knows what is actually writing/owning that file. Nonetheless, lan hostname lookups work if I do this.
I have no idea what is going on or what a good persistent solution is. I've spent probably cumulative 6 hours on google trying to solve this problem.
Let me know if I can provide additional information.
Source: r/linuxquestions · by /u/PancakeMSTR