Using wins hook

by Rod Smith, rodsmith@rodsbooks.com

Support Scripts

Samba's wins hook parameter accepts the name of a script or program that passes information on modifications to a Samba NBNS server's configuration to other programs. This script can be used to replicate NBNS configuration files across servers, to dynamically add NetBIOS names to a DNS server, and so on. Many of the Samba 2.0.x versions shipped with a sample script called dns_update to update a DNS server's entries with NetBIOS names registered by Samba clients. This script was removed from Samba 2.2 (but it still works) and was added back with Samba 3.0. You can try it yourself, but it requires special configuration. First, the script:

Note: These scripts are distributed under the terms of the GNU General Public License.

To use either script, download it and modify smb.conf to include the following line in the [global] section, making any necessary change to the path and filename for the update script:

wins hook = /usr/local/bin/dns_update

You must also modify the script. Change the DOMAIN variable from wins.example.com to whatever domain you use. If you download the modified version of the script, you must also set the DNS_SERVER variable to the IP address of the DNS server system you want to update. The default value (127.0.0.1) should work if the Samba server and DNS server are one and the same.

After modifying the script, you must also modify your DNS server's configuration to accept updates. The simplest way to do this is to modify the zone definition in /var/named.conf so that it resembles the following:

zone "example.com" {
	type master;
	file "example.zone";
	allow-update { 127.0.0.1; };
};

The critical point in this example is the allow-update line. This particular example allows the server to accept updates from itself (127.0.0.1). If your DNS and Samba servers are not the same, use the IP address of the Samba NBNS server instead.

For more information on Samba name resolution, see my book, The Definitive Guide to Samba 3.0.


Copyright © 2004 by Rod Smith, rodsmith@rodsbooks.com

Return to my main web page.