A note
New question, since everything else on this matter appears to be outdated and/or conflicting. Hold your close votes, please :)
The problem
On stock installs of Ubuntu 12 and 14 Server, the going advice seems to be that the way you make DNS changes is to edit the interfaces file and add the dns- options there. Only problem is, on servers, where uptime is a concern, it appears the only way to force those changes to be be applied is to bounce the affected network interface with ifdown/ifup
.
I've got a large number of servers to make a set of DNS changes on, and I need to update their resolver configurations, en masse, without toggling the network interfaces in this fashion. I also need to make sure the changes stick after a reboot.
The problem is that all of these servers were built with the dns- options in the interfaces
file, meaning that if I change resolvconf
's head
or tail
files, I'll end up with a bunch of duplicate lines on reboot.
The process needs to be something like:
- Completely eliminate the resolver configuration (it's all over the place right now)
- Set the options to new, known-good values
- Save those options so they are used by applications immediately, and so they'll be in place after a reboot.
So, a recap:
What won't work
- Editing the lines in
interfaces
(requires an outage to recycle the interface) - Editing resolv.conf directly (won't take effect, won't be saved)
- Editing the resolvconf
head
ortail
files (won't take effect, will have duplicate lines on reboot)
The actual question
Is there a way to effect a change like this, without interrupting service? Ideally, I could force resolvconf to go through its update process without toggling the interface.
search
entry takes effect and multiplenameserver
entries shouldn't be a problem.sed
to delete entries ininterfaces
, addresolvconf.d/base
orresolvconf.d/tail
, runresolvconf -u
and ignore the duplicate entries (which will go away next reboot/network cycle anyway).