I have the following setup on my local network:
- A local DNS server running at 10.0.0.102
- On the router i have set the primary DNS to 10.0.0.102 and secondary to 8.8.8.8
- An Ubuntu server running on 10.0.0.106 with a DNS entry "myserver.lan" on my DNS server
Now on my windows pc I can ping or ssh into myserver.lan without issues. On my Ubuntu server however I cannot and I just can't understand how Ubuntu DNS works...It keeps changing the Current DNS Server to 8.8.8.8, as show in the screenshot below, and hence doesn't find "myserver.lan" because google is unaware of it obviously.
I am trying to setup Mongodb in replica set mode on my Ubuntu server. When I try to run rs.initiate it fails as it cannot find the Mongodb instance.
rs.initiate( {
_id: "rs0",
version: 1,
members: [
{_id: 0, host: "myserver.lan:27011"}
]});
Output from resolvectl status
The output as text:
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (eno1)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 8.8.8.8
DNS Servers: 10.0.0.102 8.8.8.8
DNS Domain: lan
I tried setting nameserver in /etc/resolv.conf and it works temporarily but I soon as I run docker service create command it resets to it's default state. If I understand correctly that is not even the issue as the namesever in this file points to systemd-resolved which actually resolves the DNS.
I tried adding nameservers to my config in /etc/netplan/00...yaml then running sudo netplan generate and sudo netplan apply. But again it doesn't do anything.
In /run/systemd/resolve/resolv.conf the setup is actually correct ie. there are two nameservers, the first being 10.0.0.102 and the second 8.8.8.8, and under search i have "lan" listed. File /run/systemd/resolve/stub-resolv.conf is the same as /etc/resolv.conf which is correct from what I understand.
How can I make Ubuntu to use my DNS server for my "lan" domains?