Gentoo Archives: gentoo-user

From: Marat BN <maratbn@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Wireless DHCP takes over resolv.conf
Date: Tue, 12 Jul 2016 22:58:59
Message-Id: 57857619.9000609@gmail.com
In Reply to: [gentoo-user] Wireless DHCP takes over resolv.conf by Mick
1 The solution I use when dealing with the problem of network software
2 overwriting '/etc/resolf.conf' is to make that file immutable with
3 'chattr +i'.
4
5 Not quite an answer to your question on nameserver prioritization, but
6 could be useful to prevent your nameservers from being changed.
7
8
9 -- Marat
10
11
12
13 On 07/09/2016 07:53 AM, Mick wrote:
14 > Hi All,
15 >
16 > I just noticed my resolv.conf is topped up with the nameservers of the
17 > wireless LAN I happen to be associated at the time and my wired ethernet
18 > nameserver(s) are pushed further down. This happens despite the fact that I
19 > have configured my wired ethernet to have a lesser priority than the wired NIC.
20 >
21 > For example:
22 >
23 > less /etc/resolv.conf
24 > # Generated by dhcpcd from wlan0.dhcp, enp11s0.dhcp
25 > # /etc/resolv.conf.head can replace this line
26 > domain openwifi
27 > nameserver 192.168.22.22
28 > nameserver 192.168.22.23
29 > nameserver 10.10.10.254
30 > # /etc/resolv.conf.tail can replace this line
31 >
32 > The first 3 non-commented entries were produced by wlan0, demoting my wired
33 > ethernet nameserver.
34 >
35 > ip route show
36 > default via 10.10.10.254 dev enp11s0 metric 10
37 > default via 10.160.95.1 dev wlan0 metric 20
38 > 10.10.10.0/24 dev enp11s0 proto kernel scope link src 10.10.10.7 metric 10
39 > 10.160.95.0/29 dev wlan0 proto kernel scope link src 10.160.95.2 metric 20
40 > 127.0.0.0/8 dev lo scope host
41 >
42 > If I am associated, but not authenticated with the wireless LAN, any URLs I
43 > try to visit will be queried with the 192.168.22.2* nameserver, before it
44 > times out and 10.10.10.254 takes over.
45 >
46 > Waiting for URLs to resolve becomes tedious after a while. Is there a way to
47 > prioritise nameservers so that the NIC metric is respected, whenever the
48 > resolv.conf content is updated?
49 >