saving dns change on Network->Global Configuration doesn't always save
Description
Problem/Justification
Impact
SmartDraw Connector
Katalon Manual Tests (BETA)
Activity

Dru Lavigne August 7, 2019 at 11:26 AM
the Domain Controller service has been removed for 11.3.

James August 7, 2019 at 2:36 AM
Okay, I was able to duplicate how the DNS got set to 127.0.01.
If you try to start the Services -> Domain Controller service with nothing configured in the Domain Controller it fails to start (obviously). But not so obviously, it sets the nameserver to 127.0.0.1 in /etc/resolv.conf.
I have a separate VM for testing the Domain Controller. My main FreeNAS has no domain controller. I remember clicking start in the wrong web UI yesterday but didn't think anything of it.
Nothing the user should be able to do in the UI should break dns connectivity.
If nothing is configured for the Domain Controller then yes give an error, but don't change /etc/resolv conf.
Also, when the error for the Domain Controller start happens the on-screen UI shows the auto-start for this service to be still unchecked. However, if you leave the page and come back you'll see it's actually set to auto-start.
Things to consider
As soon as someone starts the Domain Controller the settings in the Web UI for Network -> General don't match reality.
Suggested quick fix
If changing /etc/resolv.conf to 127.0.0.1 is needed for the Domain Controller functionality, then this should only be updated if/after the domain controller service successfully starts. Similarly, setting the Domain Controller service to auto-start should only be set if/after the domain controller starts.
This would fix all the problems.
Details
Details
Assignee

Reporter

There are two related problems, I can only replicate one.
The first problem was that /etc/resolv.conf had DNS set to 127.0.0.1. But no local DNS server is running. I only noticed this when the Update check stopped working. I am not sure what triggered the DNS being set to 127.0.0.1 as I didn't do this intentionally.
Once I knew that the problem was DNS related I went into the Web UI to fix it. My dns nameserver was still set correctly here (i.e. my router's ip of 192.168.0.1).
I clicked save. Here's where the second problem kicks in and this is 100% repeatable.
expected behavior
The /etc/resolv.conf always gets updated with the IP in the web ui. nslookup type functionality is restored.
actual behavior
The contents of /etc/resolv.conf is not updated.
Work around
In the web ui change Nameserver 1 to some other ip address (e.g. 192.168.0. 22 ). Click Save. Since the ip address "changed" now it actually saves it. Now change it back to the correct IP address (192.168.0. 1 ). Click save. Since the ip addres "changed" now it saves it to /etc/resolv.conf
How to manually replicate
Manually change the nameserver ip in /etc/resolv.conf from the shell.
note: I am not suggesting people change /etc/resolv.conf manually. This is just to demonstrate the problem.
In the web ui click save (with no changes). Note that /etc/resolv.conf isn't changed.
i.e. the problem is that if the IP address in the UI doesn't "change" it doesn't update /etc/resolv.conf. You can see this by the fact that the time it takes to save the change is longer when the IP adress in the UI actually changes.
I think this is a case of doing more work to be too clever.
During testing I tried adding a second nameserver #2 with the same ip address (192.168.0.1). Unfortunately, you are two "clever" and since it's the same IP address for both nameservers it considers this as not changing the DNS servers either and won't update /etc/resolv.conf in this case either.
Dumb is good. Just save the settings every time. Especially as in this case, since if dns is broken updating and other functionality will be broken and can't be obviously fixed with a simple re-save of the DNS settings.