Another edit.
[Samba/gebeck_regimport.git] / docs / Samba3-HOWTO / TOSHARG-NetworkBrowsing.xml
blobe4ef237035d0eab0767d8513dd1f479172dce365
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <chapter id="NetworkBrowsing">
4 <chapterinfo>
5         &author.jht;
6         &author.jelmer;
7         <pubdate>July 5, 1998</pubdate>
8         <pubdate>Updated: April 21, 2003</pubdate>
9 </chapterinfo>
11 <title>Network Browsing</title>
13 <para>
14 This document contains detailed information as well as a fast-track guide to
15 implementing browsing across subnets and/or across workgroups (or domains).
16 WINS is the best tool for resolution of NetBIOS names to IP addresses. WINS is
17 not involved in browse list handling except by way of name-to-address resolution.
18 </para>
20 <note><para>
21 MS Windows 2000 and later versions can be configured to operate with no NetBIOS 
22 over TCP/IP. Samba-3 and later versions also support this mode of operation.
23 When the use of NetBIOS over TCP/IP has been disabled, the primary
24 means for resolution of MS Windows machine names is via DNS and Active Directory.
25 The following information assumes that your site is running NetBIOS over TCP/IP.
26 </para></note>
28 <sect1>
29 <title>Features and Benefits</title>
31 <para>
32 Charles Dickens once referred to the past in these words: <quote><emphasis>It was the best of times,
33 it was the worst of times.</emphasis></quote> The more we look back, the more we long for what was and
34 hope it never returns.
35 </para>
38 <para>
39 <indexterm><primary>NetBIOS</primary></indexterm>
40 For many MS Windows network administrators, that statement sums up their feelings about
41 NetBIOS networking precisely. For those who mastered NetBIOS networking, its fickle
42 nature was just par for the course. For those who never quite managed to tame its
43 lusty features, NetBIOS is like Paterson's Curse.
44 </para>
46 <para>
47 For those not familiar with botanical problems in Australia, Paterson's Curse,
48 <emphasis>Echium plantagineum</emphasis>, was introduced to Australia from Europe during the mid-19th
49 century. Since then it has spread rapidly. The high seed production, with densities of
50 thousands of seeds per square meter, a seed longevity of more than 7 years, and an
51 ability to germinate at any time of year, given the right conditions, are some of the
52 features that make it such a persistent weed.
53 </para>
55 <para>
56 In this chapter we explore vital aspects of Server Message Block (SMB) networking with
57 a particular focus on SMB as implemented through running NetBIOS (Network Basic
58 Input/Output System) over TCP/IP. Since Samba does not implement SMB or NetBIOS over
59 any other protocols, we need to know how to configure our network environment and simply
60 remember to use nothing but TCP/IP on all our MS Windows network clients.
61 </para>
63 <para>
64 Samba provides the ability to implement a WINS (Windows Internetworking Name Server)
65 and implements extensions to Microsoft's implementation of WINS. These extensions
66 help Samba to effect stable WINS operations beyond the normal scope of MS WINS.
67 </para>
69 <para>
70 WINS is exclusively a service that applies only to those systems
71 that run NetBIOS over TCP/IP. MS Windows 200x/XP have the capacity to operate with
72 support for NetBIOS disabled, in which case WINS is of no relevance. Samba supports this also.
73 </para>
75 <para>
76 For those networks on which NetBIOS has been disabled (i.e., WINS is not required),
77 the use of DNS is necessary for hostname resolution.
78 </para>
80 </sect1>
82 <sect1>
83 <title>What Is Browsing?</title>
85 <para>
86 To most people, browsing means they can see the MS Windows and Samba servers
87 in the Network Neighborhood, and when the computer icon for a particular server is
88 clicked, it opens up and shows the shares and printers available on the target server.
89 </para>
91 <para>
92 What seems so simple is in fact a complex interaction of different technologies.
93 The technologies (or methods) employed in making all of this work include:
94 </para>
96 <itemizedlist>
97         <listitem><para>MS Windows machines register their presence to the network.</para></listitem>
98         <listitem><para>Machines announce themselves to other machines on the network.</para></listitem>
99         <listitem><para>One or more machines on the network collate the local announcements.</para></listitem>
100         <listitem><para>The client machine finds the machine that has the collated list of machines.</para></listitem>
101         <listitem><para>The client machine is able to resolve the machine names to IP addresses.</para></listitem>
102         <listitem><para>The client machine is able to connect to a target machine.</para></listitem>
103 </itemizedlist>
105 <para>
106 The Samba application that controls browse list management and name resolution is
107 called <filename>nmbd</filename>. The configuration parameters involved in nmbd's operation are:
108 </para>
110 <para>Browsing options:
111         <smbconfoption name="os level"/>(*),
112         <smbconfoption name="lm announce"/>,
113         <smbconfoption name="lm interval"/>,
114         <smbconfoption name="preferred master"/>(*),
115         <smbconfoption name="local master"/>(*),
116         <smbconfoption name="domain master"/>(*),
117         <smbconfoption name="browse list"/>,
118         <smbconfoption name="enhanced browsing"/>.
119 </para>
121 <para>Name Resolution Method:
122         <smbconfoption name="name resolve order"/>(*).
123 </para>
125 <para>WINS options:
126         <smbconfoption name="dns proxy"/>,
127         <smbconfoption name="wins proxy"/>,
128         <smbconfoption name="wins server"/>(*),
129         <smbconfoption name="wins support"/>(*),
130         <smbconfoption name="wins hook"/>.
131 </para>
133 <para>
134 <indexterm><primary>WINS</primary></indexterm>
135 For Samba, the WINS Server and WINS Support are mutually exclusive options. Those marked with
136 an (*) are the only options that commonly may need to be modified. Even if none of these
137 parameters is set, <filename>nmbd</filename> will still do its job.
138 </para>
140 </sect1>
142 <sect1 id="netdiscuss">
143 <title>Discussion</title>
145 <para>
146 <indexterm><primary>SMB-based messaging</primary></indexterm>
147 <indexterm><primary>NetBIOS</primary></indexterm>
148 All MS Windows networking uses SMB-based messaging.  SMB messaging may be implemented with or without NetBIOS.
149 MS Windows 200x supports NetBIOS over TCP/IP for backwards compatibility. Microsoft appears intent on phasing
150 out NetBIOS support.
151 </para>
153 <sect2>
154 <title>NetBIOS over TCP/IP</title>
156 <para>
157 <indexterm><primary>encapsulating</primary></indexterm>
158 <indexterm><primary>broadcast</primary></indexterm>
159 <indexterm><primary>unicast</primary></indexterm>
160 <indexterm><primary>UDP</primary></indexterm>
161 Samba implements NetBIOS, as does MS Windows NT/200x/XP, by encapsulating it over TCP/IP.
162 MS Windows products can do likewise. NetBIOS-based networking uses broadcast messaging to
163 effect browse list management. When running NetBIOS over TCP/IP, this uses UDP-based messaging.
164 UDP messages can be broadcast or unicast.
165 </para>
167 <para>
168 <indexterm><primary>UDP</primary></indexterm>
169 Normally, only unicast UDP messaging can be forwarded by routers. The
170 <smbconfoption name="remote announce"/> parameter to smb.conf helps to project browse announcements
171 to remote network segments via unicast UDP. Similarly, the 
172 <smbconfoption name="remote browse sync"/> parameter of &smb.conf;
173 implements browse list collation using unicast UDP.
174 </para>
176 <para>
177 The methods used by MS Windows to perform name lookup requests (name resolution) is determined by a 
178 configuration parameter called the netbios node-type. There are four basic NetBIOS node types:
179 </para>
181 <indexterm><primary>b-node</primary></indexterm>
182 <indexterm><primary>p-node</primary></indexterm>
183 <indexterm><primary>m-node</primary></indexterm>
184 <indexterm><primary>h-node</primary></indexterm>
185 <indexterm><primary>node-type</primary></indexterm>
186 <indexterm><primary>WINS</primary></indexterm>
187 <indexterm><primary>broadcast</primary></indexterm>
188 <indexterm><primary>unicast</primary></indexterm>
189 <itemizedlist>
190         <listitem><para><emphasis>b-node (type 0x01):</emphasis> The Windows client will use only
191         NetBIOS broadcast requests using UDP broadcast.</para></listitem>
192         <listitem><para><emphasis>p-node (type 0x02):</emphasis> The Windows client will use point-to-point
193         (NetBIOS unicast) requests using UDP unicast directed to a WINS server.</para></listitem>
194         <listitem><para><emphasis>m-node (type 0x04):</emphasis> The Windows client will first use
195         NetBIOS broadcast requests using UDP broadcast, then it will use (NetBIOS unicast) 
196         requests using UDP unicast directed to a WINS server.</para></listitem>
197         <listitem><para><emphasis>h-node (type 0x08):</emphasis> The Windows client will use 
198         (NetBIOS unicast) requests using UDP unicast directed to a WINS server, then it will use 
199         NetBIOS broadcast requests using UDP broadcast.</para></listitem>
200 </itemizedlist>
202 <para>
203 <indexterm><primary>Hybrid</primary></indexterm>
204 The default Windows network client (or server) network configuration enables NetBIOS over TCP/IP
205 and b-node configuration. The use of WINS makes most sense with h-node (hybrid mode) operation so that
206 in the event of a WINS breakdown or non-availability, the client can use broadcast-based name resolution.
207 </para>
209 <para>
210 <indexterm><primary>LMB</primary><see>Local Master Browser</see></indexterm>
211 <indexterm><primary>Local Master Browser</primary></indexterm>
212 In those networks where Samba is the only SMB server technology, wherever possible 
213 <filename>nmbd</filename> should be configured on one machine as the WINS
214 server. This makes it easy to manage the browsing environment. If each network
215 segment is configured with its own Samba WINS server, then the only way to
216 get cross-segment browsing to work is by using the 
217 <smbconfoption name="remote announce"/> and the 
218 <smbconfoption name="remote browse sync"/>
219 parameters to your &smb.conf; file.
220 </para>
222 <para>
223 <indexterm><primary>WINS</primary></indexterm>
224 If only one WINS server is used for an entire multisegment network, then
225 the use of the <smbconfoption name="remote announce"/> and the 
226 <smbconfoption name="remote browse sync"/> parameters should not be necessary.
227 </para>
229 <para>
230 <indexterm><primary>replication</primary><secondary>WINS</secondary></indexterm>
231 As of Samba-3 WINS replication is being worked on. The bulk of the code has
232 been committed, but it still needs maturation. This is not a supported feature
233 of the Samba-3.0.20 release. Hopefully, this will become a supported feature
234 of one of the Samba-3 release series.
235 </para>
237 <para>
238 Right now Samba WINS does not support MS-WINS replication. This means that
239 when setting up Samba as a WINS server, there must only be one <filename>nmbd</filename>
240 configured as a WINS server on the network. Some sites have used multiple Samba WINS
241 servers for redundancy (one server per subnet) and then used 
242 <smbconfoption name="remote browse sync"/> and <smbconfoption name="remote announce"/>
243 to effect browse list collation across all segments. Note that this means clients
244 will only resolve local names and must be configured to use DNS to resolve names
245 on other subnets in order to resolve the IP addresses of the servers they can see
246 on other subnets. This setup is not recommended but is mentioned as a practical
247 consideration (i.e., an <quote>if all else fails</quote> scenario).
248 </para>
250 <para>
251 Lastly, take note that browse lists are a collection of unreliable broadcast
252 messages that are repeated at intervals of not more than 15 minutes. This means
253 that it will take time to establish a browse list, and it can take up to 45
254 minutes to stabilize, particularly across network segments.
255 </para>
257 <para>
258 When an MS Windows 200x/XP system attempts to resolve a host name to an IP address,
259 it follows a defined path:
260 </para>
262 <orderedlist>
263         <listitem><para>
264         Checks the <filename>hosts</filename> file. It is located in
265         <filename>%SystemRoot%\System32\Drivers\etc</filename>.
266         </para></listitem>
268         <listitem><para>
269         Does a DNS lookup.
270         </para></listitem>
272         <listitem><para>
273         Checks the NetBIOS name cache.
274         </para></listitem>
276         <listitem><para>
277         Queries the WINS server.
278         </para></listitem>
280         <listitem><para>
281         Does a broadcast name lookup over UDP.
282         </para></listitem>
284         <listitem><para>
285         Looks up entries in LMHOSTS, located in
286         <filename>%SystemRoot%\System32\Drivers\etc</filename>.
287         </para></listitem>
288 </orderedlist>
290 </sect2>
292 <sect2>
293 <title>TCP/IP without NetBIOS</title>
295 <para>
296 <indexterm><primary>NetBIOS</primary></indexterm>
297 <indexterm><primary>NetBIOS-less</primary></indexterm>
298 <indexterm><primary>DNS</primary></indexterm>
299 All TCP/IP-enabled systems use various forms of hostname resolution. The primary
300 methods for TCP/IP hostname resolution involve either a static file (<filename>/etc/hosts</filename>)
301 or the Domain Name System (DNS). DNS is the technology that makes
302 the Internet usable. DNS-based hostname resolution is supported by nearly all
303 TCP/IP-enabled systems. Only a few embedded TCP/IP systems do not support DNS.
304 </para>
306 <para>
307 <indexterm><primary>DNS</primary></indexterm>
308 Windows 200x/XP can register its hostname with a dynamic DNS server. You can
309 force register with a dynamic DNS server in Windows 200x/XP using
310 <command>ipconfig /registerdns</command>.
311 </para>
313 <para>
314 With Active Directory, a correctly functioning DNS server is absolutely
315 essential. In the absence of a working DNS server that has been correctly configured,
316 MS Windows clients and servers will be unable to locate each other, so
317 network services consequently will be severely impaired.
318 </para>
320 <para>
321 The use of dynamic DNS is highly recommended with Active Directory, in which case
322 the use of BIND9 is preferred for its ability to adequately support the SRV (service)
323 records that are needed for Active Directory.
324 </para>
326 <para>
327 Use of raw SMB over TCP/IP (No NetBIOS layer) can be done only with Active
328 Directory domains. Samba is not an Active Directory domain controller: ergo,
329 it is not possible run Samba as a domain controller and at the same time <emphasis>not</emphasis> use
330 NetBIOS. Where Samba is used as an Active Directory domain member server (DMS)
331 it is possible to configure Samba to not use NetBIOS over TCP/IP. A Samba DMS
332 can integrate fully into an Active Directory domain.
333 </para>
335 </sect2>
337 <sect2 id="adsdnstech">
338 <title>DNS and Active Directory</title>
341 <para>
342 <indexterm><primary>DNS</primary><secondary>Active Directory</secondary></indexterm>
343 Occasionally we hear from UNIX network administrators who want to use a UNIX-based dynamic
344 DNS server in place of the Microsoft DNS server. While this might be desirable to some, the
345 MS Windows 200x DNS server is autoconfigured to work with Active Directory. It is possible
346 to use BIND version 8 or 9, but it will almost certainly be necessary to create service records
347 (SRV records) so MS Active Directory clients can resolve hostnames to locate essential network services.
348 The following are some of the default service records that Active Directory requires:
349 </para>
351 <variablelist>
352 <varlistentry>
353         <term>_ldap._tcp.pdc._msdcs.<emphasis>Domain</emphasis></term>
354         <listitem>
355         <para>
356         This provides the address of the Windows NT PDC for the domain.
357         </para>
358         </listitem>
359 </varlistentry>
360 <varlistentry>
361         <term>_ldap._tcp.pdc._msdcs.<emphasis>DomainTree</emphasis></term>
362         <listitem>
363         <para>
364         Resolves the addresses of global catalog servers in the domain.
365         </para>
366         </listitem>
367 </varlistentry>
368 <varlistentry>
369         <term>_ldap._tcp.<emphasis>site</emphasis>.sites.writable._msdcs.<emphasis>Domain</emphasis></term>
370         <listitem>
371         <para>
372         Provides list of domain controllers based on sites.
373         </para>
374         </listitem>
375 </varlistentry>
376 <varlistentry>
377         <term>_ldap._tcp.writable._msdcs.<emphasis>Domain</emphasis></term>
378         <listitem>
379         <para>
380         Enumerates list of domain controllers that have the writable copies of the Active Directory data store.
381         </para>
382         </listitem>
383 </varlistentry>
384 <varlistentry>
385         <term>_ldap._tcp.<emphasis>GUID</emphasis>.domains._msdcs.<emphasis>DomainTree</emphasis></term>
386         <listitem>
387         <para>
388         Entry used by MS Windows clients to locate machines using the global unique identifier.
389         </para>
390         </listitem>
391 </varlistentry>
392 <varlistentry>
393         <term>_ldap._tcp.<emphasis>Site</emphasis>.gc._msdcs.<emphasis>DomainTree</emphasis></term>
394         <listitem>
395         <para>
396         Used by MS Windows clients to locate site configuration-dependent global catalog server.
397         </para>
398         </listitem>
399 </varlistentry>
400 </variablelist>
402         <para>
403         Specific entries used by Microsoft clients to locate essential services for an example domain
404         called <constant>quenya.org</constant> include:
405         </para>
407         <itemizedlist>
408                 <listitem><para>
409                 _kerberos._udp.quenya.org &smbmdash; Used to contact the KDC server via UDP.
410                 This entry must list port 88 for each KDC.
411                 </para></listitem>
413                 <listitem><para>
414                 _kpasswd._udp.quenya.org &smbmdash; Used to locate the <constant>kpasswd</constant> server
415                 when a user password change must be processed. This record must list port 464 on the
416                 master KDC.
417                 </para></listitem>
419                 <listitem><para>
420                 _kerberos._tcp.quenya.org &smbmdash; Used to locate the KDC server via TCP.
421                 This entry must list port 88 for each KDC.
422                 </para></listitem>
424                 <listitem><para>
425                 _ldap._tcp.quenya.org &smbmdash; Used to locate the LDAP service on the PDC.
426                 This record must list port 389 for the PDC.
427                 </para></listitem>
429                 <listitem><para>
430                 _kpasswd._tcp.quenya.org &smbmdash; Used to locate the <constant>kpasswd</constant> server
431                 to permit user password changes to be processed. This must list port 464.
432                 </para></listitem>
434                 <listitem><para>
435                 _gc._tcp.quenya.org &smbmdash; Used to locate the global catalog server  for the
436                 top of the domain. This must list port 3268.
437                 </para></listitem>
438         </itemizedlist>
439         
440         <para>
441         The following records are also used by the Windows domain member client to locate vital
442         services on the Windows ADS domain controllers.
443         </para>
445         <itemizedlist>
446                 <listitem><para>
447                 _ldap._tcp.pdc._msdcs.quenya.org
448                 </para></listitem>
450                 <listitem><para>
451                 _ldap.gc._msdcs.quenya.org
452                 </para></listitem>
454                 <listitem><para>
455                 _ldap.default-first-site-name._sites.gc._msdcs.quenya.org
456                 </para></listitem>
458                 <listitem><para>
459                 _ldap.{SecID}.domains._msdcs.quenya.org
460                 </para></listitem>
462                 <listitem><para>
463                 _ldap._tcp.dc._msdcs.quenya.org
464                 </para></listitem>
466                 <listitem><para>
467                 _kerberos._tcp.dc._msdcs.quenya.org
468                 </para></listitem>
470                 <listitem><para>
471                 _ldap.default-first-site-name._sites.dc._msdcs.quenya.org
472                 </para></listitem>
474                 <listitem><para>
475                 _kerberos.default-first-site-name._sites.dc._msdcs.queyna.org
476                 </para></listitem>
478                 <listitem><para>
479                 SecID._msdcs.quenya.org
480                 </para></listitem>
481         </itemizedlist>
483         <para>
484         Presence of the correct DNS entries can be validated by executing:
485 <screen>
486 &rootprompt; dig @frodo -t any _ldap._tcp.dc._msdcs.quenya.org
488 ; &lt;lt;&gt;&gt; DiG 9.2.2 &lt;lt;&gt;&gt; @frodo -t any _ldap._tcp.dc._msdcs.quenya.org
489 ;; global options:  printcmd
490 ;; Got answer:
491 ;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 3072
492 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2
495 ;; QUESTION SECTION:
496 ;_ldap._tcp.dc._msdcs.quenya.org. IN        ANY
499 ;; ANSWER SECTION:
500 _ldap._tcp.dc._msdcs.quenya.org. 600 IN SRV 0 100 389 frodo.quenya.org.
501 _ldap._tcp.dc._msdcs.quenya.org. 600 IN SRV 0 100 389 noldor.quenya.org.
504 ;; ADDITIONAL SECTION:
505 frodo.quenya.org.  3600  IN      A       10.1.1.16
506 noldor.quenya.org. 1200  IN      A       10.1.1.17
509 ;; Query time: 0 msec
510 ;; SERVER: frodo#53(10.1.1.16)
511 ;; WHEN: Wed Oct  7 14:39:31 2004
512 ;; MSG SIZE  rcvd: 171
513 </screen>
514         </para>
516 </sect2>
518 </sect1>
520 <sect1>
521 <title>How Browsing Functions</title>
523 <para>
524 MS Windows machines register their NetBIOS names (i.e., the machine name for each service type in operation)
525 on startup.  The exact method by which this name registration takes place is determined by whether or not the
526 MS Windows client/server has been given a WINS server address, whether or not LMHOSTS lookup is enabled,
527 whether or not DNS for NetBIOS name resolution is enabled, and so on.
528 </para>
530 <para>
531 In the case where there is no WINS server, all name registrations as well as name lookups are done by UDP
532 broadcast. This isolates name resolution to the local subnet, unless LMHOSTS is used to list all names and IP
533 addresses. In such situations, Samba provides a means by which the Samba server name may be forcibly injected
534 into the browse list of a remote MS Windows network (using the <smbconfoption name="remote announce"/>
535 parameter).
536 </para>
538 <para>
539 Where a WINS server is used, the MS Windows client will use UDP unicast to register with the WINS server. Such
540 packets can be routed, and thus WINS allows name resolution to function across routed networks.
541 </para>
543 <para>
544 During the startup process, an election takes place to create a local master browser (LMB) if one does not
545 already exist. On each NetBIOS network one machine will be elected to function as the domain master browser
546 (DMB). This domain browsing has nothing to do with MS security Domain Control.  Instead, the DMB serves the
547 role of contacting each LMB (found by asking WINS or from LMHOSTS) and exchanging browse list contents. This
548 way every master browser will eventually obtain a complete list of all machines that are on the network. Every
549 11 to 15 minutes an election is held to determine which machine will be the master browser. By the nature of
550 the election criteria used, the machine with the highest uptime, or the most senior protocol version or other
551 criteria, will win the election as DMB.
552 </para>
554 <para>
555 Where a WINS server is used, the DMB registers its IP address with the WINS server using the name of the
556 domain and the NetBIOS name type #1B. e.g., DOMAIN&lt;1B&gt;. All LMBs register their IP address with the WINS
557 server, also with the name of the domain and the NetBIOS name type of #1D. The #1B name is unique to one
558 server within the domain security context, and only one #1D name is registered for each network segment.
559 Machines that have registered the #1D name will be authoritive browse list maintainers for the network segment
560 they are on. The DMB is responsible for synchronizing the browse lists it obtains from the LMBs.
561 </para>
563 <para>
564 Clients wishing to browse the network make use of this list but also depend on the availability of correct
565 name resolution to the respective IP address or addresses.
566 </para>
568 <para>
569 Any configuration that breaks name resolution and/or browsing intrinsics will annoy users because they will
570 have to put up with protracted inability to use the network services.
571 </para>
573 <para>
574 Samba supports a feature that allows forced synchronization of browse lists across routed networks using the
575 <smbconfoption name="remote browse sync"/> parameter in the &smb.conf; file. This causes Samba to contact the
576 LMB on a remote network and to request browse list synchronization. This effectively bridges two networks that
577 are separated by routers. The two remote networks may use either broadcast-based name resolution or WINS-based
578 name resolution, but it should be noted that the <smbconfoption name="remote browse sync"/> parameter provides
579 browse list synchronization &smbmdash; and that is distinct from name-to-address resolution. In other words,
580 for cross-subnet browsing to function correctly, it is essential that a name-to-address resolution mechanism
581 be provided. This mechanism could be via DNS, <filename>/etc/hosts</filename>, and so on.
582 </para>
584 <sect2 id="DMB">
585 <title>Configuring Workgroup Browsing</title>
587 <para>
588 To configure cross-subnet browsing on a network containing machines in a workgroup, not an NT domain, you need
589 to set up one Samba server to be the DMB (note that this is not the same as a Primary Domain Controller,
590 although in an NT domain the same machine plays both roles). The role of a DMB is to collate the browse lists
591 from LMB on all the subnets that have a machine participating in the workgroup. Without one machine configured
592 as a DMB, each subnet would be an isolated workgroup unable to see any machines on another subnet. It is the
593 presence of a DMB that makes cross-subnet browsing possible for a workgroup.
594 </para>
596 <para>
597 In a workgroup environment the DMB must be a Samba server, and there must only be one DMB per workgroup name.
598 To set up a Samba server as a DMB, set the following option in the <smbconfsection name="[global]"/> section
599 of the &smb.conf; file:
600 </para>
602 <para>
603 <smbconfblock>
604 <smbconfoption name="domain master">yes</smbconfoption>
605 </smbconfblock>
606 </para>
608 <para>
609 The DMB should preferably be the LMB for its own subnet. In order to achieve this, set the following options
610 in the <smbconfsection name="[global]"/> section of the &smb.conf; file as shown in <link
611 linkend="dmbexample">Domain Master Browser smb.conf</link>
612 </para>
614 <example id="dmbexample">
615 <title>Domain Master Browser smb.conf</title>
616 <smbconfblock>
617 <smbconfsection name="[global]"/>
618 <smbconfoption name="domain master">yes</smbconfoption>
619 <smbconfoption name="local master">yes</smbconfoption>
620 <smbconfoption name="preferred master">yes</smbconfoption>
621 <smbconfoption name="os level">65</smbconfoption>
622 </smbconfblock>
623 </example>
625 <para>
626 The DMB may be the same machine as the WINS server, if necessary.
627 </para>
629 <para>
630 Next, you should ensure that each of the subnets contains a machine that can act as an LMB for the workgroup.
631 Any MS Windows NT/200x/XP machine should be able to do this, as will Windows 9x/Me machines (although these
632 tend to get rebooted more often, so it is not such a good idea to use them). To make a Samba server an LMB,
633 set the following options in the <smbconfsection name="[global]"/> section of the &smb.conf; file as shown in
634 <link linkend="lmbexample">Local master browser smb.conf</link>
635 </para>
637 <example id="lmbexample">
638 <title>Local master browser smb.conf</title>
639 <smbconfblock>
640 <smbconfsection name="[global]"/>
641 <smbconfoption name="domain master">no</smbconfoption>
642 <smbconfoption name="local master">yes</smbconfoption>
643 <smbconfoption name="preferred master">yes</smbconfoption>
644 <smbconfoption name="os level">65</smbconfoption>
645 </smbconfblock>
646 </example>
648 <para>
649 Do not do this for more than one Samba server on each subnet, or they will war with
650 each other over which is to be the LMB.
651 </para>
653 <para>
654 The <smbconfoption name="local master"/> parameter allows Samba to act as a
655 LMB. The <smbconfoption name="preferred master"/> causes <command>nmbd</command>
656 to force a browser election on startup and the <smbconfoption name="os level"/>
657 parameter sets Samba high enough so it should win any browser elections.
658 </para>
660 <para>
661 If you have an NT machine on the subnet that you wish to be the LMB, you can disable Samba from
662 becoming an LMB by setting the following options in the <smbconfsection name="[global]"/> section of the 
663 &smb.conf; file as shown in <link linkend="nombexample">smb.conf for Not Being a Master Browser</link>.
664 </para>
666 <para>
667 <example id="nombexample">
668 <title>smb.conf for Not Being a Master Browser</title>
669 <smbconfblock>
670 <smbconfsection name="[global]"/>
671 <smbconfoption name="domain master">no</smbconfoption>
672 <smbconfoption name="local master">no</smbconfoption>
673 <smbconfoption name="preferred master">no</smbconfoption>
674 <smbconfoption name="os level">0</smbconfoption>
675 </smbconfblock>
676 </example>
677 </para>
679 </sect2>
681 <sect2>
682 <title>Domain Browsing Configuration</title>
684 <para>
685 If you are adding Samba servers to a Windows NT domain, then you must not set up a Samba server as a DMB.
686 By default, a Windows NT PDC for a domain is also the DMB for that domain. Network
687 browsing may break if a Samba server registers the DMB NetBIOS name (<replaceable>DOMAIN</replaceable>&lt;1B&gt;)
688 with WINS instead of the PDC.
689 </para>
691 <para>
692 For subnets other than the one containing the Windows NT PDC, you may set up Samba servers as LMBs as
693 described. To make a Samba server a Local Master Browser, set the following options in the <smbconfsection name="[global]"/> section 
694 of the &smb.conf; file as shown in <link linkend="remsmb">Local Master Browser smb.conf</link>
695 </para>
697 <example id="remsmb">
698 <title>Local Master Browser smb.conf</title>
699 <smbconfblock>
700 <smbconfsection name="[global]"/>
701 <smbconfoption name="domain master">no</smbconfoption>
702 <smbconfoption name="local master">yes</smbconfoption>
703 <smbconfoption name="preferred master">yes</smbconfoption>
704 <smbconfoption name="os level">65</smbconfoption>
705 </smbconfblock>
706 </example>
708 <para>
709 If you wish to have a Samba server fight the election with machines on the same subnet, you
710 may set the <smbconfoption name="os level"/> parameter to lower levels.
711 By doing this you can tune the order of machines that will become LMBs if
712 they are running. For more details on this, refer to Section 9.4.3, <link linkend="browse-force-master">Forcing Samba to Be the Master</link>.
713 </para>
715 <para>
716 If you have Windows NT machines that are members of the domain on all subnets and you are
717 sure they will always be running, you can disable Samba from taking part in browser elections
718 and ever becoming an LMB by setting the following options in the
719 <smbconfsection name="[global]"/> section of the &smb.conf; file as shown in <link linkend="xremmb">&smb.conf;
720 for Not Being a master browser</link>
721 </para>
723 <para>
724 <example id="xremmb">
725 <title>&smb.conf; for Not Being a master browser</title>
726 <smbconfsection name="[global]"/>
727 <smbconfoption name="domain master">no</smbconfoption>
728 <smbconfoption name="local master">no</smbconfoption>
729 <smbconfoption name="preferred master">no</smbconfoption>
730 <smbconfoption name="os level">0</smbconfoption>
731 </example>
732 </para>
734 </sect2>
736 <sect2 id="browse-force-master">
737 <title>Forcing Samba to Be the Master</title>
739 <para>
740 Who becomes the master browser is determined by an election process using broadcasts. Each election packet contains a number of parameters
741 that determine what precedence (bias) a host should have in the election. By default Samba uses a low precedence and thus loses
742 elections to just about every Windows network server or client.
743 </para>
745 <para>
746 If you want Samba to win elections, set the <smbconfoption name="os level"/>
747 global option in &smb.conf; to a higher number. It defaults to 20. Using 34 would make it win
748 all elections over every other system (except other Samba systems).
749 </para>
751 <para>
752 An <smbconfoption name="os level"/> of two would make it beat Windows for Workgroups and Windows 9x/Me, but not MS Windows
753 NT/200x Server. An MS Windows NT/200x Server domain controller uses level 32. The maximum os level is 255.
754 </para>
756 <para>
757 If you want Samba to force an election on startup, set the
758 <smbconfoption name="preferred master"/> global option in &smb.conf; to <constant>yes</constant>.
759 Samba will then have a slight advantage over other potential master browsers that are not preferred master browsers.
760 Use this parameter with care, because if you have two hosts (whether they are Windows 9x/Me or
761 NT/200x/XP or Samba) on the same local subnet both set with <smbconfoption name="preferred master"/>
762 to <constant>yes</constant>, then periodically and continually they will force an election in order
763 to become the LMB.
764 </para>
766 <para>
767 If you want Samba to be a <emphasis>DMB</emphasis>, then it is recommended that
768 you also set <smbconfoption name="preferred master"/> to <constant>yes</constant>, because
769 Samba will not become a DMB for the whole of your LAN or WAN if it is not also a
770 LMB on its own broadcast isolated subnet.
771 </para>
773 <para>
774 It is possible to configure two Samba servers to attempt to become the DMB for a domain. The first server that comes
775 up will be the DMB. All other Samba servers will attempt to become the DMB every 5 minutes. They
776 will find that another Samba server is already the DMB and will fail. This provides automatic redundancy should
777 the current DMB fail.
778 </para>
780 </sect2>
782 <sect2>
783 <title>Making Samba the Domain Master</title>
785 <para>
786 The domain master is responsible for collating the browse lists of multiple subnets so browsing can occur between subnets. You can
787 make Samba act as the domain master by setting <smbconfoption name="domain master">yes</smbconfoption>
788 in &smb.conf;. By default it will not be a domain master.
789 </para>
791 <para>
792 Do not set Samba to be the domain master for a workgroup that has the same name as an NT/200x domain.
793 If Samba is configured to be the domain master for a workgroup that is present on the same
794 network as a Windows NT/200x domain that has the same name, network browsing problems will
795 certainly be experienced.
796 </para>
798 <para>
799 When Samba is the domain master and the master browser, it will listen for master
800 announcements (made roughly every 12 minutes) from LMBs on
801 other subnets and then contact them to synchronize browse lists.
802 </para>
804 <para>
805 If you want Samba to be the domain master, you should also set the
806 <smbconfoption name="os level"/> high enough to make sure it wins elections, and
807 set <smbconfoption name="preferred master"/> to <constant>yes</constant>, to
808 get Samba to force an election on startup.
809 </para>
811 <para>
812 All servers (including Samba) and clients should be using a WINS server to resolve NetBIOS names. If your
813 clients are only using broadcasting to resolve NetBIOS names, then two things will occur:
814 </para>
816 <orderedlist>
817 <listitem>
818         <para>
819         LMBs will be unable to find a DMB because they will be looking only on the local subnet.
820         </para>
821 </listitem>
823 <listitem>
824         <para>
825         If a client happens to get hold of a domain-wide browse list and a user attempts to access a
826         host in that list, it will be unable to resolve the NetBIOS name of that host.
827         </para>
828 </listitem>
829 </orderedlist>
831 <para>
832 If, however, both Samba and your clients are using a WINS server, then:
833 </para>
835 <orderedlist>
836 <listitem>
837         <para>
838         LMBs will contact the WINS server and, as long as Samba has registered that it is a DMB with the WINS
839         server, the LMB will receive Samba's IP address as its DMB.
840         </para>
841 </listitem>
843 <listitem>
844         <para>
845         When a client receives a domain-wide browse list and a user attempts to access a host in that list, it will contact the WINS server to
846         resolve the NetBIOS name of that host. As long as that host has registered its NetBIOS name with the same WINS server, the user will
847         be able to see that host. 
848         </para>
849 </listitem>
850 </orderedlist>
852 </sect2>
854 <sect2>
855 <title>Note about Broadcast Addresses</title>
857 <para>
858 If your network uses a zero-based broadcast address (for example, if it ends in a 0), then you will strike problems. Windows for Workgroups
859 does not seem to support a zeros broadcast, and you will probably find that browsing and name lookups will not work.
860 </para>
861 </sect2>
863 <sect2>
864 <title>Multiple Interfaces</title>
866 <para>
867 Samba supports machines with multiple network interfaces. If you have multiple interfaces, you will
868 need to use the <smbconfoption name="interfaces"/> option in &smb.conf; to configure them. 
869 </para>
870 </sect2>
871 <sect2>
872 <title>Use of the Remote Announce Parameter</title>
873 <para>
874 The <smbconfoption name="remote announce"/> parameter of 
875 &smb.conf; can be used to forcibly ensure
876 that all the NetBIOS names on a network get announced to a remote network.
877 The syntax of the <smbconfoption name="remote announce"/> parameter is:
878 <smbconfblock>
879 <smbconfoption name="remote announce">a.b.c.d [e.f.g.h] ...</smbconfoption>
880 </smbconfblock>
881 <emphasis>or</emphasis>
882 <smbconfblock>
883 <smbconfoption name="remote announce">a.b.c.d/WORKGROUP [e.f.g.h/WORKGROUP] ...</smbconfoption>
884 </smbconfblock>
886 where:
887 <variablelist>
888         <varlistentry><term><replaceable>a.b.c.d</replaceable> and <replaceable>e.f.g.h</replaceable></term>
889                 <listitem><para>
890 <indexterm><primary>LMB</primary><see>Local Master Browser</see></indexterm>
891 <indexterm><primary>Local Master Browser</primary></indexterm>
892                 is either the LMB IP address or the broadcast address of the remote network.
893                 That is, the LMB is at 192.168.1.10, or the address could be given as 192.168.1.255 where the netmask
894                 is assumed to be 24 bits (255.255.255.0). When the remote announcement is made to the broadcast
895                 address of the remote network, every host will receive our announcements. This is noisy and therefore
896                 undesirable but may be necessary if we do not know the IP address of the remote LMB.
897                 </para></listitem>
898         </varlistentry>
900         <varlistentry>
901                 <term><replaceable>WORKGROUP</replaceable></term>
902                 <listitem><para>is optional and can be either our own workgroup or that of the remote network. If you use the
903                 workgroup name of the remote network, our NetBIOS machine names will end up looking like
904                 they belong to that workgroup. This may cause name resolution problems and should be avoided.
905                 </para></listitem>
906         </varlistentry>
907 </variablelist>
908 </para>
910 </sect2>
912 <sect2>
913 <title>Use of the Remote Browse Sync Parameter</title>
915 <para>
916 The <smbconfoption name="remote browse sync"/> parameter of 
917 &smb.conf; is used to announce to another LMB that it must synchronize its NetBIOS name list with our
918 Samba LMB. This works only if the Samba server that has this option is
919 simultaneously the LMB on its network segment.
920 </para>
922 <para>
923 The syntax of the <smbconfoption name="remote browse sync"/> parameter is:
925 <smbconfblock>
926 <smbconfoption name="remote browse sync"><replaceable>a.b.c.d</replaceable></smbconfoption>
927 </smbconfblock>
929 where <replaceable>a.b.c.d</replaceable> is either the IP address of the
930 remote LMB or the network broadcast address of the remote segment.
931 </para>
933 </sect2>
935 </sect1>
937 <sect1>
938 <title>WINS: The Windows Internetworking Name Server</title>
940 <para>
941 Use of WINS (either Samba WINS or MS Windows NT Server WINS) is highly
942 recommended. Every NetBIOS machine registers its name together with a
943 name_type value for each of several types of service it has available.
944 It registers its name directly as a unique (the type 0x03) name.
945 It also registers its name if it is running the LanManager-compatible
946 server service (used to make shares and printers available to other users)
947 by registering the server (the type 0x20) name.
948 </para>
950 <para>
951 All NetBIOS names are up to 15 characters in length. The name_type variable
952 is added to the end of the name, thus creating a 16 character name. Any
953 name that is shorter than 15 characters is padded with spaces to the 15th
954 character. Thus, all NetBIOS names are 16 characters long (including the
955 name_type information).
956 </para>
958 <para>
959 WINS can store these 16-character names as they get registered. A client
960 that wants to log onto the network can ask the WINS server for a list
961 of all names that have registered the NetLogon service name_type. This saves
962 broadcast traffic and greatly expedites logon processing. Since broadcast
963 name resolution cannot be used across network segments this type of
964 information can only be provided via WINS or via a statically configured
965 <filename>lmhosts</filename> file that must reside on all clients in the
966 absence of WINS.
967 </para>
969 <para>
970 WINS also forces browse list synchronization by all
971 LMBs. LMBs must synchronize their browse list with the DMB,
972 and WINS helps the LMB to identify its DMB. By definition this
973 will work only within a single workgroup. Note that the DMB
974 has nothing to do with what is referred to as an MS Windows NT domain. The
975 latter is a reference to a security environment, while the DMB refers to the
976 master controller for browse list information only.
977 </para>
979 <para>
980 WINS will work correctly only if every client TCP/IP protocol stack
981 is configured to use the WINS servers. Any client that is not
982 configured to use the WINS server will continue to use only broadcast-based
983 name registration, so WINS may never get to know about it. In any case,
984 machines that have not registered with a WINS server will fail name-to-address
985 lookup attempts by other clients and will therefore cause workstation access
986 errors.
987 </para>
989 <para>
990 To configure Samba as a WINS server, just add 
991 <smbconfoption name="wins support">yes</smbconfoption> to the &smb.conf;
992 file [global] section.
993 </para>
995 <para>
996 To configure Samba to register with a WINS server, just add
997 <smbconfoption name="wins server">a.b.c.d</smbconfoption>
998 to your &smb.conf; file <smbconfsection name="[global]"/> section.
999 </para>
1001 <important><para>
1002 Never use <smbconfoption name="wins support">yes</smbconfoption> together
1003 with <smbconfoption name="wins server">a.b.c.d</smbconfoption>
1004 particularly not using its own IP address. Specifying both will cause &nmbd; to refuse to start!
1005 </para></important>
1007 <sect2>
1008 <title>WINS Server Configuration</title>
1010 <para>
1011 Either a Samba server or a Windows NT server machine may be set up
1012 as a WINS server. To configure a Samba server to be a WINS server, you must
1013 add to the &smb.conf; file on the selected Server the following line to
1014 the <smbconfsection name="[global]"/> section:
1015 </para>
1017 <para>
1018 <smbconfblock>
1019 <smbconfoption name="wins support">yes</smbconfoption>
1020 </smbconfblock>
1021 </para>
1023 <para>
1024 Versions of Samba prior to 1.9.17 had this parameter default to
1025 yes. If you have any older versions of Samba on your network, it is
1026 strongly suggested you upgrade to a recent version, or at the very
1027 least set the parameter to <quote>no</quote> on all these machines.
1028 </para>
1030 <para>
1031 Machines configured with <smbconfoption name="wins support">yes</smbconfoption> will keep a list of 
1032 all NetBIOS names registered with them, acting as a DNS for NetBIOS names.
1033 </para>
1035 <para>
1036 It is strongly recommended to set up only one WINS server. Do not set the
1037 <smbconfoption name="wins support">yes</smbconfoption> option on more than one Samba 
1038 server.
1039 </para>
1041 <para>
1042 <indexterm><primary>replication</primary><secondary>WINS</secondary></indexterm>
1043 To configure Windows NT/200x Server as a WINS server, install and configure
1044 the WINS service. See the Windows NT/200x documentation for details.
1045 Windows NT/200x WINS servers can replicate to each other, allowing more
1046 than one to be set up in a complex subnet environment. Because Microsoft
1047 refuses to document the replication protocols, Samba cannot currently
1048 participate in these replications. It is possible in the future that
1049 a Samba-to-Samba WINS replication protocol may be defined, in which
1050 case more than one Samba machine could be set up as a WINS server.
1051 Currently only one Samba server should have the 
1052 <smbconfoption name="wins support">yes</smbconfoption> parameter set.
1053 </para>
1055 <para>
1056 After the WINS server has been configured, you must ensure that all
1057 machines participating on the network are configured with the address
1058 of this WINS server. If your WINS server is a Samba machine, fill in
1059 the Samba machine IP address in the <guilabel>Primary WINS Server</guilabel> field of
1060 the <guilabel>Control Panel->Network->Protocols->TCP->WINS Server</guilabel> dialogs
1061 in Windows 9x/Me or Windows NT/200x. To tell a Samba server the IP address
1062 of the WINS server, add the following line to the <smbconfsection name="[global]"/> section of
1063 all &smb.conf; files:
1064 </para>
1066 <para>
1067 <smbconfblock>
1068 <smbconfoption name="wins server">&lt;name or IP address&gt;</smbconfoption>
1069 </smbconfblock>
1070 </para>
1072 <para>
1073 where &lt;name or IP address&gt; is either the DNS name of the WINS server
1074 machine or its IP address.
1075 </para>
1077 <para>
1078 This line must not be set in the &smb.conf; file of the Samba
1079 server acting as the WINS server itself. If you set both the
1080 <smbconfoption name="wins support">yes</smbconfoption> option and the 
1081 <smbconfoption name="wins server">&lt;name&gt;</smbconfoption> option then
1082 <command>nmbd</command> will fail to start.
1083 </para>
1085 <para>
1086 There are two possible scenarios for setting up cross-subnet browsing.
1087 The first details setting up cross-subnet browsing on a network containing
1088 Windows 9x/Me, Samba, and Windows NT/200x machines that are not configured as
1089 part of a Windows NT domain. The second details setting up cross-subnet
1090 browsing on networks that contain NT domains.
1091 </para>
1093 </sect2>
1095 <sect2>
1096 <title>WINS Replication</title>
1098 <para>
1099 <indexterm><primary>replication</primary><secondary>WINS</secondary></indexterm>
1100 Samba-3 permits WINS replication through the use of the <filename>wrepld</filename> utility.
1101 This tool is not currently in use because it is still in active development.
1102 As soon as this tool becomes moderately functional, we will prepare man pages and enhance this
1103 section of the documentation to provide usage and technical details.
1104 </para>
1106 </sect2>
1107 <sect2>
1108 <title>Static WINS Entries</title>
1110 <para>
1111 Adding static entries to your Samba WINS server is actually fairly easy.
1112 All you have to do is add a line to <filename>wins.dat</filename>, typically
1113 located in <filename class="directory">/usr/local/samba/var/locks</filename> or
1114 <filename>/var/run/samba</filename>.
1115 </para>
1117 <para>
1118 Entries in <filename>wins.dat</filename> take the form of:
1120 <programlisting>
1121 "NAME#TYPE" TTL ADDRESS+ FLAGS
1122 </programlisting>
1124 where NAME is the NetBIOS name, TYPE is the NetBIOS type, TTL is the
1125 time-to-live as an absolute time in seconds, ADDRESS+ is one or more
1126 addresses corresponding to the registration, and FLAGS are the NetBIOS
1127 flags for the registration.
1128 </para>
1130 <para>
1131 A typical dynamic entry looks like this:
1132 <programlisting>
1133 "MADMAN#03" 1055298378 192.168.1.2 66R
1134 </programlisting>
1136 To make it static, simply set the TTL to 0, like this:
1138 <programlisting>
1139 "MADMAN#03" 0 192.168.1.2 66R
1140 </programlisting>
1141 </para>
1143 <para>
1144 Though this method works with early Samba-3 versions, there is a
1145 possibility that it may change in future versions if WINS replication
1146 is added.
1147 </para>
1149 </sect2>
1150 </sect1>
1152 <sect1>
1153 <title>Helpful Hints</title>
1155 <para>
1156 The following hints should be carefully considered because they are stumbling points
1157 for many new network administrators.
1158 </para>
1160 <sect2>
1161 <title>Windows Networking Protocols</title>
1163 <para>
1164 A common cause of browsing problems results from installing more than
1165 one protocol on an MS Windows machine.
1166 </para>
1168 <warning><para>
1169 Do not use more than one protocol on MS Windows clients.
1170 </para></warning>
1172 <para>
1173 Every NetBIOS machine takes part in a process of electing the LMB (and DMB)
1174 every 15 minutes. A set of election criteria is used to determine the order
1175 of precedence for winning this election process. A machine running Samba or
1176 Windows NT will be biased, so the most suitable machine will predictably
1177 win and thus retain its role.
1178 </para>
1180 <para>
1181 The election process is fought out over every NetBIOS network
1182 interface. In the case of a Windows 9x/Me machine that has both TCP/IP and IPX
1183 installed and has NetBIOS enabled over both protocols, the election will be
1184 decided over both protocols. As often happens, if the Windows 9x/Me machine is
1185 the only one with both protocols, then the LMB may be won on the NetBIOS
1186 interface over the IPX protocol. Samba will then lose the LMB role because Windows
1187 9x/Me will insist it knows who the LMB is. Samba will then cease to function
1188 as an LMB, and browse list operation on all TCP/IP-only machines will
1189 therefore fail.
1190 </para>
1192 <para>
1193 Windows 95, 98, 98se, and Me are referred to generically as Windows 9x/Me.
1194 The Windows NT4, 200x, and XP use common protocols. These are roughly
1195 referred to as the Windows NT family, but it should be recognized that 2000 and
1196 XP/2003 introduce new protocol extensions that cause them to behave 
1197 differently from MS Windows NT4. Generally, where a server does not support
1198 the newer or extended protocol, these will fall back to the NT4 protocols.
1199 </para>
1201 <para>
1202 The safest rule of all to follow is: Use only one protocol!
1203 </para>
1205 </sect2>
1207 <sect2>
1208 <title>Name Resolution Order</title>
1210 <para>
1211 Resolution of NetBIOS names to IP addresses can take place using a number
1212 of methods. The only ones that can provide NetBIOS name_type information
1213 are:
1214 </para>
1216 <itemizedlist>
1217         <listitem><para>WINS &smbmdash; the best tool.</para></listitem>
1218         <listitem><para>LMHOSTS &smbmdash; static and hard to maintain.</para></listitem>
1219         <listitem><para>Broadcast &smbmdash; uses UDP and cannot resolve names across remote segments.</para></listitem>
1220 </itemizedlist>
1222 <para>
1223 Alternative means of name resolution include:
1224 </para>
1225 <itemizedlist>
1226 <listitem><para>Static <filename>/etc/hosts</filename> &smbmdash;  hard to maintain and lacks name_type info.</para></listitem>
1227 <listitem><para>DNS &smbmdash; is a good choice but lacks essential name_type info.</para></listitem>
1228 </itemizedlist>
1230 <para>
1231 Many sites want to restrict DNS lookups and avoid broadcast name
1232 resolution traffic. The <parameter>name resolve order</parameter> parameter is of great help here.
1233 The syntax of the <parameter>name resolve order</parameter> parameter is:
1234 <smbconfblock>
1235 <smbconfoption name="name resolve order">wins lmhosts bcast host</smbconfoption>
1236 </smbconfblock>
1237 <emphasis>or</emphasis>
1238 <smbconfblock>
1239 <smbconfoption name="name resolve order">wins lmhosts   (eliminates bcast and host)</smbconfoption>
1240 </smbconfblock>
1241 The default is:
1242 <smbconfblock>
1243 <smbconfoption name="name resolve order">host lmhost wins bcast</smbconfoption>,
1244 </smbconfblock>
1245 where <quote>host</quote> refers to the native methods used by the UNIX system
1246 to implement the gethostbyname() function call. This is normally
1247 controlled by <filename>/etc/host.conf</filename>, <filename>/etc/nsswitch.conf</filename> and <filename>/etc/resolv.conf</filename>.
1248 </para>
1249 </sect2>
1250 </sect1>
1252 <sect1>
1253 <title>Technical Overview of Browsing</title>
1255 <para>
1256 SMB networking provides a mechanism by which clients can access a list
1257 of machines in a network called <smbconfoption name="browse list"/>. This list
1258 contains machines that are ready to offer file and/or print services
1259 to other machines within the network. It therefore does not include
1260 machines that aren't currently able to do server tasks. The browse
1261 list is heavily used by all SMB clients. Configuration of SMB
1262 browsing has been problematic for some Samba users, hence this
1263 document.
1264 </para>
1266 <para>
1267 MS Windows 2000 and later versions, as with Samba-3 and later versions, can be
1268 configured to not use NetBIOS over TCP/IP. When configured this way,
1269 it is imperative that name resolution (using DNS/LDAP/ADS) be correctly
1270 configured and operative. Browsing will not work if name resolution
1271 from SMB machine names to IP addresses does not function correctly.
1272 </para>
1274 <para>
1275 Where NetBIOS over TCP/IP is enabled, use of a WINS server is highly
1276 recommended to aid the resolution of NetBIOS (SMB) names to IP addresses.
1277 WINS allows remote segment clients to obtain NetBIOS name_type information
1278 that cannot be provided by any other means of name resolution.
1279 </para>
1281 <sect2>
1282 <title>Browsing Support in Samba</title>
1284 <para>
1285 Samba facilitates browsing. The browsing is supported by &nmbd;
1286 and is also controlled by options in the &smb.conf; file.
1287 Samba can act as an LMB for a workgroup, and the ability
1288 to support domain logons and scripts is now available.
1289 </para>
1291 <para>
1292 Samba can also act as a DMB for a workgroup. This
1293 means that it will collate lists from LMBs into a
1294 wide-area network server list. In order for browse clients to
1295 resolve the names they may find in this list, it is recommended that
1296 both Samba and your clients use a WINS server.
1297 </para>
1299 <para>
1300 Do not set Samba to be the domain master for a workgroup that has the same
1301 name as an NT Domain. On each wide-area network, you must only ever have one
1302 DMB per workgroup, regardless of whether it is NT, Samba,
1303 or any other type of domain master that is providing this service.
1304 </para>
1306 <note><para>
1307 <command>nmbd</command> can be configured as a WINS server, but it is not
1308 necessary to specifically use Samba as your WINS server. MS Windows
1309 NT4, Server or Advanced Server 200x can be configured as
1310 your WINS server. In a mixed NT/200x server and Samba environment on
1311 a WAN, it is recommended that you use the Microsoft
1312 WINS server capabilities. In a Samba-only environment, it is
1313 recommended that you use one and only one Samba server as the WINS server.
1314 </para></note>
1316 <para>
1317 To get browsing to work, you need to run nmbd as usual, but must
1318 use the <smbconfoption name="workgroup"/> option in &smb.conf;
1319 to control what workgroup Samba becomes a part of.
1320 </para>
1322 <para>
1323 Samba also has a useful option for a Samba server to offer itself for
1324 browsing on another subnet. It is recommended that this option is
1325 used only for <quote>unusual</quote> purposes: announcements over the Internet, for
1326 example. See <smbconfoption name="remote announce"/> in the 
1327 &smb.conf; man page. 
1328 </para>
1329 </sect2>
1331 <sect2>
1332 <title>Problem Resolution</title>
1334 <para>
1335 If something does not work, the <filename>log.nmbd</filename> file will help
1336 to track down the problem. Try a <smbconfoption name="log level"></smbconfoption> of 2 or 3 for finding
1337 problems. Also note that the current browse list usually gets stored
1338 in text form in a file called <filename>browse.dat</filename>.
1339 </para>
1341 <para>
1342 If it does not work, you should still be able to
1343 type the server name as <filename>\\SERVER</filename> in <command>filemanager</command>, then
1344 press enter, and <command>filemanager</command> should display the list of available shares.
1345 </para>
1347 <para>
1348 Some people find browsing fails because they do not have the global
1349 <smbconfoption name="guest account"/> set to a valid account. Remember that the
1350 IPC$ connection that lists the shares is done as guest and so you must have a valid guest account.
1351 </para>
1353 <para>
1354 MS Windows 2000 and later (as with Samba) can be configured to disallow
1355 anonymous (i.e., guest account) access to the IPC$ share. In that case, the
1356 MS Windows 2000/XP/2003 machine acting as an SMB/CIFS client will use the
1357 name of the currently logged-in user to query the IPC$ share. MS Windows
1358 9x/Me clients are not able to do this and thus will not be able to browse
1359 server resources.
1360 </para>
1362 <para>
1363 The other big problem people have is that their broadcast address,
1364 netmask, or IP address is wrong (specified with the <smbconfoption name="interfaces"></smbconfoption> option
1365 in &smb.conf;)
1366 </para>
1367 </sect2>
1369 <sect2>
1370 <title>Cross-Subnet Browsing</title>
1372 <para>
1373 <indexterm><primary>replication</primary><secondary>browse lists</secondary></indexterm>
1374 Since the release of Samba 1.9.17 (alpha1), Samba has supported the
1375 replication of browse lists across subnet boundaries. This section
1376 describes how to set this feature up in different settings.
1377 </para>
1379 <para>
1380 To see browse lists that span TCP/IP subnets (i.e., networks separated
1381 by routers that do not pass broadcast traffic), you must set up at least
1382 one WINS server. The WINS server acts as a DNS for NetBIOS names. This will
1383 allow NetBIOS name-to-IP address translation to be completed by a direct
1384 query of the WINS server. This is done via a directed UDP packet on
1385 port 137 to the WINS server machine. The WINS server avoids the necessity
1386 of default NetBIOS name-to-IP address translation, which is done
1387 using UDP broadcasts from the querying machine. This means that machines
1388 on one subnet will not be able to resolve the names of machines on
1389 another subnet without using a WINS server.
1390 </para>
1392 <para>
1393 Remember, for browsing across subnets to work correctly, all machines,
1394 be they Windows 95, Windows NT, or Samba servers, must have the IP address
1395 of a WINS server given to them by a DHCP server or by manual configuration: 
1396 for Windows 9x/Me and Windows NT/200x/XP, this is in the TCP/IP Properties, under Network 
1397 settings; for Samba, this is in the &smb.conf; file.
1398 </para>
1400 <sect3>
1401 <title>Behavior of Cross-Subnet Browsing</title>
1403 <para>
1404 Cross-subnet browsing is a complicated dance, containing multiple
1405 moving parts. It has taken Microsoft several years to get the code
1406 that correctly achieves this, and Samba lags behind in some areas.
1407 Samba is capable of cross-subnet browsing when configured correctly.
1408 </para>
1410 <para>
1411 Consider a network set up as in <link linkend="browsing1">Cross-Subnet Browsing Example</link>.
1412 </para>
1414 <figure id="browsing1">
1415         <title>Cross-Subnet Browsing Example.</title>
1416         <imagefile scale="40">browsing1</imagefile>
1417 </figure>
1418         
1419 <para>
1420 This consists of three subnets (1, 2, 3) connected by two routers
1421 (R1, R2), which do not pass broadcasts. Subnet 1 has five machines
1422 on it, subnet 2 has four machines, and subnet 3 has four machines. Assume
1423 for the moment that all machines are configured to be in the
1424 same workgroup (for simplicity's sake). Machine N1_C on subnet 1
1425 is configured as the DMB (i.e., it will collate the
1426 browse lists for the workgroup). Machine N2_D is configured as
1427 a WINS server, and all the other machines are configured to register
1428 their NetBIOS names with it.
1429 </para>
1431 <para>
1432 As these machines are booted up, elections for master browsers
1433 take place on each of the three subnets. Assume that machine
1434 N1_C wins on subnet 1, N2_B wins on subnet 2, and N3_D wins on
1435 subnet 3. These machines are known as LMBs for
1436 their particular subnet. N1_C has an advantage in winning as the
1437 LMB on subnet 1 because it is set up as DMB.
1438 </para>
1440 <para>
1441 On each of the three networks, machines that are configured to 
1442 offer sharing services will broadcast that they are offering
1443 these services. The LMB on each subnet will
1444 receive these broadcasts and keep a record of the fact that
1445 the machine is offering a service. This list of records is
1446 the basis of the browse list. For this case, assume that
1447 all the machines are configured to offer services, so all machines
1448 will be on the browse list.
1449 </para>
1451 <para>
1452 For each network, the LMB on that network is
1453 considered <emphasis>authoritative</emphasis> for all the names it receives via
1454 local broadcast. This is because a machine seen by the LMB
1455 via a local broadcast must be on the same network as the
1456 Local Master Browser and thus is a <emphasis>trusted</emphasis>
1457 and <emphasis>verifiable</emphasis> resource. Machines on other networks that
1458 the LMBs learn about when collating their
1459 browse lists have not been directly seen. These records are
1460 called <emphasis>non-authoritative.</emphasis>
1461 </para>
1463 <para>
1464 At this point the browse lists appear as shown in <link linkend="browsubnet">Browse Subnet Example 1</link> (these are 
1465 the machines you would see in your network neighborhood if you looked in it on a particular network right now).
1466 </para>
1468 <para>
1469 <table frame="all" id="browsubnet">
1470         <title>Browse Subnet Example 1</title>          
1471         <tgroup align="left" cols="3">
1472         <thead>
1473                 <row><entry>Subnet</entry><entry>Browse Master</entry><entry>List</entry></row>
1474         </thead>
1476         <tbody>
1477                 <row><entry>Subnet1</entry><entry>N1_C</entry><entry>N1_A, N1_B, N1_C, N1_D, N1_E</entry></row>
1478                 <row><entry>Subnet2</entry><entry>N2_B</entry><entry>N2_A, N2_B, N2_C, N2_D</entry></row>
1479                 <row><entry>Subnet3</entry><entry>N3_D</entry><entry>N3_A, N3_B, N3_C, N3_D</entry></row>
1480         </tbody>
1481         </tgroup>
1482 </table>
1483 </para>
1485 <para>
1486 At this point all the subnets are separate, and no machine is seen across any of the subnets.
1487 </para>
1489 <para>
1490 Now examine subnet 2 in <link linkend="brsbex">Browse Subnet Example 2</link>.
1491 As soon as N2_B has become the LMB, it looks for a DMB with which to synchronize
1492 its browse list. It does this by querying the WINS server
1493 (N2_D) for the IP address associated with the NetBIOS name 
1494 WORKGROUP&lt;1B&gt;. This name was registered by the DMB
1495 (N1_C) with the WINS server as soon as it was started.
1496 </para>
1498 <para>
1499 Once N2_B knows the address of the DMB, it
1500 tells it that is the LMB for subnet 2 by
1501 sending a <emphasis>MasterAnnouncement</emphasis> packet as a UDP port 138 packet.
1502 It then synchronizes with it by doing a <emphasis>NetServerEnum2</emphasis> call. This
1503 tells the DMB to send it all the server
1504 names it knows about. Once the DMB receives
1505 the <emphasis>MasterAnnouncement</emphasis> packet, it schedules a synchronization
1506 request to the sender of that packet. After both synchronizations
1507 are complete, the browse lists look like those in <link linkend="brsbex">Browse Subnet Example 2</link>
1508 </para>
1510 <table frame="all" id="brsbex">
1511         <title>Browse Subnet Example 2</title>          
1512         <tgroup cols="3">
1513                 <colspec align="left"/>
1514                 <colspec align="left"/>
1515                 <colspec align="justify" colwidth="1*"/>
1516         <thead>
1517                 <row><entry>Subnet</entry><entry>Browse Master</entry><entry>List</entry></row>
1518         </thead>
1520         <tbody>
1521                 <row><entry>Subnet1</entry><entry>N1_C</entry><entry>N1_A, N1_B, N1_C, N1_D, N1_E,
1522 N2_A(*), N2_B(*), N2_C(*), N2_D(*)</entry></row>
1523                 <row><entry>Subnet2</entry><entry>N2_B</entry><entry>N2_A, N2_B, N2_C, N2_D, N1_A(*), 
1524 N1_B(*), N1_C(*), N1_D(*), N1_E(*)</entry></row>
1525                 <row><entry>Subnet3</entry><entry>N3_D</entry><entry>N3_A, N3_B, N3_C, N3_D</entry></row>
1526         </tbody>
1527         </tgroup>
1528 </table>
1530 <para>
1531 Servers with an (*) after them are non-authoritative names.
1532 </para>
1534 <para>
1535 At this point users looking in their Network Neighborhood on
1536 subnets 1 or 2 will see all the servers on both; users on
1537 subnet 3 will still see only the servers on their own subnet.
1538 </para>
1540 <para>
1541 The same sequence of events that occurred for N2_B now occurs
1542 for the LMB on subnet 3 (N3_D). When it
1543 synchronizes browse lists with the DMB (N1_A)
1544 it gets both the server entries on subnet 1 and those on
1545 subnet 2. After N3_D has synchronized with N1_C and vica versa,
1546 the browse lists will appear as shown in <link linkend="brsex2">Browse Subnet Example 3</link>
1547 </para>
1549 <table frame="all" id="brsex2">
1550         <title>Browse Subnet Example 3</title>          
1551         <tgroup cols="3" align="left">
1552                 <colspec align="left"/>
1553                 <colspec align="left"/>
1554                 <colspec align="justify" colwidth="1*"/>
1556         <thead>
1557                 <row><entry>Subnet</entry><entry>Browse Master</entry><entry>List</entry></row>
1558         </thead>
1560         <tbody>
1561                 <row><entry>Subnet1</entry><entry>N1_C</entry><entry>N1_A, N1_B, N1_C, N1_D, N1_E, 
1562 N2_A(*), N2_B(*), N2_C(*), N2_D(*), N3_A(*), N3_B(*), N3_C(*), N3_D(*)</entry></row>
1563                 <row><entry>Subnet2</entry><entry>N2_B</entry><entry>N2_A, N2_B, N2_C, N2_D, N1_A(*), 
1564 N1_B(*), N1_C(*), N1_D(*), N1_E(*)</entry></row>
1565                 <row><entry>Subnet3</entry><entry>N3_D</entry><entry>N3_A, N3_B, N3_C, N3_D, N1_A(*), 
1566 N1_B(*), N1_C(*), N1_D(*), N1_E(*), N2_A(*), N2_B(*), N2_C(*), N2_D(*)</entry></row>
1567         </tbody>
1568         </tgroup>
1569 </table>
1571 <para>
1572 Servers with an (*) after them are non-authoritative names.
1573 </para>
1575 <para>
1576 At this point, users looking in their Network Neighborhood on
1577 subnets 1 or 3 will see all the servers on all subnets, while users on
1578 subnet 2 will still see only the servers on subnets 1 and 2, but not 3.
1579 </para>
1581 <para>
1582 Finally, the LMB for subnet 2 (N2_B) will sync again
1583 with the DMB (N1_C) and will receive the missing
1584 server entries. Finally, as when a steady state (if no machines
1585 are removed or shut off) has been achieved, the browse lists will appear
1586 as shown in <link linkend="brsex3">Browse Subnet Example 4</link>.
1587 </para>
1589 <table frame="all" id="brsex3">
1590         <title>Browse Subnet Example 4</title>          
1591         <tgroup cols="3" align="left">
1592                 <colspec align="left"/>
1593                 <colspec align="left"/>
1594                 <colspec align="justify" colwidth="1*"/>
1596         <thead>
1597                 <row><entry>Subnet</entry><entry>Browse Master</entry><entry>List</entry></row>
1598         </thead>
1600         <tbody>
1601                 <row><entry>Subnet1</entry><entry>N1_C</entry><entry>N1_A, N1_B, N1_C, N1_D, N1_E,
1602 N2_A(*), N2_B(*), N2_C(*), N2_D(*), N3_A(*), N3_B(*), 
1603 N3_C(*), N3_D(*)</entry></row>
1604                 <row><entry>Subnet2</entry><entry>N2_B</entry><entry>N2_A, N2_B, N2_C, N2_D, N1_A(*), 
1605 N1_B(*), N1_C(*), N1_D(*), N1_E(*), N3_A(*), N3_B(*), 
1606 N3_C(*), N3_D(*)</entry></row>
1607                 <row><entry>Subnet3</entry><entry>N3_D</entry><entry>N3_A, N3_B, N3_C, N3_D, N1_A(*), 
1608 N1_B(*), N1_C(*), N1_D(*), N1_E(*), N2_A(*), N2_B(*), 
1609 N2_C(*), N2_D(*)</entry></row>
1610         </tbody>
1611         </tgroup>
1612 </table>
1614 <para>
1615 Servers with an (*) after them are non-authoritative names.
1616 </para>
1618 <para>
1619 Synchronizations between the DMB and LMBs
1620 will continue to occur, but this should remain a
1621 steady-state operation.
1622 </para>
1624 <para>
1625 If either router R1 or R2 fails, the following will occur:
1626 </para>
1628 <orderedlist>
1629 <listitem>
1630         <para>
1631         Names of computers on each side of the inaccessible network fragments
1632         will be maintained for as long as 36 minutes in the Network Neighborhood
1633         lists.
1634         </para>
1635 </listitem>
1637 <listitem>
1638         <para>
1639         Attempts to connect to these inaccessible computers will fail, but the
1640         names will not be removed from the Network Neighborhood lists.
1641         </para>
1642 </listitem>
1644 <listitem>
1645         <para>
1646         If one of the fragments is cut off from the WINS server, it will only
1647         be able to access servers on its local subnet using subnet-isolated
1648         broadcast NetBIOS name resolution. The effect is similar to that of
1649         losing access to a DNS server.
1650         </para>
1651 </listitem>
1652 </orderedlist>
1653 </sect3>
1654 </sect2>
1655 </sect1>
1657 <sect1>
1658 <title>Common Errors</title>
1660 <para>
1661 Many questions are asked on the mailing lists regarding browsing. The majority of browsing
1662 problems originate from incorrect configuration of NetBIOS name resolution. Some are of
1663 particular note.
1664 </para>
1666 <sect2>
1667 <title>How Can One Flush the Samba NetBIOS Name Cache without Restarting Samba?</title>
1669 <para>
1670 <indexterm><primary>flush name cache</primary></indexterm>
1671 Samba's <command>nmbd</command> process controls all browse list handling. Under normal circumstances it is
1672 safe to restart <command>nmbd</command>. This will effectively flush the Samba NetBIOS name cache and cause it
1673 to be rebuilt. This does not make certain that a rogue machine name will not reappear
1674 in the browse list. When <command>nmbd</command> is taken out of service, another machine on the network will
1675 become the browse master. This new list may still have the rogue entry in it. If you really
1676 want to clear a rogue machine from the list, every machine on the network must be
1677 shut down and restarted after all machines are down. Failing a complete restart, the only
1678 other thing you can do is wait until the entry times out and is then flushed from the list.
1679 This may take a long time on some networks (perhaps months).
1680 </para>
1682 </sect2>
1684 <sect2>
1685         <title>Server Resources Cannot Be Listed</title>
1687 <para><quote>My Client Reports "<quote>This server is not configured to list shared resources."</quote></quote></para>
1689                 
1690 <para>
1691 Your guest account is probably invalid for some reason. Samba uses the
1692 guest account for browsing in <command>smbd</command>. Check that your guest account is
1693 valid.
1694 </para>
1696 <para>Also see <smbconfoption name="guest account"/> in the &smb.conf; man page.</para>
1698 </sect2>
1700 <sect2>
1701         <title>I Get an "<errorname>Unable to browse the network</errorname>" Error</title>
1703         <para>This error can have multiple causes:
1704 <indexterm><primary>browsing problems</primary></indexterm>
1705         </para>
1706         
1707         <itemizedlist>
1708                 <listitem><para>There is no LMB. Configure &nmbd; 
1709                         or any other machine to serve as LMB.</para></listitem>
1710                 <listitem><para>You cannot log onto the machine that is the LMB. 
1711                         Can you log on to it as a guest user? </para></listitem>
1712                 <listitem><para>There is no IP connectivity to the LMB. 
1713                         Can you reach it by broadcast?</para></listitem>
1714 </itemizedlist>
1715 </sect2>
1717 <sect2>
1718 <title>Browsing of Shares and Directories is Very Slow</title>
1720 <para><quote>
1721 <indexterm><primary>slow browsing</primary></indexterm>
1722 There are only two machines on a test network. One is a Samba server, the other a Windows XP machine.
1723 Authentication and logons work perfectly, but when I try to explore shares on the Samba server, the
1724 Windows XP client becomes unresponsive. Sometimes it does not respond for some minutes. Eventually,
1725 Windows Explorer will respond and displays files and directories without problem.
1726 </quote>
1727 </para>
1729 <para><quote>
1730 But, the share is immediately available from a command shell (<command>cmd</command>, followed by 
1731 exploration with DOS command. Is this a Samba problem, or is it a Windows problem? How can I solve this?
1732 </quote></para>
1734 <para>
1735 Here are a few possibilities:
1736 </para>
1738 <variablelist>
1739         <varlistentry>
1740                 <term>Bad Networking Hardware</term>
1741                 <listitem><para>
1742 <indexterm><primary>bad hardware</primary></indexterm>
1743 <indexterm><primary>WebClient</primary></indexterm>
1744                 Most common defective hardware problems center around low cost or defective hubs, routers,
1745                 network interface controllers (NICs), and bad wiring. If one piece of hardware is defective,
1746                 the whole network may suffer. Bad networking hardware can cause data corruption. Most bad
1747                 networking hardware problems are accompanied by an increase in apparent network traffic,
1748                 but not all.
1749                 </para></listitem>
1750         </varlistentry>
1751         
1752         <varlistentry>
1753                 <term>The Windows XP WebClient</term>
1754                 <listitem><para>
1755                 A number of sites have reported similar slow network browsing problems and found that when
1756                 the WebClient service is turned off, the problem disappears. This is certainly something
1757                 that should be explored because it is a simple solution &smbmdash; if it works.
1758                 </para></listitem>
1759         </varlistentry>
1760         
1761         <varlistentry>
1762                 <term>Inconsistent WINS Configuration</term>
1763                 <listitem><para>
1764                 This type of problem is common when one client is configured to use a WINS server (that is
1765                 a TCP/IP configuration setting) and there is no WINS server on the network. Alternatively,
1766                 this will happen if there is a WINS server and Samba is not configured to use it. The use of
1767                 WINS is highly recommended if the network is using NetBIOS over TCP/IP protocols. If use
1768                 of NetBIOS over TCP/IP is disabled on all clients, Samba should not be configured as a WINS
1769                 server, nor should it be configured to use one.
1770                 </para></listitem>
1771         </varlistentry>
1772         
1773         <varlistentry>
1774                 <term>Incorrect DNS Configuration</term>
1775                 <listitem><para>
1776                 If use of NetBIOS over TCP/IP is disabled, Active Directory is in use and the DNS server
1777                 has been incorrectly configured. For further information refer to
1778                 <link linkend="adsdnstech">DNS and Active Directory</link>.
1779                 </para></listitem>
1780         </varlistentry>
1781 </variablelist>
1783 </sect2>
1784 </sect1>
1785 </chapter>