The NSLU2 firmware has a built in Wins server included as part of the Samba 2 module. This server function is disabled in the default firmware configuration but can easily be enabled using a simple diversion script. Copy the script rc.samba below to the
/unslung/ folder (recommend the folder
/share/hdd/conf/unslung/ for unslung firmware vers 3.x) then re-boot.
The script will:-
- Save a backup copy of the unchanged smb.conf file.
- Check the smb.conf file for existing Wins server and Wins client configurations.
- If no configurations exist then add the line
wins support = yes (see revision notes below)
The Wins routing table will be generated and stored in the file
Very Important Note...
The http://www.samba.org web site gives a warning not to configure the Wins server and the Wins client (via the Web Configuration pages) at the same time, it will lock up part of Samba with possible disastrous consequences.
Also note that there appears to be some annoying functionality built into the default Linksys firmware that appears to be designed to detect if the built in Wins server is active and if active to shut the server down (looks to be an attempt at a safe guard against configuring a server and client at the same time). The server will work fine after boot up of the NSLU2 but changing/adding shares, groups and users via the web pages etc and other configuration changes seems to invoke this function. In most cases this will cause little disruption to your LAN (Wins server support on a Lan is usually an optional component). Note that the server can be re-enabled just by re-booting the NSLU2.
# Diversion script: to modify the Samba smb.conf file
# Reason: to add or change Samba2 functionality
# Make sure we have a backup copy of /etc/samba/smb.conf
if [ ! -e /etc/samba/smb.conf.orig ]; then
cp -p /etc/samba/smb.conf /etc/samba/smb.conf.orig
# Script section to enable the Samba built in Wins Server
# Check smb.conf for existing 'wins server' (remote Wins server)
# and 'wins support' (internal Samba Wins server) Configurations.
# If none present then insert line into [global] section
# to enable the built in Wins Server.
if ( !(grep "wins s" /etc/samba/smb.conf -q) ) then
sed -i -e 's/\[global\]$/\[global\]\nwins support \= yes\ndomain master \= yes/' /etc/samba/smb.conf
# End of Wins Server script section
# Include other script sections below here
# EOF - include this line
RobHam - April 2005
The script above has been changed to also add the line
domain master = yes to the smb.conf file. Without this line the Wins server will function correctly but in LMB mode. In this mode, every 15 minutes the server will try and search out the networks DMB (domain master browser) and if none is found (it will only find one if a user has an NT server on there network configured as DMB) it will place an error report in the file
/var/log/samba/log.nmbd which causes the file to grow to a very large size. Including the above line in the script will turn the NSLU2 into the networks DMB hence no errors are logged for this problem.
Users who do have an NT server configured as DMB need to delete
\ndomain master \= yes from the script section.
RobHam - July 2005