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

Re: 11.2 sometimes wrong /etc/resolv.conf



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256



‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, March 10, 2022 9:22 AM, Christian Groessler <chris@groessler.org> wrote:

> Hi,
>
> when I boot my laptop with Debian 11.2 and LAN cable connected, I'm
> sometimes getting a wrong /etc/resolv.conf.
>
> The resolv.conf is not in fact wrong, but it's the one from the Wifi
> network. But when booting with network cable connected I want to have
> the resolv.conf of the cabled network.
>
> Can I somehow force this? That the "cabled-network-nameserver" is used
> when the cable is connected?

How about:

Create a resolv.com file with the cable network info (with a different name; I use /etc/resolv.com.qw).

Create a shell script that gets the current IP (hostname -I), checks for the desired nameserver IP, and copies your resolv.com.qw to /etc/resolv.com if necessary.  Or maybe always copy the file (one-liner in .bashrc) if you always want the same nameserver and want to save a couple ms.

Put the script at the bottom of the .bashrc (or equiv) in everybody's login dir.

The script will run when anybody logs in -- long after the network has been configured.

--
Glenn English


-----BEGIN PGP SIGNATURE-----
Version: ProtonMail

wsBzBAEBCAAGBQJiKlPnACEJEJ/XhjGCrIwyFiEELKJzD0JScCVjQA2Xn9eG
MYKsjDKYKAgAk87zZAIrAyhVKU9YD1cU4vXoZ08xLBJGQfy78yKXFaAEEwEw
qfg83L6YsDEdqX01DFU7Gvv0DyrPfNatit+Ut2/76cLJkfzDiGeqB1KzyI3a
R+yzLJy0aq71Ww/8dG4XUEAXt7ieIop3akjnmIHa0qUxo7rrFvVr8hG1hT22
NLWYGqFBgB4TnXJMbGDEyIXZUmsnvdzXcn883sXWna++Hg5r179rt+EG+rwn
vL0LWaeKV7TccFnP8J1siLFi9ZkeAZ5w5JXvPlkL5UKLnfIabcu1CORRHsIP
jWLSSs7ywRrwskvc/6+HvlsljPKbCsEPk3qocNoiAxkN6O+7t6FMdg==
=xTLN
-----END PGP SIGNATURE-----


Reply to: