[CentOS] Disappearing Network Manager config scripts

Mon May 5 08:55:35 UTC 2014
Tony Molloy <tony.molloy at ul.ie>

On Monday 05 May 2014 00:22:52 Evan Rowley wrote:
> When I started this thread a week ago, I certainly did not expect
>  this many replies. Without a doubt it seems Network Manager is a
>  controversial topic. I still haven't worked out my Network Manager
>  woes and just lost an hour troubleshooting a Golang webserver
>  which wouldn't start.
> 
> Apparently in Golang's net package, there is a DNS resolver
>  function that's called whenever a server is started. That function
>  depends on a working /etc/resolv.conf - As per usual, the
>  /etc/resolv.conf file turned out to be the blank template
>  NetworkManager always creates. The webserver starts now, but this
>  /etc/resolv.conf will certainly be blown away by NetworkManager
>  the next time the network service restarts.
> 
> I have one idea as to why this problem persists. This file:
> 
> ll /etc/sysconfig/network-scripts/ifcfg-eth0
> ...
> 
> -rw-r--r--. 1 root root    44 Apr 26 22:21 ifcfg-eth0
> 
> 
> Is it meant to be executable? Being a configuration file, I'm
>  assuming it doesn't need to be. Am I wrong?
> 

A hack. Set up your resolv.conf as you need it.

Then as root chattr +i  /etc/resolv.conf

Now NM can configure the interfaces but can't change /etc/resolv.conf



Linux nogs.tonyshome.ie 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 
19:59:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux