[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dhcp-client
Subject:    Re: Where is new_domain_name_servers Set?
From:       Ted Lemon <Ted_Lemon () iengines ! com>
Date:       1999-11-17 16:20:08
[Download RAW message or body]

   *** From dhcp-client -- To unsubscribe, see the end of this message. ***


Hm, I will grant you the information doesn't leap out of the man page
and grab you by the throat.   It's under the OPERATION section, and
it's not detailed.   In fact, I'm surprised - I thought I'd documented
it in more detail than that.   Sorry!

Basically, whenever the client wants to invoke /etc/dhclient-script,
which it does for a variety of reasons documented in the manual page,
it writes a temporary file into /tmp, and writes a bunch of shell
variable assignments into that file.   The file doesn't stick around -
it's deleted as soon as dhclient-script is done executing.   If you
want to use the values set in that script, you should write your own
/etc/dhclient-enter-hooks script to do so.   I normally wrap code like
this in:

if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
   [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
    ...
fi

...when installing a new value, and in:

if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then
    ...
fi

...for when the client is unable to retain its lease, and something
needs to be deleted from somewhere.   In your case, I would do
something like this:

#!/etc/dhclient-enter-hooks
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
   [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
	if [ x$old_netbios_name_server != x$new_netbios_name_server ]; then
# The two characters in between the brackets below are a space and a tab.
		sed -e '/^[ 	]*wins server =/d' \
				</etc/smb.conf >/etc/smb.conf.$$
		if [ x$new_netbios_name_servers = x ]; then
			mv /etc/smb.conf.$$ /etc/smb.conf
		else
			nslist=`echo $new_netbios_name_servers | \
				sed -e 's/ /, /g'`
			sed -e "/^\\[global\\]/a\\
			wins server = $nslist 
'				</etc/smb.conf.$$ >/etc/smb.conf
fi

if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then
# The two characters in between the brackets below are a space and a tab.
		sed -e '/^[ 	]*wins server =/d' \
				</etc/smb.conf >/etc/smb.conf.$$
fi

You also need to request the netbios-name-servers parameter in your
/etc/dhclient.conf:

request subnet-mask, broadcast-address, time-offset, routers,
	domain-name, domain-name-servers, host-name, netbios-name-servers;

(You have to request all the other information you want, too... :')

			       _MelloN_
-----------------------------------------------------------------------
To unsubscribe from this list, visit http://www.isc.org/dhcp-lists.html
or send mail to dhcp-client-request@isc.org with the subject line of
'unsubscribe'.
-----------------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic