DevHeads.net

Custom Local DNS with Ubuntu Clients

Hi Everyone,

I have a single linux desktop client running Ubuntu, and have 2 physical
servers that are on my network that providing DNS resolution.

I want the linux desktop to use the local servers for DNS resolution only,
but Ubuntu somehow keeps finding the DNS server that is in the router/modem
that my ISP has provided me with.

Is there a way I can stop the IP address of my router from being added to
the /etc/resolv.conf file?

I tried removing the resolvconf package, but this broke things as for some
reason I wasn't able to then create my own resolv.conf file.

Thanks for any help you are able to give me.

Comments

Re: Custom Local DNS with Ubuntu Clients

By Tom H at 03/11/2018 - 12:33

On Sun, Mar 11, 2018 at 11:53 AM, Aero Maxx <aero.maxx. ... at gmail dot com> wrote:
What is the app that's managing the network? NM? ifupdown? systemd-networkd?

Is resolvconf or systemd-resolved involved in setting up "/etc/resolv.conf"?

What's the output of "ls -l /etc/resolv.conf" and "cat /etc/resolv.conf"?

Re: Custom Local DNS with Ubuntu Clients

By Aero Maxx D at 03/11/2018 - 13:42

It is Network Manager, if I configure the adapter in the top right corner,
it has the DNS as follows.

Primary DNS: 192.168.0.1
Secondary DNS: 192.168.0.113
Ternary DNS: 192.168.0.114

I'm not wanting to bypass my DNS servers and don't want to use the Primary
DNS server, as my DNS servers are set to query my ISP DNS servers for
addresses that it doesn't know.

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
<a href="http://www.avast.com" title="www.avast.com">www.avast.com</a>
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Re: Custom Local DNS with Ubuntu Clients

By Tom H at 03/11/2018 - 19:43

On Sun, Mar 11, 2018 at 2:42 PM, Aero Maxx <aero.maxx. ... at gmail dot com> wrote:
Given that "/etc/resolv.conf" is a symlink to
"/run/resolvconf/resolv.conf", these nameservers must be unused because
they must be in "/run/NetworkManager/resolv.conf" (I hope that the path is
correct; I don't use any of these apps; at least not like this) if
"dns=dnsmasq" in "/etc/NetworkManager/NetworkManager.conf".

Re: Custom Local DNS with Ubuntu Clients

By Aero Maxx D at 03/11/2018 - 13:34

I'm unsure, I'm using the default install of Ubuntu Desktop 16.04 LTS

Is resolvconf or systemd-resolved involved in setting up "/etc/resolv.conf"?

I believe it is resolvconf as this is installed by default.

root@ubuntu:~# ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Mar 10 13:53 /etc/resolv.conf ->
../run/resolvconf/resolv.conf

root@ubuntu:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by
resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
<a href="http://www.avast.com" title="www.avast.com">www.avast.com</a>
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Re: Custom Local DNS with Ubuntu Clients

By Tom H at 03/11/2018 - 19:30

On Sun, Mar 11, 2018 at 2:34 PM, Aero Maxx <aero.maxx. ... at gmail dot com> wrote:

NM.

OK.

So you have both resolvconf and dnsmasq running (IIRC, the Ubuntu default,
as you say above).

AFAIK, you can drop a file into "/etc/dnsmasq.d/" with
"server=nameserver_ip_address" to ensure that dnsmasq forwards queries to
it.

Re: Custom Local DNS with Ubuntu Clients

By Tom H at 03/11/2018 - 19:33

On Sun, Mar 11, 2018 at 8:30 PM, Tom H < ... at gmail dot com> wrote:
OOPS!

If you only have dnsmasq-base installed (which, AFAIR, is the
default), you have to use "/etc/NetworkManager/dnsmasq.d/" not
"/etc/dnsmasq.d/".

Re: Custom Local DNS with Ubuntu Clients

By silver.bullet at 03/11/2018 - 13:12

On Sun, 11 Mar 2018 13:33:03 -0400, Tom H wrote:
What happens if you ensure that /etc/resolv.conf isn't a link, but an
immutable file? SICR

Re: Custom Local DNS with Ubuntu Clients

By Tom H at 03/11/2018 - 19:21

On Sun, Mar 11, 2018 at 2:12 PM, Ralf Mardorf <silver. ... at zoho dot com> wrote:
Only if the various tools that modify "/etc/resolv.conf" can't be made
to update it as desired.

Since they do, "chattr +i /etc/resolv.conf" is incompetent system
administration.

Re: Custom Local DNS with Ubuntu Clients

By Aero Maxx D at 03/11/2018 - 13:37

Sure that would work as I could change the file and then make it immutable,
but I'm not sure this is an acceptable solution.

There must be a better way surely than breaking functionality.

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
<a href="http://www.avast.com" title="www.avast.com">www.avast.com</a>
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Re: Custom Local DNS with Ubuntu Clients

By silver.bullet at 03/11/2018 - 13:57

On Sun, 11 Mar 2018 18:37:13 +0000, Aero Maxx wrote:
Yesno.

Assuming this dirty workaround should work, it would be an acceptable
solution, since the "right" way to do it, much likely would break with
an upgrade as a dirty hack would do, too.

Fortunately for my real-time audio needs such issues are unimportant
and Linux provides advanced audio real-time capabilities. However, if
real-time audio wouldn't be my domain, I would consider to migrate to
FreeBSD [1], since it does less suffer from the Linux "heute hü und
morgen hott" approach [2].

[1]
The only issue with FreeBSD for non-real-time-audio usage is the new
utter crap CoC:

<a href="https://www.freebsd.org/internal/code-of-conduct.html" title="https://www.freebsd.org/internal/code-of-conduct.html">https://www.freebsd.org/internal/code-of-conduct.html</a>

[2] I'm unable to translate it, so here we go:

"Es geht nicht an: heute hü, morgen hott oder andersherum.
We cannot tolerate things being done one way one day and a different
way the next for no apparent reason. Es geht nicht an: heute hü, morgen
hott oder andersherum. We cannot tolerate things being done one way one
day and a different way the next for no apparent reason." -
<a href="http://context.reverso.net/%C3%BCbersetzung/deutsch-englisch/h%C3%BC%2C+morgen+hott" title="http://context.reverso.net/%C3%BCbersetzung/deutsch-englisch/h%C3%BC%2C+morgen+hott">http://context.reverso.net/%C3%BCbersetzung/deutsch-englisch/h%C3%BC%2C+...</a>

Re: Custom Local DNS with Ubuntu Clients

By Tom H at 03/11/2018 - 19:48

On Sun, Mar 11, 2018 at 2:57 PM, Ralf Mardorf <silver. ... at zoho dot com> wrote:
No. An upgrade wouldn't break the setup. That's the point of conffiles.

Re: Custom Local DNS with Ubuntu Clients

By Colin Law at 03/11/2018 - 11:01

On 11 March 2018 at 15:53, Aero Maxx <aero.maxx. ... at gmail dot com> wrote:
Can't you change it in the router?

Colin

Re: Custom Local DNS with Ubuntu Clients

By Aero Maxx D at 03/11/2018 - 12:02

The router is announcing itself to the network as the DNS server so Ubuntu
picks up 192.168.1.1 in the /etc/resolv.conf file.

Re: Custom Local DNS with Ubuntu Clients

By Aero Maxx D at 03/11/2018 - 12:04

There is no option for DNS settings in the router GUI this is unfortunately
locked down.

I could obviously buy a new router, but there must be a better way?