[CentOS] resolv.conf rewritten every reboot. How to figure out who and why?

Thu Oct 8 21:54:36 UTC 2009
Florin Andrei <florin at andrei.myip.org>

Dave wrote:
> 
> [root at lee1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
> # Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express
> DEVICE=eth0
> BOOTPROTO=none
> HWADDR=00:18:8b:0f:ad:c2
> IPADDR=1[snip]0
> ONBOOT=yes
> DHCP_HOSTNAME=[snip]
> DNS1=1[snip]0
> DNS2=1[snip].2
> NM_CONTROLLED=no
> SEARCH=[snip]
> NETMASK=255.255.255.0
> DNS3=1[snip]0
> GATEWAY=1[snip]0.1
> TYPE=Ethernet
> USERCTL=no
> PEERDNS=yes
> IPV6INIT=no

Holy cow, something put every single option in that file.
For static address, the minimum you need is this:

DEVICE=eth0
BOOTPROTO=none
HWADDR=00:18:8b:0f:ad:c2
IPADDR=1[snip]0
ONBOOT=yes
NETMASK=255.255.255.0
TYPE=Ethernet

And you can either leave GATEWAY there or put it in /etc/sysconfig/network

I assume it's because of PEERDNS=yes, and you'll have to try to be sure, 
but anyway all that junk serves no purpose there (well, arguably you 
could put back USERCTL and stuff like that, if you really need it).

-- 
Florin Andrei

http://florin.myip.org/