Change what DNS server is used for nameserver lookups in Ubuntu 18
I think my main problem is CenturyLink is terrible, and i don’t want to use its DNS. But i also don’t want to use DNS from whichever network i happen to be connected to, so i want an on-my-laptop setting (not my router) that is used regardless of whether i’m plugged in to ethernet or connected to absolutely any wireless network.
- how to see what is handling dns on my computer
- good goddamn holy hell why is it impossible to set alternate nameservers like opendns for Ubuntu, regardless of which wifi connection is used, these days?
- 192.168.1.1
cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
ls -la /etc/netplan/
total 16
drwxr-xr-x 2 root root 4096 Apr 23 2018 .
drwxr-xr-x 182 root root 12288 Oct 22 11:50 ..
Nada. Nothing there. What the heck is controlling my network DNS on this computer?
cat /run/systemd/resolve/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 192.168.1.1
sudo vim /etc/resolvconf/resolv.conf.d/base
And put this in there:
ameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 2606:4700:4700::1111
nameserver 2606:4700:4700::1001
sudo resolvconf -u
sudo service network-manager restart
But still exactly the same server beeing used for lookup, arghhh:
nslookup agaric.coop
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: agaric.coop
Address: 162.247.75.218
Not much clue in the log?
Oct 22 18:57:17 oryx systemd-resolved[1177]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Oct 22 18:57:17 oryx nm-dispatcher: req:6 'connectivity-change': start running ordered scripts...
Oct 22 18:57:19 oryx goa-daemon[4271]: /org/gnome/OnlineAccounts/Accounts/account_1529698497_0: Setting AttentionNeeded to FALSE because EnsureCredentials() succeded
Oct 22 18:57:24 oryx systemd-resolved[1177]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Oct 22 18:57:24 oryx systemd-resolved[1177]: message repeated 4 times: [ Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.]
Oct 22 18:57:27 oryx systemd[1]: NetworkManager-dispatcher.service: Succeeded.
Oct 22 18:57:38 oryx systemd[1]: systemd-hostnamed.service: Succeeded.
After trying every damn thing short of the wifi-connection-specific configuration, it still is using the wrong DNS servers:
systemd-resolve --status wlp3s0
Link 3 (wlp3s0)
Current Scopes: DNS
DefaultRoute setting: yes
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server: 192.168.1.1
DNS Servers: 192.168.1.1
DNS Domain: ~.
So i finally gave in and did the wifi-specific configuration, and it at least mostly sees the wanted DNS server:
systemd-resolve --status wlp3s0
Link 3 (wlp3s0)
Current Scopes: DNS
DefaultRoute setting: yes
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server: 1.1.1.1
DNS Servers: 192.168.1.1
1.1.1.1
1.0.0.1
DNS Domain: ~.
BUT IT’S STILL NOT USED (not that the earlier one was actually used either?)
nslookup agaric.coop
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: agaric.coop
Address: 162.247.75.218
That first server should be 1.1.1.1, aaauugggghhhhh!
ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Jun 22 2018 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
cat /run/systemd/resolve/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 192.168.1.1
nameserver 1.1.1.1
nameserver 1.0.0.1
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
… and now it’s using 192.168.1.1 which, whatever it is, is less broken than 127.0.0.53? And i can actually connect to agaric.zulipchat.com which was blocked. Still don’t understand anything, sob
But good enough for now.
nslookup agaric.coop
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: agaric.coop
Address: 162.247.75.218
hahahahaha that is probably the stupidest thing i had to do on linux and i still don’t have it how i want or have any clue what’s going on, but i’m now using slightly less-stupid DNS?
Resources tried:
- https://techwiser.com/check-your-dns-server/
- https://developers.cloudflare.com/1.1.1.1/setting-up-1.1.1.1/linux/
- https://unix.stackexchange.com/questions/128220/how-do-i-set-my-dns-when-resolv-conf-is-being-overwritten/163506
- https://askubuntu.com/questions/424466/how-to-add-two-ipv6-dns-nameservers-into-etc-network-interfaces
- https://askubuntu.com/questions/1128536/how-to-make-persistent-changes-to-etc-resolv-conf-ubuntu-18-10
- https://askubuntu.com/questions/1058750/new-alert-keeps-showing-up-server-returned-error-nxdomain-mitigating-potential
- https://www.linode.com/community/questions/17081/dns-stops-resolving-on-ubuntu-1804