Re: 11.2 sometimes wrong /etc/resolv.conf
On Thu, 10 Mar 2022 17:22:34 +0100
Christian Groessler <chris@groessler.org> wrote:
> 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?
The cable network's DHCP server should provide the relevant information
automatically. If you are using NetworkManager, you can insert a script
to find out what it provides into /etc/NetworkManager/dispatcher.d/.
Something like:
echo "Routers value is |$DHCP4_ROUTERS|. IP4_GATEWAY is
|$IP4_GATEWAY|." echo "Environment is:" printenv
and send the output to a log file. The variable you want is
DHCP4_DOMAIN_NAME_SERVERS, and possibly others (see the results from
printenv).
You may have to request certain information from a badly configured
server. In your /etc/dhcp/dhclient.conf, something like:
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
rfc3442-classless-static-routes, ntp-servers;
You will probably need at least the second and/or third line.
--
Does anybody read signatures any more?
https://charlescurley.com
https://charlescurley.com/blog/
Reply to: