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