/etc/resolv.conf being rewritten
Posted: 2019/02/01 17:29:18
Machine has 2 NICs, eno1 and eno2.
My problem: /etc/resolv.conf keeps being rewritten. I wanted to
set this up statically. But it was being re-written after each reboot.
The OS is Centos 7
I wondered whether the problem was related to resolvconf, but no.
I disabled (and stopped, and masked) as follows:
I've checked my named.conf (in frustration) and it has no references to the
wrong answer (10.2.1.2) or the right answer (10.1.1.2) so that's not it.
I've checked the dns files (forward, reverse) and they're correct.
My dhcpd.conf file is correct (though it should be moot, given the ifcfg-eno* files
to follow).
ifcfg-eno1
ifcfg-eno2
I've disconnected eno2 as well. Notice the "no carrier"
Yeah, this was a desperation move.
Okay, so I've "fixed" my problem, by changing DNS1 in the eno2 file.
What I hoped for was this:
eno1 is the "primary" NIC.
I wanted to write the /etc/resolv.conf file for myself.
At worst, I wanted the /etc/resolv.conf file to depend on the eno1 file.
But I didn't want any networking file to be re-written behind my back.
What I got was this:
The DNS1 entry in the eno2 file was re-setting the /etc/resolv.conf file.
What's doing that? why can't I stop that?
Thanks.
j.
My problem: /etc/resolv.conf keeps being rewritten. I wanted to
set this up statically. But it was being re-written after each reboot.
The OS is Centos 7
Code: Select all
# uname -a
Linux fs.jgscrater.com 3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 29 14:49:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Code: Select all
# updatedb
# locate resolvconf
#
Code: Select all
# systemctl -q -a | grep NetworkManager
* NetworkManager-wait-online.service masked inactive dead NetworkManager-wait-online.service
* NetworkManager.service masked inactive dead NetworkManager.service
wrong answer (10.2.1.2) or the right answer (10.1.1.2) so that's not it.
I've checked the dns files (forward, reverse) and they're correct.
My dhcpd.conf file is correct (though it should be moot, given the ifcfg-eno* files
to follow).
ifcfg-eno1
Code: Select all
[root@fs network-scripts]# more eno1
# DEVICE
UUID=b046149c-f74c-4d0f-a6ed-5652f758ca6e
HWADDR="0C:C4:7A:B2:7B:74"
ONBOOT="yes"
# NETBOOT
IPV6INIT="no"
BOOTPROTO=none
TYPE="Ethernet"
NAME="eno1"
#
DNS1=10.1.1.2
DNS2=8.8.4.4
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
#
# fs
IPADDR0=10.1.1.2
PREFIX0=16
GATEWAY0=10.1.1.2
ifcfg-eno2
Code: Select all
ONBOOT="yes"
# NETBOOT
# this uuid is the one from installation.
UUID=7266e473-4b66-4aa4-b4de-667ae090d32b
IPV6INIT="no"
BOOTPROTO=none
TYPE="Ethernet"
NAME="eno2"
#
# ????!!!! Here is the "fix"
DNS1=10.1.1.2
DNS2=8.8.4.4
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
HWADDR="0C:C4:7A:B2:7B:75"
#
# dns
IPADDR0=10.2.1.2
PREFIX0=16
GATEWAY0=10.2.1.2
Code: Select all
# ip addr
-- snip --
2: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
-- snip --
Okay, so I've "fixed" my problem, by changing DNS1 in the eno2 file.
What I hoped for was this:
eno1 is the "primary" NIC.
I wanted to write the /etc/resolv.conf file for myself.
At worst, I wanted the /etc/resolv.conf file to depend on the eno1 file.
But I didn't want any networking file to be re-written behind my back.
What I got was this:
The DNS1 entry in the eno2 file was re-setting the /etc/resolv.conf file.
What's doing that? why can't I stop that?
Thanks.
j.