Samba as a WINS server in a Windows Peer Network
I’ve spent the last couple of days trying to get a Debian Etch machine running Samba as a fileserver for our local Windows peer network. (Maybe some day I’ll get around to building a domain controller, but it’s not really necessary at the moment.) We’ve needed a simple way to share files, store backups, and run shared version-control repositories for some time now. I am pleased to report that all the information out there, along with some help from O’Reilly’s Linux Cookbook, made this pretty simple.
I’m not going to reiterate all the steps for setting up Samba. Instead, I just wanted to give a tip to anyone who might be looking to set up their own fileserver in a Windows peer network: use Samba as a WINS server if you don’t already have one! This is recommended by the Samba people (see this page) and has made peer-to-peer network access in Windows a lot smoother for me.
WINS is the Windows Internet Name Service, a protocol for resolving NetBIOS names in Windows networks. (These are names you can type into Windows Explorer like “\\my-server”.) Without a WINS server, your Windows clients are going to be broadcasting packets all over the place every time they need to see another computer — for example, if you’re browsing “My Network Places” or workgroup computers. At least in our home network, this results in extremely slow access to machines in the same LAN and really buggy connectivity: sometimes I lose a connection in the middle of transferring a file, or after refreshing my view of a network share, without any explanation.
Configuring Samba to act as a WINS server is really easy. Just add the following parameters to your smb.conf file:
os level = 99 wins support = yes name resolve order = wins lmhosts hosts bcast domain master = yes preferred master = yes
The exact meaning of these settings is described pretty well on the Gentoo wiki.
You’ll also want to assign your fileserver a static IP address in your local network. In Debian, you set this in /etc/network/interfaces, but this varies by GNU/Linux distribution.
Once you add the above configuration parameters and restart Samba, you need to configure all your Windows clients to use the Samba server as a WINS server. This is the one part of the process for which there was not a wealth of documentation out there at the tip of a Google search, so hopefully this will help someone out. On each Windows machine:
- Open the Properties dialog for the network interface you use to connect to the LAN. In XP, you can do this by hovering over the “Connect To…” option on the Start menu, right-clicking your interface, and clicking “Properties.”
- Select “Internet Protocol (TCP/IP)” from the list of protocols used on that interface and click “Properties.”
- Click “Advanced.”
- In the resulting “Advanced TCP/IP settings” dialog, select the WINS tab and click “Add…” Enter the IP address of your fileserver. You can probably leave the other settings at their defaults. Click OK on each of the configuration dialogs you have opened.
- Open a DOS command window (Start -> Accessories -> Command Prompt) and enter the following three commands:
ipconfig /release ipconfig /renew ipconfig /all
The output from the last command should show that your Primary WINS Server has the IP address you entered above. If not, you did something wrong!
If all went well, you should now have a Samba WINS server set up in your Windows peer network. So far, I’ve noticed a fairly dramatic improvement, though I’ll post edits here if I find that any settings need additional tweaking.