Click to See Complete Forum and Search --> : dhclient script to set netbios-nameserver/WINS


miker
07-09-2001, 09:13 AM
anyone got this working? can you offer up your example dhclient script?

basically I travel between networks which use WINS, and automatically configuring smb.conf with the WINS server would be handy - the dhclient script could do this, but the default script with all it's mad variables and me being a linuxnewbie = not a clue!

I guess I'm looking at using grep/sed to alter smb.conf, but I still haven't got my head round bash scripting yet

any help good help...

miker
07-09-2001, 09:27 AM
you seen this example:

#!/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_
-----------------------------------------------------------------------

well that doesn't look to readable, here is the url:
http://www.isc.org/ml-archives/dhcp-client/1999/11/msg00040.html