You can set up Samba as a WINS server by setting two global options in the configuration file, as shown below:
[global]
wins support = yes
name resolve order = wins lmhosts hosts bcast
The
wins
support
option turns Samba into a WINS server. Believe it or not, that's all you need to do! Samba handles the rest of the details behind the scenes, leaving you a relaxed administrator. The
wins
support=yes
and the
wins
server
option are mutually exclusive; you cannot simultaneously offer Samba as the WINS server and point to another system as the server.
If Samba is acting as a WINS server, you should probably get familiar with the
name
resolve
order
option mentioned earlier. This option tells Samba the order of methods in which it tries to resolve a NetBIOS name. It can take up to four values:
-
lmhosts
-
Uses a LAN Manager
LMHOSTS file
-
hosts
-
Uses the standard name resolution methods of the Unix system,
/etc/hosts, DNS, NIS, or a combination (as configured for the system)
-
wins
-
Uses the WINS server
-
bcast
-
Uses a broadcast method
The order in which you specify them in the value is the order in which Samba will attempt name resolution when acting as a WINS server. For example, let's look at the value specified previously:
name resolve order = wins lmhosts hosts bcast
This means that Samba will attempt to use its WINS entries first for name resolution, followed by the LAN Manager
LMHOSTS file on its system. Next, the hosts value causes it to use Unix name resolution methods. The word
hosts
may be misleading; it covers not only the
/etc/hosts file, but also the use of DNS or NIS (as configured on the Unix host). Finally, if those three do not work, it will use a broadcast to try to locate the correct machine.
Finally, you can instruct a Samba server that is acting as a WINS server to check with the system's DNS server if a requested host cannot be found in its WINS database. With a typical Linux system, for example, you can find the IP address of the DNS server by searching the
/etc/resolv.conf file. In it, you might see an entry such as the following:
nameserver 127.0.0.1
nameserver 192.168.200.192
This tells us that a DNS server is located at 192.168.220.192. (The 127.0.0.1 is the localhost address and is never a valid DNS server address.)
Use the global
dns
proxy
option to alert Samba to use the configured DNS server:
[global]
wins support = yes
name resolve order = wins lmhosts hosts bcast
dns proxy = yes