DNS issues, especially when using a VPN? Try this. (Bug: Server returned error NXDOMAIN)

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Yfrwlf
Level 3
Level 3
Posts: 171
Joined: Sat Jun 08, 2013 7:46 pm

DNS issues, especially when using a VPN? Try this. (Bug: Server returned error NXDOMAIN)

Post by Yfrwlf »

Posting this here in case it helps someone else. For me this issue was happening when using a VPN on a VM host. The Linux guest in Virtualbox kept having it's DNS broken intermittently, so I'm posting the workaround here. A patch with the actual fix for this issue has been merged into systemd (see below details), but we have not gotten this bug patched yet by the Ubuntu/Linux Mint developers for Ubuntu 18.04 / Linux Mint 19.x. It'd be great if this patch reached the LTS version of Ubuntu so we would get it.



You'll know if you have broken DNS if you do the following and get an error resolving the DNS name:

Code: Select all

host one.one.one.one
But can ping it:

Code: Select all

ping 1.1.1.1


Check if you're seeing the following error as it is indicative of this specific bug:

Code: Select all

sudo systemctl status systemd-resolved.service
Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Note that seeing the above error doesn't mean your DNS is broken, but it is still indicative of this bug.



Try the following fix:

First, note the existing configuration:

Code: Select all

$ ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Aug 12  2017 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
Then run the following:

Code: Select all

sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
That re-links it to the resolv.conf file instead of the stub-resolv.conf file.

Then, restart systemd-resolved:

Code: Select all

sudo systemctl restart systemd-resolved.service
Check if DNS is working by using the "host <whatever domain>" command from above, or just browsing the web as normal. If this doesn't fix your issue, you can revert these changes and revert the link back to the stub-resolv.conf file by running:

Code: Select all

sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf


Background info about the fix:

Workaround is from:
https://www.linode.com/community/questi ... buntu-1804
Bug report:
https://github.com/systemd/systemd/issues/9833
Bug report and merged fix:
https://github.com/systemd/systemd/pull/9836
An Ask Ubuntu report about this issue:
https://askubuntu.com/questions/1063462 ... r-a-lookup
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Locked

Return to “Networking”