[SOLVED] How to retain permanent manual DNS entries

General support questions
fla_panther
Posts: 42
Joined: 2015/08/27 21:15:03

[SOLVED] How to retain permanent manual DNS entries

Post by fla_panther » 2016/10/22 22:58:30

I prefer to have static addressing on my LAN. I know that /etc/resolv.conf can be overwritten and the better option is to edit /etc/sysconfig/network-scripts/ifcfg-em1. What I have there is this:

Code: Select all

DEVICE=em1
HWADDR=XX:XX:XX:XX:XX:XX
TYPE=Ethernet
UUID=blahblahblahblah
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=x.x.x.x
NETMASK=255.255.255.0
GATEWAY=x.x.x.x
PEERDNS=no
DNS1=8.8.8.8
DNS2=8.8.4.4
When I reboot my server /etc/sysconfig/network-scripts/ifcfg-em1 is obviously being read because the network, mask, and gateway are all being learned as they should. But the DNS entries are ignored. I can't get online until I edit /etc/resolv.conf and put nameservers in there. Can someone explain to me why this is happening, and what i need to do to stop it from happening?
Last edited by fla_panther on 2016/10/30 21:11:17, edited 1 time in total.

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to retain permanent manual DNS entries

Post by TrevorH » 2016/10/22 23:05:30

With PEERDNS=no the only person that should change /etc/resolv.conf is you. Is this your only interface?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

fla_panther
Posts: 42
Joined: 2015/08/27 21:15:03

Re: How to retain permanent manual DNS entries

Post by fla_panther » 2016/10/22 23:16:59

The server has 4 ports but I'll be the only person working on the box. It seems /etc/resolv.conf is being overwritten even with PEERDNS=no.

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to retain permanent manual DNS entries

Post by TrevorH » 2016/10/22 23:27:14

Are you sure that one of the other interfaces isn't also up and using DHCP? PEERDNS in an ifcfg file is particular to that interface.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

fla_panther
Posts: 42
Joined: 2015/08/27 21:15:03

Re: How to retain permanent manual DNS entries

Post by fla_panther » 2016/10/22 23:45:13

Strangely, all 4 ports were up despite the others being set to ONBOOT=no. I saw NM_CONTROLLED=yes on them though so I turned that off and rebooted. The other ports stayed down this time but I'm still seeing the same behaviour.

I don't know if it's worth noting here but when I first boot up if I'm quick I can load a webpage. If I wait a moment or two longer I cannot, and if I try to refresh the page I had brought up it times out. Also, I have installed squid, though it's not set up to do what I want with it yet, it's just acting as a passthough. You don't happen to know of any behaviour of squid that would wipe the /etc/resolv.conf file, do you?

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to retain permanent manual DNS entries

Post by TrevorH » 2016/10/23 00:44:25

Squid sounds unlikely.

What's the output from chkconfig --list | grep -i netw ?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

fla_panther
Posts: 42
Joined: 2015/08/27 21:15:03

Re: How to retain permanent manual DNS entries

Post by fla_panther » 2016/10/23 02:14:25

Code: Select all

# chkconfig --list | grep -i netw
NetworkManager 	0:off	1:off	2:on	3:on	4:on	5:on	6:off
network        	0:off	1:off	2:on	3:on	4:on	5:on	6:off

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to retain permanent manual DNS entries

Post by TrevorH » 2016/10/23 12:42:22

Try chkconfig NetworkManager off then reboot
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

fla_panther
Posts: 42
Joined: 2015/08/27 21:15:03

Re: How to retain permanent manual DNS entries

Post by fla_panther » 2016/10/24 11:33:00

Yeah, that did it. Strange though, I would think that wouldn't be needed. What if I only wanted to manually manage the one port and have Network Manager do the others? I guess the stance is all one way or all the other. I could've disabled Network Manager myself but posted here because I assumed that wasn't the necessary step, that I had skipped over something in between.

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to retain permanent manual DNS entries

Post by TrevorH » 2016/10/24 11:52:02

NetworkManager and network are alternatives to each other and having both enabled leads to problems like this.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply