Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 109015  / 3 Years ago, wed, july 28, 2021, 8:58:01

I know there are other posts here asking this, but those suggestions do not help, the configuration keeps changing and I simply cannot get my own changes to persist.


I have the Google 8.8.8.8 and 8.8.4.4 servers in my Network Manager configuration in the GUI, and


systemd-resolv --status returns


Link 2 (enp38s0f1)
Current Scopes: DNS
DefaultRoute setting: yes
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server: 8.8.8.8
DNS Servers: 8.8.8.8
8.8.4.4
DNS Domain: ~.

Nevertheless, dig google.com shows


;; Query time: 0 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Mon Oct 05 11:08:26 EDT 2020
;; MSG SIZE rcvd: 83


so my default route 192.168.1.1 as DNS. Furthermore, /etc/resolv.conf is a symlink to /run/systemd/resolve/resolv.conf, which in turn reads


# Generated by dhcpcd from enp38s0f1.dhcp, wlp0s20f3.dhcp
# /etc/resolv.conf.head can replace this line
domain fios-router.home
nameserver 192.168.1.1
# /etc/resolv.conf.tail can replace this line

The only enp38s0f1.dhcp file on this system (I've searched /) is /run/dhcpcd/resolv.conf/enp38s0f1.dhcp, which reads


# Generated by dhcpcd from enp38s0f1.dhcp
domain fios-router.home
search fios-router.home
nameserver 192.168.1.1


I have tried to write in other nameservers there, but they do not persist. In the past I've made the changes persistent by making the file immutable with chattr +i, but


lsattr /run/dhcpcd/resolv.conf/enp38s0f1.dhcp

returns


lsattr: Inappropriate ioctl for device While reading flags on /run/dhcpcd/resolv.conf/enp38s0f1.dhcp

so that attribute is not available here. And besides, I shouldn't have to make the file immutable anyway: there should presumably be some way I can control the DNS server..




Edit:


In response to comments below:


$ dpkg -l *dnsmasq*
---
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-================-===============-============-============================================
un dnsmasq <none> <none> (no description available)
ii dnsmasq-base 2.80-1.1ubuntu1 amd64 Small caching DNS proxy and DHCP/TFTP server
un dnsmasq-base-lua <none> <none> (no description available)

More From » networking

 Answers
2

I believe I know how to resolve this. dhcpcd has a --nohook flag that instructs it to leave certain parts of your configuration alone. From my dhcpcd(8) man page:


-C, --nohook script
Don't run this hook script. Matches full name, or prefixed with 2 numbers optionally ending with .sh.

So to stop dhcpcd from touching your DNS settings you would do:-
dhcpcd -C resolv.conf eth0

So I altered my /lib/systemd/system/dhcpcd.service, changing the line


ExecStart=/usr/sbin/dhcpcd

to


ExecStart=/usr/sbin/dhcpcd -C /etc/resolv.conf

Afterwards, the nameservers 8.8.8.8 and 8.8.4.4 in /etc/resolv.conf survive the reboot.


[#2598] Friday, July 30, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
suspengn

Total Points: 477
Total Questions: 104
Total Answers: 100

Location: Rwanda
Member since Thu, Feb 10, 2022
2 Years ago
suspengn questions
Thu, Jun 16, 22, 06:04, 2 Years ago
Wed, Oct 5, 22, 14:50, 2 Years ago
Tue, Mar 8, 22, 17:23, 2 Years ago
Thu, May 25, 23, 00:47, 1 Year ago
;