I have a home network. DHCP lease works for every other system / appliance but Ubuntu 22 in that I lease out local DNS server with its local subnet / zones as primary DNS server 172.16.100.22. And DHCP lists secondary DNS server as 8.8.8.8 which is fallback in case my local DNS server(services) dies or I am fixing things and so revert back to google if my lab is fubar (keep wife / kids happy).
But ...
ubuntu resolver
resolvectl status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (eth0)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 8.8.8.8
DNS Servers: 172.16.100.22 8.8.8.8 fe80::9e65:f9ff:fe38:6d27%21971
DNS Domain: lan penguinpages.local
Link 3 (eth1)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
DHCP lease for Winows VMs
Ethernet adapter vEthernet (External):
Connection-specific DNS Suffix . : penguinpages.local
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
Physical Address. . . . . . . . . : 80-6D-97-05-09-12
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 172.16.100.32(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Monday, June 27, 2022 8:33:22 AM
Lease Expires . . . . . . . . . . : Tuesday, July 5, 2022 12:03:02 PM
Default Gateway . . . . . . . . . : 172.16.100.1
DHCP Server . . . . . . . . . . . : 172.16.100.1
DNS Servers . . . . . . . . . . . : 172.16.100.22
8.8.8.8
NetBIOS over Tcpip. . . . . . . . : Enabled
/etc/resolve.conf
nameserver 127.0.0.53
options edns0 trust-ad
search penguinpages.local
I don't want to rip apart anything standard within Ubuntu, but I need it to stop flipping around on DNS.
Fresh boot DNS lookup
nerd@lt:~/.ssh$ resolvectl status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Current DNS Server: 172.16.100.22
DNS Servers: 172.16.100.22
Fallback DNS Servers: 8.8.8.8
DNS Domain: penguinpages.local
Link 2 (eth0)
nerd@lt:~/.ssh$ nslookup ados.penguinpages.local
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: ados.penguinpages.local
Address: 172.16.100.22
Name: ados.penguinpages.local
Address: 172.16.101.22
but 20 min later.....
nerd@lt:~$ resolvectl status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (eth0)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 8.8.8.8
DNS Servers: 172.16.100.22 8.8.8.8 fe80::9e65:f9ff:fe38:6d27%21971
DNS Domain: lan penguinpages.local
Link 3 (eth1)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
nerd@lt:~$ nslookup cka01.penguinpages.local
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find cka01.penguinpages.local: NXDOMAIN
I realize it is caching things.. so resolution to "ados.penguinpages.local" still resolved but any new DNS entries.. added dynamically or real time then start failing.
I just need it to pin to the primary DNS server and STOP moving to secondary.
I was watching /var/log/syslog for any notes of timeout on DNS or some reason why it would flip.. but nothing in that log.
I also tried to manually effect this behavior via
sudo vi /etc/systemd/resolved.conf
#DNS=
DNS=172.16.100.22
#FallbackDNS=
FallbackDNS=8.8.8.8
#Domains=
Domains=penguinpages.local
#DNSSEC=no
#DNSOverTLS=no
But this did not fix things
Question
- How to get Ubuntu DNS to NOT flip DNS server lookup to secondary if primary working
- How can I keep using DHCP, but overide DNS and so just drop to single local DNS server as work around
PS: This also effects all shells where characters no longer echo back as you type (this is first symptom you get that things have "flipped". The "fix" is "reset" command which not sure.. but my guess is helps wayland fix that DNS flipped and is now fubar.
ipv4.ignore-auto-dns
andipv6.ignore-auto-dns
set toyes
usingnmcli con $CON mod
work perfectly, in conjunction with setting a value foradditional DNS server
in the setting usingipv4.dns
andipv6.dns
. – Samveen Jan 03 '23 at 10:34