Re: When is resolv.conf written?



On Wed, 2008-11-12 at 08:25 -0500, Tom Horsley wrote:
> On a new ubuntu 8.10 virtual machine with network-manager
> 0.7~~svn20081018t105859-0ubuntu1 installed, I have added
> a /etc/NetworkManager/dispatcher.d/ script.
> 
> The purpose of this script is to edit the /etc/resolv.conf
> and add items to the search directive when an interface
> comes up. [I'd love to add the proper search directive to
> the DHCP server, but the dhcp protocol doesn't support
> search list info].

It should, that's what the 'domain_search' option is for. (RFC 3397,
option 119).

> The script is indeed invoked (I added commands to log args
> and environment to a file). It also successfully edits the
> /etc/resolv.conf file to produce exactly what I want.
> 
> Then, out of the blue, sometimes as much as two or three
> minutes later, the /etc/resolv.conf file gets written
> again and reverted to the original contents with no
> extra domains in the search directive. The dispatcher
> script is NOT invoked for this overwrite.

Good point, there should probably be a dispatcher event for
'ip-config-changed'.

> Is NetworkManager re-writing resolv.conf every time
> the lease is renewed or something? Can we get a dispatch
> event for that?

Yes, it will most likely do so; though recent SVN will only rewrite when
the IP configuration has actually changed.

If you didn't know, you can add your own custom searches to the
connection using the connection editor, look in the IP4 tab.  Thus, when
the connection is activated by NM, it'll write out your custom searches
to /etc/resolv.conf and you won't have to write scripts and whatever to
do this.  That should be a *lot* easier.  If that doesn't work, then
it's a bug we need to fix.

Dan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]