resolv.conf rewritten on every boot -- Help!

3p6hsmg

Member
Dec 1, 2011
6
0
51
cPanel Access Level
Website Owner
This is a very annoying issue. Everytime the server boots the resolv.conf file is rewritten. This might not seem like a problem, but whatever is writing it does not include the "search [hostname]" line in the resolv file so any non-resolvable domains get resolved to my local IP address! (who thought up that piece of genius I wonder?)

Is there a way to either make cpanel not rewrite this file or at the very least to write the thing correctly so every non-existant domain in the world does not point back to my local server?
 

quietFinn

Well-Known Member
Feb 4, 2006
1,390
177
193
Finland
cPanel Access Level
Root Administrator
It's not cPanel doing that, it's your operating system.
 

quietFinn

Well-Known Member
Feb 4, 2006
1,390
177
193
Finland
cPanel Access Level
Root Administrator
Do you know where I can look to resolve this? Or what part of the OS is rewriting this? I literally just have CentOS with cpanel installed on it without customization. It is a Xen VPS.
Maybe in
/etc/sysconfig/network-scripts/network-functions
 

optize

Well-Known Member
Apr 27, 2005
146
0
166
Sounds like you're using DHCP instead of static IP addresses. DHCP will send DNS servers (usually) when you request an IP address/reboot.
 

JaredR.

Well-Known Member
Feb 25, 2010
1,834
24
143
Houston, TX
cPanel Access Level
Root Administrator
This does sound like behavior caused by DHCP, but not necessarily. My suggestion would be to work with your data center to find the cause of this, since it is something in the operating system, or in the virtualization software (Xen), not cPanel, doing it.

The last thing I would do is apply the immutable attribute (chattr +i) to any file, because you can expect to forget about it and for it to cause problems later on after it has been forgotten, and troubleshooting can be very difficult when one does not remember to look for altered file attributes. There is usually a better way to handle a problem than changing a file's attributes.