Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Apr 2001 22:06:45 -0500
From:      Glenn Johnson <glennpj@charter.net>
To:        Leonard Zettel <zettel@acm.org>
Cc:        "freebsd-questions@FreeBSD.ORG" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: resolv.conf overwrite
Message-ID:  <20010411220645.A3031@gforce.johnson.home>
In-Reply-To: <3AD51271.25615AEB@acm.org>; from zettel@acm.org on Wed, Apr 11, 2001 at 10:26:57PM -0400
References:  <3AD51271.25615AEB@acm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Apr 11, 2001 at 10:26:57PM -0400, Leonard Zettel wrote:

> Following The Complete FreeBSD p 480 I created the following
> /etc/resolv.conf
> 
> # Changed by Len Zettel 4/11/01
> #----------removed-------------
> # search
> # nameserver 192.168.0.185
> # ------------------------------
> # ---------Added---------------
> domain Oz.
> nameserver 204.254.120.6   # Bignet primary nameserver
> nameserver 204.254.120.7   # Bignet secondart nameserver
> #------------------------------------------------------
> 
> I was then happy as a clam at high tide at being able to ping domain
> names on the net. :-) This looked like PROGRESS! (One step at a time
> division).
>
> Then I rebooted :-(
> 
> /etc/resolv.conf now contained
> 
> search
> nameserver 192.168.0.185
> 
> Tentative conclusion: something in the boot sequence is fooling with
> (probably creating) /etc/resolv.conf
>
> So, what do I change to stop this?  Or should I not be trying to stop
> it?  And doing something else entirely?  And where can I read about
> THAT?

The DHCP server that is providing your IP address is doing that.  To
override that behavior you need to do the following while logged in as
root:

[1] Create a file called "/etc/dhclient-enter-hooks".  For the case you
    describe the contents of this file should be:

#!/bin/sh
new_domain_name="Oz"
new_domain_name_servers="204.254.120.6 204.254.120.7"

[2] Make the "/etc/dhclient-enter-hooks" files executable by executing
    the command:
	
	chmod +x /etc/dhclient-enter-hooks

[3] Restart dhclient.  I am not sure what the cleanest way to do this
    is but stopping the daemon and restarting it should work.  First you
    need to find the process ID and the command to restart it.  Run the
    command
	
	ps ax | grep dhclient

The output should look something like:

 3800  ??  Is     0:00.00 dhclient de0

The first field is the process ID and the last two fields are what you
need to restart the dhclient process, the very last field being the
network interface.  So the following command would work except you would
substitute with the appropriate process ID and substitute de0 with
whatever the appropriate interface is:

	kill 3800 && dhclient de0

Now if you look at /etc/resolv.conf it should be correct.

-- 
Glenn Johnson
glennpj@charter.net

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010411220645.A3031>