[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

resolv.conf (was Re: electrons/the Internet [racism redacted])



On Mon, Mar 04, 2024 at 12:36:54PM -0800, David Christensen wrote:
> I believe Debian rewrites /etc/resolv.conf on every boot.

This is not correct.  It's *partly* correct if you ignore a lot of
complicating factors.

Short version: read <https://wiki.debian.org/resolv.conf>.

Long version follows:

If you have a static network interface configuration, defined in
/etc/network/interfaces, with no DHCP client, no VPN stuff going on,
etc. then your /etc/resolv.conf will not be changed.  You can edit the
file and put whatever you want in it, and it'll remain as you wish it
to be.

Unfortunately, almost *nobody* has a setup like this any more.

In a more typical environment, you get your IP address via DHCP, which
means you're running a DHCP client daemon.  Most DHCP client daemons
will rewrite the /etc/resolv.conf file every time they refresh their
DHCP lease.  This may indeed happen at boot time, but it'll also happen
a couple times a day during normal operations.

So, a simple instruction like "edit /etc/resolv.conf" is no longer
possible.  Even worse, there's no single *alternative* either.  You can't
even say "do ___ instead".

To put the correct values into your /etc/resolv.conf file nowdays, you
have to select a *strategy*.  You need to find an indirect way to put
the right content into some *other* place, in such a way that it will
eventually find its way into /etc/resolv.conf every time the file is
rewritten.  And there are *lots* of strategies that will work, so you
can't even say "obviously this one is best".  Life is not that simple.

Or, you could use chattr +i to make the /etc/resolv.conf file immutable,
so DHCP clients and other programs cannot overwrite it.

Either way, you take ownership of whatever strategy you decide to use,
together with its pros and cons.  You'll have to understand that on *this*
system, you went with *this* strategy, and remember where to put your
changes, and how to make them.  Or at the very least, you'll need to be
*aware* of all the strategies you've got in play on all of your systems,
and know how to identify which one is in use on any given system.

All of this is documented on <https://wiki.debian.org/resolv.conf>
but it's a virtual certainty that nobody in this thread will read that
wiki page and select a strategy and implement it and be happy.  Instead,
we will have another hundred-message argument, in which half the
participants will have no idea what the issue is (but will chime in loudly
anyway), and the second half will simply attack whatever strategies the
third half have selected.

And in another month or two, we'll do it all again.


Reply to: