[Networkmanager] dns-priority ignored

Michael Traxler M.Traxler at gsi.de
Mon Dec 19 17:50:42 UTC 2022


On Fri, 16 Dec 2022, Thomas Haller wrote:

> Date: Fri, 16 Dec 2022 11:15:31
> From: Thomas Haller <thaller at redhat.com>
> To: Michael Traxler <M.Traxler at gsi.de>, networkmanager at lists.freedesktop.org
> Subject: Re: [Networkmanager] dns-priority ignored
> 
> On Thu, 2022-12-15 at 12:34 +0100, Michael Traxler wrote:
>> I use on many OpenSuse Tumbleweed machines two network cards with
>> their own
>> VLAN and their separate DHCP- and DNS-servers and have a common
>> problem in all
>> systems (over a longer time now).
>>
>> The order of the DNS-servers of the two VLANs in /etc/resolv.conf is
>> changing
>> and in the end is arbitrary.
>>
>> I tried everything from the manual, so changing the dns-priority to
>> different
>> values, even using
>>
>> $ nmcli connection modify internal_VLAN ipv4.dns-priority -100
>>
>> and keeping the other interface at positive 100 doesn't change the
>> outcome,
>> that the resulting order of DNS-entries in /etc/resolv.conf is
>> changing from
>> restart to restart of the network
>> for example by calling
>> $ systemctl restart NetworkManager.service
>>
>> Is there something I overlooked in the manual?
>>
>> I don't see how I can reach the point, that the result is constant
>> and
>> retrieved from the DHCP-servers.
>>
>> The only workaround for me:
>> ipv4.ignore-auto-dns yes
>>
>> and setting the dns to a fixed string.
>>
>> Any hints?
>>
>> Thanks,
>>
>> Michael
>
>
> hi,
>
>
> Setting the dns-priority should be the way to go.
> If it doesn't work, it's not clear why it would not.
>
> Check the `level=TRACE` logs. See "DEBUGGING" in `man NetworkManager` .
>
>
> Thomas
>


Hello Thomas,

thanks for the reply!

After checking with detailed logging (level=TRACE) I realized that
NetworkManager does everything correct, even better than expected (e.g. when a
network is temporary down and comes back, all handled perfectly!).
In the end I think I found the problem(s):

The arbitrary order of assignment in /etc/resolv.conf might have been a
misinterpretation on my side by checking the /etc/resolv.conf too fast (before
all results from dhcp are settled) via
$ systemctl restart NetworkManager.service; cat /etc/resolv.conf
A sleep 1 between restart and cat keeps this stable.

Still I could not reliably DNS-resolve different names from the different
nameservers in the two networks, e.g. two times the dns-lookup worked, the
third time not... Annoying problems happening quite often on my systems.

It turns out:
The nscd (name service cache daemon) seems to be confused from time to time
when things change in the configuration (maybe restart of NetworkManager?)

In the end, if I restart the nscd via
$ systemctl restart nscd.service
everything works like a charm!

Great (amazingly versatile and soo useful) software and thanks again!

Michael



More information about the Networkmanager mailing list