I have several Ubuntu servers. Two of them are working as DNS servers. One of my name servers (let's call it DNS1) went down for maintenance. I sill had another DNS server running (DNS2).
All other servers are configured to use the nameservers as follows
nameserver DNS1 nameserver DNS2
I can still resolve DNS names using the DNS2 server, but the name resolution takes a long time. It is clear to me that any given server is first trying to access DNS1, and then it is trying DNS2 after failure.
I tried to swap the two lines. The name resolution became too fast.
I am wondering if there is a way to dynamically change the
resolv.conf file based on the state of the configured nameservers. Of course, I can write a shell script myself to do the job. But I prefer to find a better way if there is one.