Large number of small fixes to the layout and the build system.
[Samba.git] / docs / Samba3-HOWTO / TOSHARG-NetworkBrowsing.xml
blob95929824298b87fcaccc8be792341d3b040cef39
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 Someone 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-nineteenth
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 seven years, and an
51 ability to germinate at any time of year, given the right conditions, are some of the
52 features which 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 Inter-networking 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 host name 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 machine on the network collates 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: <smbconfoption name="os level"/>(*),
111         <smbconfoption name="lm announce"/>,
112         <smbconfoption name="lm interval"/>,
113         <smbconfoption name="preferred master"/>(*),
114         <smbconfoption name="local master"/>(*),
115         <smbconfoption name="domain master"/>(*),
116         <smbconfoption name="browse list"/>,
117         <smbconfoption name="enhanced browsing"/>.
118 </para>
120 <para>Name Resolution Method:
121         <smbconfoption name="name resolve order"/>(*).
122 </para>
124 <para>WINS options:
125         <smbconfoption name="dns proxy"/>,
126         <smbconfoption name="wins proxy"/>,
127         <smbconfoption name="wins server"/>(*),
128         <smbconfoption name="wins support"/>(*),
129         <smbconfoption name="wins hook"/>.
130 </para>
132 <para>
133 <indexterm><primary>WINS</primary></indexterm>
134 For Samba, the WINS Server and WINS Support are mutually exclusive options. Those marked with
135 an (*) are the only options that commonly may need to be modified. Even if none of these
136 parameters is set, <filename>nmbd</filename> will still do its job.
137 </para>
139 </sect1>
141 <sect1 id="netdiscuss">
142 <title>Discussion</title>
144 <para>
145 <indexterm><primary>SMB-based messaging</primary></indexterm>
146 <indexterm><primary>NetBIOS</primary></indexterm>
147 All MS Windows networking uses SMB-based messaging.  SMB messaging may be implemented with or without NetBIOS.
148 MS Windows 200x supports NetBIOS over TCP/IP for backwards compatibility. Microsoft appears intent on phasing
149 out NetBIOS support.
150 </para>
152 <sect2>
153 <title>NetBIOS over TCP/IP</title>
155 <para>
156 <indexterm><primary>encapsulating</primary></indexterm>
157 <indexterm><primary>broadcast</primary></indexterm>
158 <indexterm><primary>unicast</primary></indexterm>
159 <indexterm><primary>UDP</primary></indexterm>
160 Samba implements NetBIOS, as does MS Windows NT/200x/XP, by encapsulating it over TCP/IP.
161 MS Windows products can do likewise. NetBIOS-based networking uses broadcast messaging to
162 effect browse list management. When running NetBIOS over TCP/IP, this uses UDP-based messaging.
163 UDP messages can be broadcast or unicast.
164 </para>
166 <para>
167 <indexterm><primary>UDP</primary></indexterm>
168 Normally, only uni-cast UDP messaging can be forwarded by routers. The
169 <smbconfoption name="remote announce"/> parameter to smb.conf helps to project browse announcements
170 to remote network segments via uni-cast UDP. Similarly, the 
171 <smbconfoption name="remote browse sync"/> parameter of &smb.conf;
172 implements browse list collation using uni-cast UDP.
173 </para>
175 <para>
176 The methods used by MS Windows to perform name lookup requests (name resolution) is determined by a 
177 configuration parameter called the netbios node-type. There are four (4) basic NetBIOS node types:
178 </para>
180 <indexterm><primary>b-node</primary></indexterm>
181 <indexterm><primary>p-node</primary></indexterm>
182 <indexterm><primary>m-node</primary></indexterm>
183 <indexterm><primary>h-node</primary></indexterm>
184 <indexterm><primary>node-type</primary></indexterm>
185 <indexterm><primary>WINS</primary></indexterm>
186 <indexterm><primary>broadcast</primary></indexterm>
187 <indexterm><primary>unicast</primary></indexterm>
188 <itemizedlist>
189         <listitem><para><emphasis>b-node (type 0x01):</emphasis> The Windows client will use only
190         NetBIOS broadcast requests using UDP broadcast.</para></listitem>
191         <listitem><para><emphasis>p-node (type 0x02):</emphasis> The Windows client will use point-to-point
192         (NetBIOS unicast) requests using UDP unicast directed to a WINS server.</para></listitem>
193         <listitem><para><emphasis>m-node (type 0x04):</emphasis> The Windows client will first use
194         NetBIOS broadcast requests using UDP broadcast, then it will use (NetBIOS unicast) 
195         requests using UDP unicast directed to a WINS server.</para></listitem>
196         <listitem><para><emphasis>h-node (type 0x08):</emphasis> The Windows client will use 
197         (NetBIOS unicast) requests using UDP unicast directed to a WINS server, then it will use 
198         NetBIOS broadcast requests using UDP broadcast.</para></listitem>
199 </itemizedlist>
201 <para>
202 <indexterm><primary>Hybrid</primary></indexterm>
203 The default Windows network client (or server) network configuration enables NetBIOS over TCP/IP
204 and b-node configuration. The use of WINS makes most sense with h-node (Hybid mode) operation so that
205 in the event of a WINS breakdown or non-availability the client can use broadcast based name resolution.
206 </para>
208 <para>
209 <indexterm><primary>LMB</primary><see>Local Master Browser</see></indexterm>
210 <indexterm><primary>Local Master Browser</primary></indexterm>
211 In those networks where Samba is the only SMB server technology, wherever possible 
212 <filename>nmbd</filename> should be configured on one machine as the WINS
213 server. This makes it easy to manage the browsing environment. If each network
214 segment is configured with its own Samba WINS server, then the only way to
215 get cross-segment browsing to work is by using the 
216 <smbconfoption name="remote announce"/> and the 
217 <smbconfoption name="remote browse sync"/>
218 parameters to your &smb.conf; file.
219 </para>
221 <para>
222 <indexterm><primary>WINS</primary></indexterm>
223 If only one WINS server is used for an entire multi-segment network, then
224 the use of the <smbconfoption name="remote announce"/> and the 
225 <smbconfoption name="remote browse sync"/> parameters should not be necessary.
226 </para>
228 <para>
229 <indexterm><primary>replication</primary><secondary>WINS</secondary></indexterm>
230 As of Samba-3 WINS replication is being worked on. The bulk of the code has
231 been committed, but it still needs maturation. This is not a supported feature
232 of the Samba-3.0.20 release. Hopefully, this will become a supported feature
233 of one of the Samba-3 release series.
234 </para>
236 <para>
237 Right now Samba WINS does not support MS-WINS replication. This means that
238 when setting up Samba as a WINS server, there must only be one <filename>nmbd</filename>
239 configured as a WINS server on the network. Some sites have used multiple Samba WINS
240 servers for redundancy (one server per subnet) and then used 
241 <smbconfoption name="remote browse sync"/> and <smbconfoption name="remote announce"/>
242 to effect browse list collation across all segments. Note that this means clients
243 will only resolve local names, and must be configured to use DNS to resolve names
244 on other subnets in order to resolve the IP addresses of the servers they can see
245 on other subnets. This setup is not recommended, but is mentioned as a practical
246 consideration (i.e., an <quote>if all else fails</quote> scenario).
247 </para>
249 <para>
250 Lastly, take note that browse lists are a collection of unreliable broadcast
251 messages that are repeated at intervals of not more than 15 minutes. This means
252 that it will take time to establish a browse list and it can take up to 45
253 minutes to stabilize, particularly across network segments.
254 </para>
256 <para>
257 When an MS Windows 200x/XP system attempts to resolve a host name to an IP address
258 it follows a defined path:
259 </para>
261 <orderedlist>
262         <listitem><para>
263         Checks the <filename>hosts</filename> file. It is located in
264         <filename>%SystemRoot%\System32\Drivers\etc</filename>.
265         </para></listitem>
267         <listitem><para>
268         Does a DNS lookup.
269         </para></listitem>
271         <listitem><para>
272         Checks the NetBIOS name cache.
273         </para></listitem>
275         <listitem><para>
276         Queries the WINS server.
277         </para></listitem>
279         <listitem><para>
280         Does a broadcast name lookup over UDP.
281         </para></listitem>
283         <listitem><para>
284         Looks up entries in LMHOSTS, located in
285         <filename>%SystemRoot%\System32\Drivers\etc</filename>.
286         </para></listitem>
287 </orderedlist>
289 </sect2>
291 <sect2>
292 <title>TCP/IP without NetBIOS</title>
294 <para>
295 <indexterm><primary>NetBIOS</primary></indexterm>
296 <indexterm><primary>NetBIOS-less</primary></indexterm>
297 <indexterm><primary>DNS</primary></indexterm>
298 All TCP/IP-enabled systems use various forms of host name resolution. The primary
299 methods for TCP/IP hostname resolution involve either a static file (<filename>/etc/hosts</filename>)
300 or the Domain Name System (DNS). DNS is the technology that makes
301 the Internet usable. DNS-based host name resolution is supported by nearly all
302 TCP/IP-enabled systems. Only a few embedded TCP/IP systems do not support DNS.
303 </para>
305 <para>
306 <indexterm><primary>DNS</primary></indexterm>
307 Windows 200x/XP can register its host name with a Dynamic DNS server. You can
308 force register with a Dynamic DNS server in Windows 200x/XP using:
309 <command>ipconfig /registerdns</command>.
310 </para>
312 <para>
313 With Active Directory (ADS), a correctly functioning DNS server is absolutely
314 essential. In the absence of a working DNS server that has been correctly configured,
315 MS Windows clients and servers will be unable to locate each other, so
316 consequently network services will be severely impaired.
317 </para>
319 <para>
320 The use of Dynamic DNS is highly recommended with Active Directory, in which case
321 the use of BIND9 is preferred for its ability to adequately support the SRV (service)
322 records that are needed for Active Directory.
323 </para>
325 <para>
326 Use of raw SMB over TCP/IP (No NetBIOS layer) can be done only with Active
327 Directory domains. Samba is not an Active Directory Domain Controller: ergo,
328 it is not possible run Samba as a domain controller and at the same time NOT use
329 NetBIOS. Where Samba is used as an Active Directory Domain Member Server (DMS)
330 it is possible to configure Samba to not use NetBIOS over TCP/IP. A Samba DMS
331 can integrate fully into an Active Directory domain.
332 </para>
334 </sect2>
336 <sect2 id="adsdnstech">
337 <title>DNS and Active Directory</title>
340 <para>
341 <indexterm><primary>DNS</primary><secondary>Active Directory</secondary></indexterm>
342 Occasionally we hear from UNIX network administrators who want to use a UNIX-based Dynamic
343 DNS server in place of the Microsoft DNS server. While this might be desirable to some, the
344 MS Windows 200x DNS server is auto-configured to work with Active Directory. It is possible
345 to use BIND version 8 or 9, but it will almost certainly be necessary to create service records
346 (SRV records) so MS Active Directory clients can resolve host names to locate essential network services.
347 The following are some of the default service records that Active Directory requires:
348 </para>
350 <variablelist>
351 <varlistentry>
352         <term>_ldap._tcp.pdc._msdcs.<emphasis>Domain</emphasis></term>
353         <listitem>
354         <para>
355         This provides the address of the Windows NT PDC for the Domain.
356         </para>
357         </listitem>
358 </varlistentry>
359 <varlistentry>
360         <term>_ldap._tcp.pdc._msdcs.<emphasis>DomainTree</emphasis></term>
361         <listitem>
362         <para>
363         Resolves the addresses of Global Catalog servers in the domain.
364         </para>
365         </listitem>
366 </varlistentry>
367 <varlistentry>
368         <term>_ldap._tcp.<emphasis>site</emphasis>.sites.writable._msdcs.<emphasis>Domain</emphasis></term>
369         <listitem>
370         <para>
371         Provides list of Domain Controllers based on sites.
372         </para>
373         </listitem>
374 </varlistentry>
375 <varlistentry>
376         <term>_ldap._tcp.writable._msdcs.<emphasis>Domain</emphasis></term>
377         <listitem>
378         <para>
379         Enumerates list of Domain Controllers that have the writable copies of the Active Directory data-store.
380         </para>
381         </listitem>
382 </varlistentry>
383 <varlistentry>
384         <term>_ldap._tcp.<emphasis>GUID</emphasis>.domains._msdcs.<emphasis>DomainTree</emphasis></term>
385         <listitem>
386         <para>
387         Entry used by MS Windows clients to locate machines using the Global Unique Identifier.
388         </para>
389         </listitem>
390 </varlistentry>
391 <varlistentry>
392         <term>_ldap._tcp.<emphasis>Site</emphasis>.gc._msdcs.<emphasis>DomainTree</emphasis></term>
393         <listitem>
394         <para>
395         Used by MS Windows clients to locate site configuration dependent Global Catalog server.
396         </para>
397         </listitem>
398 </varlistentry>
399 </variablelist>
401         <para>
402         Specific entries used by Microsoft clients to locate essential services for an example domain
403         called <constant>quenya.org</constant> includes:
404         </para>
406         <itemizedlist>
407                 <listitem><para>
408                 _kerberos._udp.quenya.org &smbmdash; Used to contact the KDC server via UDP.
409                 This entry must list port 88 for each KDC.
410                 </para></listitem>
412                 <listitem><para>
413                 _kpasswd._udp.quenya.org &smbmdash; Used to locate the <constant>kpasswd</constant> server
414                 when a user password change must be processed. This record must list port 464 on the
415                 master KDC.
416                 </para></listitem>
418                 <listitem><para>
419                 _kerberos._tcp.quenya.org &smbmdash; Used to locate the KDC server via TCP.
420                 This entry must list port 88 for each KDC.
421                 </para></listitem>
423                 <listitem><para>
424                 _ldap._tcp.quenya.org &smbmdash; Used to locate the LDAP service on the PDC.
425                 This record must list port 389 for the PDC.
426                 </para></listitem>
428                 <listitem><para>
429                 _kpasswd._tcp.quenya.org &smbmdash; Used to locate the <constant>kpasswd</constant> server
430                 to permit user password changes to be processed. This must list port 464.
431                 </para></listitem>
433                 <listitem><para>
434                 _gc._tcp.quenya.org &smbmdash; Used to locate the Global Catalog server  for the
435                 top of the domain. This must list port 3268.
436                 </para></listitem>
437         </itemizedlist>
438         
439         <para>
440         The following records are also used by the Windows Domain Member client to locate vital
441         services on the Windows ADS domain controllers.
442         </para>
444         <itemizedlist>
445                 <listitem><para>
446                 _ldap._tcp.pdc._msdcs.quenya.org
447                 </para></listitem>
449                 <listitem><para>
450                 _ldap.gc._msdcs.quenya.org
451                 </para></listitem>
453                 <listitem><para>
454                 _ldap.default-first-site-name._sites.gc._msdcs.quenya.org
455                 </para></listitem>
457                 <listitem><para>
458                 _ldap.{SecID}.domains._msdcs.quenya.org
459                 </para></listitem>
461                 <listitem><para>
462                 _ldap._tcp.dc._msdcs.quenya.org
463                 </para></listitem>
465                 <listitem><para>
466                 _kerberos._tcp.dc._msdcs.quenya.org
467                 </para></listitem>
469                 <listitem><para>
470                 _ldap.default-first-site-name._sites.dc._msdcs.quenya.org
471                 </para></listitem>
473                 <listitem><para>
474                 _kerberos.default-first-site-name._sites.dc._msdcs.queyna.org
475                 </para></listitem>
477                 <listitem><para>
478                 SecID._msdcs.quenya.org
479                 </para></listitem>
480         </itemizedlist>
482         <para>
483         Presence of the correct DNS entries can be validated by executing:
484 <screen>
485 &rootprompt; dig @frodo -t any _ldap._tcp.dc._msdcs.quenya.org
487 ; &lt;lt;&gt;&gt; DiG 9.2.2 &lt;lt;&gt;&gt; @frodo -t any _ldap._tcp.dc._msdcs.quenya.org
488 ;; global options:  printcmd
489 ;; Got answer:
490 ;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 3072
491 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2
494 ;; QUESTION SECTION:
495 ;_ldap._tcp.dc._msdcs.quenya.org. IN        ANY
498 ;; ANSWER SECTION:
499 _ldap._tcp.dc._msdcs.quenya.org. 600 IN SRV 0 100 389 frodo.quenya.org.
500 _ldap._tcp.dc._msdcs.quenya.org. 600 IN SRV 0 100 389 noldor.quenya.org.
503 ;; ADDITIONAL SECTION:
504 frodo.quenya.org.  3600  IN      A       10.1.1.16
505 noldor.quenya.org. 1200  IN      A       10.1.1.17
508 ;; Query time: 0 msec
509 ;; SERVER: frodo#53(10.1.1.16)
510 ;; WHEN: Wed Oct  7 14:39:31 2004
511 ;; MSG SIZE  rcvd: 171
512 </screen>
513         </para>
515 </sect2>
517 </sect1>
519 <sect1>
520 <title>How Browsing Functions</title>
522 <para>
523 MS Windows machines register their NetBIOS names 
524 (i.e., the machine name for each service type in operation) on start-up.
525 The exact method by which this name registration 
526 takes place is determined by whether or not the MS Windows client/server 
527 has been given a WINS server address, whether or not LMHOSTS lookup 
528 is enabled, or if DNS for NetBIOS name resolution is enabled, etc.
529 </para>
531 <para>
532 In the case where there is no WINS server, all name registrations as 
533 well as name lookups are done by UDP broadcast. This isolates name 
534 resolution to the local subnet, unless LMHOSTS is used to list all 
535 names and IP addresses. In such situations, Samba provides a means by 
536 which the Samba server name may be forcibly injected into the browse 
537 list of a remote MS Windows network (using the 
538 <smbconfoption name="remote announce"/> parameter).
539 </para>
541 <para>
542 Where a WINS server is used, the MS Windows client will use UDP 
543 uni-cast to register with the WINS server. Such packets can be routed 
544 and thus WINS allows name resolution to function across routed networks.
545 </para>
547 <para>
548 During the startup process an election will take place to create a 
549 Local Master Browser if one does not already exist. On each NetBIOS network 
550 one machine will be elected to function as the Domain Master Browser. This 
551 domain browsing has nothing to do with MS security Domain Control. 
552 Instead, the Domain Master Browser serves the role of contacting each local 
553 master browser (found by asking WINS or from LMHOSTS) and exchanging browse 
554 list contents. This way every master browser will eventually obtain a complete 
555 list of all machines that are on the network. Every 11 to 15 minutes an election 
556 is held to determine which machine will be the master browser. By the nature of 
557 the election criteria used, the machine with the highest uptime, or the 
558 most senior protocol version or other criteria, will win the election 
559 as Domain Master Browser.
560 </para>
562 <para>
563 Clients wishing to browse the network make use of this list, but also depend 
564 on the availability of correct name resolution to the respective IP 
565 address/addresses. 
566 </para>
568 <para>
569 Any configuration that breaks name resolution and/or browsing intrinsics 
570 will annoy users because they will have to put up with protracted 
571 inability to use the network services.
572 </para>
574 <para>
575 Samba supports a feature that allows forced synchronization of browse lists across
576 routed networks using the <smbconfoption name="remote browse sync"/>
577 parameter in the &smb.conf; file. This causes Samba to contact the local master
578 browser on a remote network and to request browse list synchronization. This
579 effectively bridges two networks that are separated by routers. The two remote
580 networks may use either broadcast-based name resolution or WINS-based name
581 resolution, but it should be noted that the
582 <smbconfoption name="remote browse sync"/> parameter provides
583 browse list synchronization &smbmdash; and that is distinct from name to address
584 resolution. In other words, for cross-subnet browsing to function correctly it is
585 essential that a name-to-address resolution mechanism be provided. This mechanism
586 could be via DNS, <filename>/etc/hosts</filename>, and so on.
587 </para>
589 <sect2 id="DMB">
590 <title>Configuring WORKGROUP Browsing</title>
592 <para>
593 To configure cross-subnet browsing on a network containing machines
594 in a WORKGROUP, not an NT Domain, you need to set up one
595 Samba server to be the Domain Master Browser (note that this is not
596 the same as a Primary Domain Controller, although in an NT Domain the
597 same machine plays both roles). The role of a Domain Master Browser is
598 to collate the browse lists from Local Master Browsers on all the
599 subnets that have a machine participating in the workgroup. Without
600 one machine configured as a Domain Master Browser, each subnet would
601 be an isolated workgroup unable to see any machines on another
602 subnet. It is the presence of a Domain Master Browser that makes
603 cross-subnet browsing possible for a workgroup.
604 </para>
606 <para>
607 In a WORKGROUP environment the Domain Master Browser must be a
608 Samba server, and there must only be one Domain Master Browser per
609 workgroup name. To set up a Samba server as a Domain Master Browser,
610 set the following option in the <smbconfsection name="[global]"/> section 
611 of the &smb.conf; file:
612 </para>
614 <para>
615 <smbconfblock>
616 <smbconfoption name="domain master">yes</smbconfoption>
617 </smbconfblock>
618 </para>
620 <para>
621 The Domain Master Browser should preferably be the local master
622 browser for its own subnet. In order to achieve this, set the following
623 options in the <smbconfsection name="[global]"/> section of the &smb.conf;
624 file as shown in <link linkend="dmbexample">the following example</link>:
625 </para>
627 <para>
628 <smbconfexample id="dmbexample">
629 <title>Domain Master Browser smb.conf</title>
630 <smbconfsection name="[global]"/>
631 <smbconfoption name="domain master">yes</smbconfoption>
632 <smbconfoption name="local master">yes</smbconfoption>
633 <smbconfoption name="preferred master">yes</smbconfoption>
634 <smbconfoption name="os level">65</smbconfoption>
635 </smbconfexample>
636 </para>
638 <para>
639 The Domain Master Browser may be the same machine as the WINS server, if necessary.
640 </para>
642 <para>
643 Next, you should ensure that each of the subnets contains a machine that can act as
644 a Local Master Browser for the workgroup. Any MS Windows NT/200x/XP machine should
645 be able to do this, as will Windows 9x/Me machines (although these tend to get
646 rebooted more often, so it is not such a good idea to use these). To make a Samba
647 server a Local Master Browser set the following options in the
648 <smbconfsection name="[global]"/> section of the &smb.conf; file as
649 shown in <link linkend="lmbexample">following example</link>:
650 </para>
652 <para>
653 <smbconfexample id="lmbexample">
654 <title>Local master browser smb.conf</title>
655 <smbconfsection name="[global]"/>
656 <smbconfoption name="domain master">no</smbconfoption>
657 <smbconfoption name="local master">yes</smbconfoption>
658 <smbconfoption name="preferred master">yes</smbconfoption>
659 <smbconfoption name="os level">65</smbconfoption>
660 </smbconfexample>
661 </para>
663 <para>
664 Do not do this for more than one Samba server on each subnet, or they will war with
665 each other over which is to be the Local Master Browser.
666 </para>
668 <para>
669 The <smbconfoption name="local master"/> parameter allows Samba to act as a
670 Local Master Browser. The <smbconfoption name="preferred master"/> causes <command>nmbd</command>
671 to force a browser election on startup and the <smbconfoption name="os level"/>
672 parameter sets Samba high enough so it should win any browser elections.
673 </para>
675 <para>
676 If you have an NT machine on the subnet that you wish to be the Local Master Browser, you can disable Samba from
677 becoming a Local Master Browser by setting the following options in the <smbconfsection name="[global]"/> section of the 
678 &smb.conf; file as shown in <link linkend="nombexample">following example</link>:
679 </para>
681 <para>
682 <smbconfexample id="nombexample">
683 <title>smb.conf for not being a Master Browser</title>
684 <smbconfsection name="[global]"/>
685 <smbconfoption name="domain master">no</smbconfoption>
686 <smbconfoption name="local master">no</smbconfoption>
687 <smbconfoption name="preferred master">no</smbconfoption>
688 <smbconfoption name="os level">0</smbconfoption>
689 </smbconfexample>
690 </para>
692 </sect2>
694 <sect2>
695 <title>DOMAIN Browsing Configuration</title>
697 <para>
698 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.
699 By default, a Windows NT Primary Domain Controller for a domain is also the Domain Master Browser for that domain. Network
700 browsing may break if a Samba server registers the domain master browser NetBIOS name (<replaceable>DOMAIN</replaceable>&lt;1B&gt;)
701 with WINS instead of the PDC.
702 </para>
704 <para>
705 For subnets other than the one containing the Windows NT PDC, you may set up Samba servers as Local Master Browsers as
706 described. To make a Samba server a Local Master Browser, set the following options in the <smbconfsection name="[global]"/> section 
707 of the &smb.conf; file as shown in <link linkend="remsmb">following example</link>:
708 </para>
710 <para>
711 <smbconfexample id="remsmb">
712 <title>Local Master Browser smb.conf</title>
713 <smbconfsection name="[global]"/>
714 <smbconfoption name="domain master">no</smbconfoption>
715 <smbconfoption name="local master">yes</smbconfoption>
716 <smbconfoption name="preferred master">yes</smbconfoption>
717 <smbconfoption name="os level">65</smbconfoption>
718 </smbconfexample>
719 </para>
721 <para>
722 If you wish to have a Samba server fight the election with machines on the same subnet you
723 may set the <smbconfoption name="os level"/> parameter to lower levels.
724 By doing this you can tune the order of machines that will become Local Master Browsers if
725 they are running. For more details on this refer to <link linkend="browse-force-master">Forcing Samba to Be the Master</link> section.
726 </para>
728 <para>
729 If you have Windows NT machines that are members of the domain on all subnets and you are
730 sure they will always be running, you can disable Samba from taking part in browser elections
731 and ever becoming a Local Master Browser by setting the following options in the
732 <smbconfsection name="[global]"/> section of the &smb.conf; file as shown in <link linkend="xremmb">next example</link>:
733 </para>
735 <para>
736 <smbconfexample id="xremmb">
737 <title>&smb.conf; for not being a master browser</title>
738 <smbconfsection name="[global]"/>
739 <smbconfoption name="domain master">no</smbconfoption>
740 <smbconfoption name="local master">no</smbconfoption>
741 <smbconfoption name="preferred master">no</smbconfoption>
742 <smbconfoption name="os level">0</smbconfoption>
743 </smbconfexample>
744 </para>
746 </sect2>
748 <sect2 id="browse-force-master">
749 <title>Forcing Samba to Be the Master</title>
751 <para>
752 Who becomes the master browser is determined by an election process using broadcasts. Each election packet contains a number of parameters
753 that determine what precedence (bias) a host should have in the election. By default Samba uses a low precedence and thus loses
754 elections to just about every Windows network server or client.
755 </para>
757 <para>
758 If you want Samba to win elections, set the <smbconfoption name="os level"/>
759 global option in &smb.conf; to a higher number. It defaults to 20. Using 34 would make it win
760 all elections every other system (except other samba systems).
761 </para>
763 <para>
764 An <smbconfoption name="os level"/> of two would make it beat Windows for Workgroups and Windows 9x/Me, but not MS Windows
765 NT/200x Server. An MS Windows NT/200x Server Domain Controller uses level 32. The maximum os level is 255.
766 </para>
768 <para>
769 If you want Samba to force an election on startup, set the
770 <smbconfoption name="preferred master"/> global option in &smb.conf; to <constant>yes</constant>.
771 Samba will then have a slight advantage over other potential master browsers that are not Preferred Master Browsers.
772 Use this parameter with care, as if you have two hosts (whether they are Windows 9x/Me or
773 NT/200x/XP or Samba) on the same local subnet both set with <smbconfoption name="preferred master"/>
774 to <constant>yes</constant>, then periodically and continually they will force an election in order
775 to become the Local Master Browser.
776 </para>
778 <para>
779 If you want Samba to be a <emphasis>Domain Master Browser</emphasis>, then it is recommended that
780 you also set <smbconfoption name="preferred master"/> to <constant>yes</constant>, because
781 Samba will not become a Domain Master Browser for the whole of your LAN or WAN if it is not also a
782 Local Master Browser on its own broadcast isolated subnet.
783 </para>
785 <para>
786 It is possible to configure two Samba servers to attempt to become the Domain Master Browser for a domain. The first server that comes
787 up will be the Domain Master Browser. All other Samba servers will attempt to become the Domain Master Browser every five minutes. They
788 will find that another Samba server is already the domain master browser and will fail. This provides automatic redundancy, should
789 the current Domain Master Browser fail.
790 </para>
792 </sect2>
794 <sect2>
795 <title>Making Samba the Domain Master</title>
797 <para>
798 The domain master is responsible for collating the browse lists of multiple subnets so browsing can occur between subnets. You can
799 make Samba act as the Domain Master by setting <smbconfoption name="domain master">yes</smbconfoption>
800 in &smb.conf;. By default it will not be a Domain Master.
801 </para>
803 <para>
804 Do not set Samba to be the Domain Master for a workgroup that has the same name as an NT/200x Domain.
805 If Samba is configured to be the Domain Master for a workgroup that is present on the same
806 network as a Windows NT/200x domain that has the same name, network browsing problems will
807 certainly be experienced.
808 </para>
810 <para>
811 When Samba is the Domain Master and the Master Browser, it will listen for master
812 announcements (made roughly every twelve minutes) from Local Master Browsers on
813 other subnets and then contact them to synchronize browse lists.
814 </para>
816 <para>
817 If you want Samba to be the domain master, you should also set the
818 <smbconfoption name="os level"/> high enough to make sure it wins elections, and
819 set <smbconfoption name="preferred master"/> to <constant>yes</constant>, to
820 get Samba to force an election on startup.
821 </para>
823 <para>
824 All servers (including Samba) and clients should be using a WINS server to resolve NetBIOS names. If your
825 clients are only using broadcasting to resolve NetBIOS names, then two things will occur:
826 </para>
828 <orderedlist>
829 <listitem>
830         <para>
831         Local Master Browsers will be unable to find a Domain Master Browser, as they will be looking only on the local subnet.
832         </para>
833 </listitem>
835 <listitem>
836         <para>
837         If a client happens to get hold of a domain-wide browse list and a user attempts to access a
838         host in that list, it will be unable to resolve the NetBIOS name of that host.
839         </para>
840 </listitem>
841 </orderedlist>
843 <para>
844 If, however, both Samba and your clients are using a WINS server, then:
845 </para>
847 <orderedlist>
848 <listitem>
849         <para>
850         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
851         server, the Local Master Browser will receive Samba's IP address as its Domain Master Browser.
852         </para>
853 </listitem>
855 <listitem>
856         <para>
857         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
858         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
859         be able to see that host. 
860         </para>
861 </listitem>
862 </orderedlist>
864 </sect2>
866 <sect2>
867 <title>Note about Broadcast Addresses</title>
869 <para>
870 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
871 does not seem to support a zeros broadcast and you will probably find that browsing and name lookups will not work.
872 </para>
873 </sect2>
875 <sect2>
876 <title>Multiple Interfaces</title>
878 <para>
879 Samba supports machines with multiple network interfaces. If you have multiple interfaces, you will
880 need to use the <smbconfoption name="interfaces"/> option in &smb.conf; to configure them. 
881 </para>
882 </sect2>
883 <sect2>
884 <title>Use of the Remote Announce Parameter</title>
885 <para>
886 The <smbconfoption name="remote announce"/> parameter of 
887 &smb.conf; can be used to forcibly ensure
888 that all the NetBIOS names on a network get announced to a remote network.
889 The syntax of the <smbconfoption name="remote announce"/> parameter is:
890 <smbconfblock>
891 <smbconfoption name="remote announce">a.b.c.d [e.f.g.h] ...</smbconfoption>
892 </smbconfblock>
893 <emphasis>or</emphasis>
894 <smbconfblock>
895 <smbconfoption name="remote announce">a.b.c.d/WORKGROUP [e.f.g.h/WORKGROUP] ...</smbconfoption>
896 </smbconfblock>
898 where:
899 <variablelist>
900         <varlistentry><term><replaceable>a.b.c.d</replaceable> and <replaceable>e.f.g.h</replaceable></term>
901                 <listitem><para>
902 <indexterm><primary>LMB</primary><see>Local Master Browser</see></indexterm>
903 <indexterm><primary>Local Master Browser</primary></indexterm>
904                 is either the LMB (Local Master Browser) IP address or the broadcast address of the remote network.
905                 i.e., the LMB is at 192.168.1.10, or the address could be given as 192.168.1.255 where the netmask
906                 is assumed to be 24 bits (255.255.255.0). When the remote announcement is made to the broadcast
907                 address of the remote network, every host will receive our announcements. This is noisy and therefore
908                 undesirable but may be necessary if we do not know the IP address of the remote LMB.
909                 </para></listitem>
910         </varlistentry>
912         <varlistentry>
913                 <term><replaceable>WORKGROUP</replaceable></term>
914                 <listitem><para>is optional and can be either our own workgroup or that of the remote network. If you use the
915                 workgroup name of the remote network, our NetBIOS machine names will end up looking like
916                 they belong to that workgroup. This may cause name resolution problems and should be avoided.
917                 </para></listitem>
918         </varlistentry>
919 </variablelist>
920 </para>
922 </sect2>
924 <sect2>
925 <title>Use of the Remote Browse Sync Parameter</title>
927 <para>
928 The <smbconfoption name="remote browse sync"/> parameter of 
929 &smb.conf; is used to announce to another LMB that it must synchronize its NetBIOS name list with our
930 Samba LMB. This works only if the Samba server that has this option is
931 simultaneously the LMB on its network segment.
932 </para>
934 <para>
935 The syntax of the <smbconfoption name="remote browse sync"/> parameter is:
937 <smbconfblock>
938 <smbconfoption name="remote browse sync"><replaceable>a.b.c.d</replaceable></smbconfoption>
939 </smbconfblock>
941 where <replaceable>a.b.c.d</replaceable> is either the IP address of the
942 remote LMB or else is the network broadcast address of the remote segment.
943 </para>
945 </sect2>
947 </sect1>
949 <sect1>
950 <title>WINS &smbmdash; The Windows Inter-networking Name Server</title>
952 <para>
953 Use of WINS (either Samba WINS or MS Windows NT Server WINS) is highly
954 recommended. Every NetBIOS machine registers its name together with a
955 name_type value for each of several types of service it has available.
956 It registers its name directly as a unique (the type 0x03) name.
957 It also registers its name if it is running the LanManager compatible
958 server service (used to make shares and printers available to other users)
959 by registering the server (the type 0x20) name.
960 </para>
962 <para>
963 All NetBIOS names are up to 15 characters in length. The name_type variable
964 is added to the end of the name, thus creating a 16 character name. Any
965 name that is shorter than 15 characters is padded with spaces to the 15th
966 character. Thus, all NetBIOS names are 16 characters long (including the
967 name_type information).
968 </para>
970 <para>
971 WINS can store these 16-character names as they get registered. A client
972 that wants to log onto the network can ask the WINS server for a list
973 of all names that have registered the NetLogon service name_type. This saves
974 broadcast traffic and greatly expedites logon processing. Since broadcast
975 name resolution cannot be used across network segments this type of
976 information can only be provided via WINS or via a statically configured
977 <filename>lmhosts</filename> file that must reside on all clients in the
978 absence of WINS.
979 </para>
981 <para>
982 WINS also serves the purpose of forcing browse list synchronization by all
983 LMBs. LMBs must synchronize their browse list with the DMB (Domain Master
984 Browser) and WINS helps the LMB to identify its DMB. By definition this
985 will work only within a single workgroup. Note that the Domain Master Browser
986 has nothing to do with what is referred to as an MS Windows NT Domain. The
987 later is a reference to a security environment while the DMB refers to the
988 master controller for browse list information only.
989 </para>
991 <para>
992 WINS will work correctly only if every client TCP/IP protocol stack
993 has been configured to use the WINS servers. Any client that has not been
994 configured to use the WINS server will continue to use only broadcast-based
995 name registration so WINS may never get to know about it. In any case,
996 machines that have not registered with a WINS server will fail name to address
997 lookup attempts by other clients and will therefore cause workstation access
998 errors.
999 </para>
1001 <para>
1002 To configure Samba as a WINS server just add 
1003 <smbconfoption name="wins support">yes</smbconfoption> to the &smb.conf;
1004 file [global] section.
1005 </para>
1007 <para>
1008 To configure Samba to register with a WINS server just add
1009 <smbconfoption name="wins server">a.b.c.d</smbconfoption>
1010 to your &smb.conf; file <smbconfsection name="[global]"/> section.
1011 </para>
1013 <important><para>
1014 Never use both <smbconfoption name="wins support">yes</smbconfoption> together
1015 with <smbconfoption name="wins server">a.b.c.d</smbconfoption>
1016 particularly not using its own IP address. Specifying both will cause &nmbd; to refuse to start!
1017 </para></important>
1019 <sect2>
1020 <title>WINS Server Configuration</title>
1022 <para>
1023 Either a Samba Server or a Windows NT Server machine may be set up
1024 as a WINS server. To configure a Samba Server to be a WINS server you must
1025 add to the &smb.conf; file on the selected Server the following line to
1026 the <smbconfsection name="[global]"/> section:
1027 </para>
1029 <para>
1030 <smbconfblock>
1031 <smbconfoption name="wins support">yes</smbconfoption>
1032 </smbconfblock>
1033 </para>
1035 <para>
1036 Versions of Samba prior to 1.9.17 had this parameter default to
1037 yes. If you have any older versions of Samba on your network it is
1038 strongly suggested you upgrade to a recent version, or at the very
1039 least set the parameter to <quote>no</quote> on all these machines.
1040 </para>
1042 <para>
1043 Machines configured with <smbconfoption name="wins support">yes</smbconfoption> will keep a list of 
1044 all NetBIOS names registered with them, acting as a DNS for NetBIOS names.
1045 </para>
1047 <para>
1048 It is strongly recommended to set up only one WINS server. Do not set the
1049 <smbconfoption name="wins support">yes</smbconfoption> option on more than one Samba 
1050 server.
1051 </para>
1053 <para>
1054 <indexterm><primary>replication</primary><secondary>WINS</secondary></indexterm>
1055 To configure Windows NT/200x Server as a WINS server, install and configure
1056 the WINS service. See the Windows NT/200x documentation for details.
1057 Windows NT/200x WINS servers can replicate to each other, allowing more
1058 than one to be set up in a complex subnet environment. As Microsoft
1059 refuses to document the replication protocols, Samba cannot currently
1060 participate in these replications. It is possible in the future that
1061 a Samba-to-Samba WINS replication protocol may be defined, in which
1062 case more than one Samba machine could be set up as a WINS server.
1063 Currently only one Samba server should have the 
1064 <smbconfoption name="wins support">yes</smbconfoption> parameter set.
1065 </para>
1067 <para>
1068 After the WINS server has been configured, you must ensure that all
1069 machines participating on the network are configured with the address
1070 of this WINS server. If your WINS server is a Samba machine, fill in
1071 the Samba machine IP address in the <guilabel>Primary WINS Server</guilabel> field of
1072 the <guilabel>Control Panel->Network->Protocols->TCP->WINS Server</guilabel> dialogs
1073 in Windows 9x/Me or Windows NT/200x. To tell a Samba server the IP address
1074 of the WINS server, add the following line to the <smbconfsection name="[global]"/> section of
1075 all &smb.conf; files:
1076 </para>
1078 <para>
1079 <smbconfblock>
1080 <smbconfoption name="wins server">&lt;name or IP address&gt;</smbconfoption>
1081 </smbconfblock>
1082 </para>
1084 <para>
1085 where &lt;name or IP address&gt; is either the DNS name of the WINS server
1086 machine or its IP address.
1087 </para>
1089 <para>
1090 This line must not be set in the &smb.conf; file of the Samba
1091 server acting as the WINS server itself. If you set both the
1092 <smbconfoption name="wins support">yes</smbconfoption> option and the 
1093 <smbconfoption name="wins server">&lt;name&gt;</smbconfoption> option then
1094 <command>nmbd</command> will fail to start.
1095 </para>
1097 <para>
1098 There are two possible scenarios for setting up cross-subnet browsing.
1099 The first details setting up cross-subnet browsing on a network containing
1100 Windows 9x/Me, Samba and Windows NT/200x machines that are not configured as
1101 part of a Windows NT Domain. The second details setting up cross-subnet
1102 browsing on networks that contain NT Domains.
1103 </para>
1105 </sect2>
1107 <sect2>
1108 <title>WINS Replication</title>
1110 <para>
1111 <indexterm><primary>replication</primary><secondary>WINS</secondary></indexterm>
1112 Samba-3 permits WINS replication through the use of the <filename>wrepld</filename> utility.
1113 This tool is not currently capable of being used as it is still in active development.
1114 As soon as this tool becomes moderately functional, we will prepare man pages and enhance this
1115 section of the documentation to provide usage and technical details.
1116 </para>
1118 </sect2>
1119 <sect2>
1120 <title>Static WINS Entries</title>
1122 <para>
1123 Adding static entries to your Samba WINS server is actually fairly easy.
1124 All you have to do is add a line to <filename>wins.dat</filename>, typically
1125 located in <filename class="directory">/usr/local/samba/var/locks</filename> or
1126 <filename>/var/run/samba</filename>.
1127 </para>
1129 <para>
1130 Entries in <filename>wins.dat</filename> take the form of:
1132 <programlisting>
1133 "NAME#TYPE" TTL ADDRESS+ FLAGS
1134 </programlisting>
1136 where NAME is the NetBIOS name, TYPE is the NetBIOS type, TTL is the
1137 time-to-live as an absolute time in seconds, ADDRESS+ is one or more
1138 addresses corresponding to the registration and FLAGS are the NetBIOS
1139 flags for the registration.
1140 </para>
1142 <para>
1143 A typical dynamic entry looks like this:
1144 <programlisting>
1145 "MADMAN#03" 1055298378 192.168.1.2 66R
1146 </programlisting>
1148 To make it static, all that has to be done is set the TTL to 0, like this:
1150 <programlisting>
1151 "MADMAN#03" 0 192.168.1.2 66R
1152 </programlisting>
1153 </para>
1155 <para>
1156 Though this method works with early Samba-3 versions, there is a
1157 possibility that it may change in future versions if WINS replication
1158 is added.
1159 </para>
1161 </sect2>
1162 </sect1>
1164 <sect1>
1165 <title>Helpful Hints</title>
1167 <para>
1168 The following hints should be carefully considered as they are stumbling points
1169 for many new network administrators.
1170 </para>
1172 <sect2>
1173 <title>Windows Networking Protocols</title>
1175 <para>
1176 A common cause of browsing problems results from installing more than
1177 one protocol on an MS Windows machine.
1178 </para>
1180 <warning><para>
1181 Do not use more than one protocol on MS Windows clients.
1182 </para></warning>
1184 <para>
1185 Every NetBIOS machine takes part in a process of electing the LMB (and DMB)
1186 every 15 minutes. A set of election criteria is used to determine the order
1187 of precedence for winning this election process. A machine running Samba or
1188 Windows NT will be biased so the most suitable machine will predictably
1189 win and thus retain its role.
1190 </para>
1192 <para>
1193 The election process is <quote>fought out</quote> so to speak over every NetBIOS network
1194 interface. In the case of a Windows 9x/Me machine that has both TCP/IP and IPX
1195 installed and has NetBIOS enabled over both protocols, the election will be
1196 decided over both protocols. As often happens, if the Windows 9x/Me machine is
1197 the only one with both protocols then the LMB may be won on the NetBIOS
1198 interface over the IPX protocol. Samba will then lose the LMB role as Windows
1199 9x/Me will insist it knows who the LMB is. Samba will then cease to function
1200 as an LMB and thus browse list operation on all TCP/IP-only machines will
1201 fail.
1202 </para>
1204 <para>
1205 Windows 95, 98, 98se, and Me are referred to generically as Windows 9x/Me.
1206 The Windows NT4, 200x, and XP use common protocols. These are roughly
1207 referred to as the Windows NT family, but it should be recognized that 2000 and
1208 XP/2003 introduce new protocol extensions that cause them to behave 
1209 differently from MS Windows NT4. Generally, where a server does not support
1210 the newer or extended protocol, these will fall back to the NT4 protocols.
1211 </para>
1213 <para>
1214 The safest rule of all to follow is: use only one protocol!
1215 </para>
1217 </sect2>
1219 <sect2>
1220 <title>Name Resolution Order</title>
1222 <para>
1223 Resolution of NetBIOS names to IP addresses can take place using a number
1224 of methods. The only ones that can provide NetBIOS name_type information
1225 are:
1226 </para>
1228 <itemizedlist>
1229         <listitem><para>WINS &smbmdash; the best tool.</para></listitem>
1230         <listitem><para>LMHOSTS &smbmdash; static and hard to maintain.</para></listitem>
1231         <listitem><para>Broadcast &smbmdash; uses UDP and cannot resolve names across remote segments.</para></listitem>
1232 </itemizedlist>
1234 <para>
1235 Alternative means of name resolution include:
1236 </para>
1237 <itemizedlist>
1238 <listitem><para>Static <filename>/etc/hosts</filename> &smbmdash;  hard to maintain, and lacks name_type info.</para></listitem>
1239 <listitem><para>DNS &smbmdash; is a good choice but lacks essential name_type info.</para></listitem>
1240 </itemizedlist>
1242 <para>
1243 Many sites want to restrict DNS lookups and avoid broadcast name
1244 resolution traffic. The <parameter>name resolve order</parameter> parameter is of great help here.
1245 The syntax of the <parameter>name resolve order</parameter> parameter is:
1246 <smbconfblock>
1247 <smbconfoption name="name resolve order">wins lmhosts bcast host</smbconfoption>
1248 </smbconfblock>
1249 <emphasis>or</emphasis>
1250 <smbconfblock>
1251 <smbconfoption name="name resolve order">wins lmhosts   (eliminates bcast and host)</smbconfoption>
1252 </smbconfblock>
1253 The default is:
1254 <smbconfblock>
1255 <smbconfoption name="name resolve order">host lmhost wins bcast</smbconfoption>
1256 </smbconfblock>
1257 where <quote>host</quote> refers to the native methods used by the UNIX system
1258 to implement the gethostbyname() function call. This is normally
1259 controlled by <filename>/etc/host.conf</filename>, <filename>/etc/nsswitch.conf</filename> and <filename>/etc/resolv.conf</filename>.
1260 </para>
1261 </sect2>
1262 </sect1>
1264 <sect1>
1265 <title>Technical Overview of Browsing</title>
1267 <para>
1268 SMB networking provides a mechanism by which clients can access a list
1269 of machines in a network, a so-called <smbconfoption name="browse list"/>. This list
1270 contains machines that are ready to offer file and/or print services
1271 to other machines within the network. Thus it does not include
1272 machines that aren't currently able to do server tasks. The browse
1273 list is heavily used by all SMB clients. Configuration of SMB
1274 browsing has been problematic for some Samba users, hence this
1275 document.
1276 </para>
1278 <para>
1279 MS Windows 2000 and later versions, as with Samba-3 and later versions, can be
1280 configured to not use NetBIOS over TCP/IP. When configured this way,
1281 it is imperative that name resolution (using DNS/LDAP/ADS) be correctly
1282 configured and operative. Browsing will not work if name resolution
1283 from SMB machine names to IP addresses does not function correctly.
1284 </para>
1286 <para>
1287 Where NetBIOS over TCP/IP is enabled, use of a WINS server is highly
1288 recommended to aid the resolution of NetBIOS (SMB) names to IP addresses.
1289 WINS allows remote segment clients to obtain NetBIOS name_type information
1290 that cannot be provided by any other means of name resolution.
1291 </para>
1293 <sect2>
1294 <title>Browsing Support in Samba</title>
1296 <para>
1297 Samba facilitates browsing. The browsing is supported by &nmbd;
1298 and is also controlled by options in the &smb.conf; file.
1299 Samba can act as a local browse master for a workgroup and the ability
1300 to support domain logons and scripts is now available.
1301 </para>
1303 <para>
1304 Samba can also act as a Domain Master Browser for a workgroup. This
1305 means that it will collate lists from Local Master Browsers into a
1306 wide area network server list. In order for browse clients to
1307 resolve the names they may find in this list, it is recommended that
1308 both Samba and your clients use a WINS server.
1309 </para>
1311 <para>
1312 Do not set Samba to be the Domain Master for a workgroup that has the same
1313 name as an NT Domain. On each wide area network, you must only ever have one
1314 Domain Master Browser per workgroup, regardless of whether it is NT, Samba
1315 or any other type of domain master that is providing this service.
1316 </para>
1318 <note><para>
1319 <command>nmbd</command> can be configured as a WINS server, but it is not
1320 necessary to specifically use Samba as your WINS server. MS Windows
1321 NT4, Server or Advanced Server 200x can be configured as
1322 your WINS server. In a mixed NT/200x server and Samba environment on
1323 a Wide Area Network, it is recommended that you use the Microsoft
1324 WINS server capabilities. In a Samba-only environment, it is
1325 recommended that you use one and only one Samba server as the WINS server.
1326 </para></note>
1328 <para>
1329 To get browsing to work you need to run nmbd as usual, but will need
1330 to use the <smbconfoption name="workgroup"/> option in &smb.conf;
1331 to control what workgroup Samba becomes a part of.
1332 </para>
1334 <para>
1335 Samba also has a useful option for a Samba server to offer itself for
1336 browsing on another subnet. It is recommended that this option is only
1337 used for <quote>unusual</quote> purposes: announcements over the Internet, for
1338 example. See <smbconfoption name="remote announce"/> in the 
1339 &smb.conf; man page. 
1340 </para>
1341 </sect2>
1343 <sect2>
1344 <title>Problem Resolution</title>
1346 <para>
1347 If something does not work, the <filename>log.nmbd</filename> file will help
1348 to track down the problem. Try a <smbconfoption name="log level"></smbconfoption> of 2 or 3 for finding
1349 problems. Also note that the current browse list usually gets stored
1350 in text form in a file called <filename>browse.dat</filename>.
1351 </para>
1353 <para>
1354 If it does not work, you should still be able to
1355 type the server name as <filename>\\SERVER</filename> in <command>filemanager</command>, then
1356 press enter and <command>filemanager</command> should display the list of available shares.
1357 </para>
1359 <para>
1360 Some people find browsing fails because they do not have the global
1361 <smbconfoption name="guest account"/> set to a valid account. Remember that the
1362 IPC$ connection that lists the shares is done as guest and, thus, you must have a valid guest account.
1363 </para>
1365 <para>
1366 MS Windows 2000 and later (as with Samba) can be configured to disallow
1367 anonymous (i.e., guest account) access to the IPC$ share. In that case, the
1368 MS Windows 2000/XP/2003 machine acting as an SMB/CIFS client will use the
1369 name of the currently logged-in user to query the IPC$ share. MS Windows
1370 9x/Me clients are not able to do this and thus will not be able to browse
1371 server resources.
1372 </para>
1374 <para>
1375 The other big problem people have is that their broadcast address,
1376 netmask or IP address is wrong (specified with the <smbconfoption name="interfaces"></smbconfoption> option
1377 in &smb.conf;)
1378 </para>
1379 </sect2>
1381 <sect2>
1382 <title>Cross-Subnet Browsing</title>
1384 <para>
1385 <indexterm><primary>replication</primary><secondary>browse lists</secondary></indexterm>
1386 Since the release of Samba 1.9.17 (alpha1), Samba has supported the
1387 replication of browse lists across subnet boundaries. This section
1388 describes how to set this feature up in different settings.
1389 </para>
1391 <para>
1392 To see browse lists that span TCP/IP subnets (i.e., networks separated
1393 by routers that do not pass broadcast traffic), you must set up at least
1394 one WINS server. The WINS server acts as a DNS for NetBIOS names. This will
1395 allow NetBIOS name-to-IP address translation to be completed by a direct
1396 query of the WINS server. This is done via a directed UDP packet on
1397 port 137 to the WINS server machine. The WINS server avoids the necessity
1398 of default NetBIOS name-to-IP address translation, which is done
1399 using UDP broadcasts from the querying machine. This means that machines
1400 on one subnet will not be able to resolve the names of machines on
1401 another subnet without using a WINS server.
1402 </para>
1404 <para>
1405 Remember, for browsing across subnets to work correctly, all machines,
1406 be they Windows 95, Windows NT or Samba servers, must have the IP address
1407 of a WINS server given to them by a DHCP server, or by manual configuration 
1408 (for Windows 9x/Me and Windows NT/200x/XP, this is in the TCP/IP Properties, under Network 
1409 settings); for Samba, this is in the &smb.conf; file.
1410 </para>
1412 <sect3>
1413 <title>Behavior of Cross-Subnet Browsing</title>
1415 <para>
1416 Cross-subnet Browsing is a complicated dance, containing multiple
1417 moving parts. It has taken Microsoft several years to get the code
1418 that achieves this correct, and Samba lags behind in some areas.
1419 Samba is capable of cross-subnet browsing when configured correctly.
1420 </para>
1422 <para>
1423 Consider a network set up as in <link linkend="browsing1">Cross-Subnet Browsing Example</link>.
1424 </para>
1426 <image id="browsing1">
1427         <imagedescription>Cross-Subnet Browsing Example.</imagedescription>
1428         <imagefile scale="40">browsing1</imagefile>
1429 </image>
1430         
1431 <para>
1432 This consists of 3 subnets (1, 2, 3) connected by two routers
1433 (R1, R2) which do not pass broadcasts. Subnet 1 has five machines
1434 on it, subnet 2 has four machines, subnet 3 has four machines. Assume
1435 for the moment that all machines are configured to be in the
1436 same workgroup (for simplicity's sake). Machine N1_C on subnet 1
1437 is configured as Domain Master Browser (i.e., it will collate the
1438 browse lists for the workgroup). Machine N2_D is configured as
1439 WINS server and all the other machines are configured to register
1440 their NetBIOS names with it.
1441 </para>
1443 <para>
1444 As these machines are booted up, elections for master browsers
1445 will take place on each of the three subnets. Assume that machine
1446 N1_C wins on subnet 1, N2_B wins on subnet 2, and N3_D wins on
1447 subnet 3. These machines are known as Local Master Browsers for
1448 their particular subnet. N1_C has an advantage in winning as the
1449 Local Master Browser on subnet 1 as it is set up as Domain Master
1450 Browser.
1451 </para>
1453 <para>
1454 On each of the three networks, machines that are configured to 
1455 offer sharing services will broadcast that they are offering
1456 these services. The Local Master Browser on each subnet will
1457 receive these broadcasts and keep a record of the fact that
1458 the machine is offering a service. This list of records is
1459 the basis of the browse list. For this case, assume that
1460 all the machines are configured to offer services, so all machines
1461 will be on the browse list.
1462 </para>
1464 <para>
1465 For each network, the Local Master Browser on that network is
1466 considered <quote>authoritative</quote> for all the names it receives via
1467 local broadcast. This is because a machine seen by the Local Master
1468 Browser via a local broadcast must be on the same network as the
1469 Local Master Browser and thus is a <quote>trusted</quote>
1470 and <quote>verifiable</quote> resource. Machines on other networks that
1471 the Local Master Browsers learn about when collating their
1472 browse lists have not been directly seen. These records are
1473 called <quote>non-authoritative.</quote>
1474 </para>
1476 <para>
1477 At this point the browse lists appear as shown in <link linkend="browsubnet">the next example</link> (these are 
1478 the machines you would see in your network neighborhood if you looked in it on a particular network right now).
1479 </para>
1481 <para>
1482 <table frame="all" id="browsubnet">
1483         <title>Browse Subnet Example 1</title>          
1484         <tgroup align="left" cols="3">
1485         <thead>
1486                 <row><entry>Subnet</entry><entry>Browse Master</entry><entry>List</entry></row>
1487         </thead>
1489         <tbody>
1490                 <row><entry>Subnet1</entry><entry>N1_C</entry><entry>N1_A, N1_B, N1_C, N1_D, N1_E</entry></row>
1491                 <row><entry>Subnet2</entry><entry>N2_B</entry><entry>N2_A, N2_B, N2_C, N2_D</entry></row>
1492                 <row><entry>Subnet3</entry><entry>N3_D</entry><entry>N3_A, N3_B, N3_C, N3_D</entry></row>
1493         </tbody>
1494         </tgroup>
1495 </table>
1496 </para>
1498 <para>
1499 At this point all the subnets are separate, and no machine is seen across any of the subnets.
1500 </para>
1502 <para>
1503 Now examine subnet 2. As soon as N2_B has become the Local
1504 Master Browser it looks for a Domain Master Browser with which to synchronize
1505 its browse list. It does this by querying the WINS server
1506 (N2_D) for the IP address associated with the NetBIOS name 
1507 WORKGROUP&lt;1B&gt;. This name was registered by the Domain Master
1508 Browser (N1_C) with the WINS server as soon as it was started.
1509 </para>
1511 <para>
1512 Once N2_B knows the address of the Domain Master Browser, it
1513 tells it that is the Local Master Browser for subnet 2 by
1514 sending a <emphasis>MasterAnnouncement</emphasis> packet as a UDP port 138 packet.
1515 It then synchronizes with it by doing a <emphasis>NetServerEnum2</emphasis> call. This
1516 tells the Domain Master Browser to send it all the server
1517 names it knows about. Once the Domain Master Browser receives
1518 the <emphasis>MasterAnnouncement</emphasis> packet, it schedules a synchronization
1519 request to the sender of that packet. After both synchronizations
1520 are complete the browse lists look as shown in <link linkend="brsbex">following example</link>:
1521 </para>
1523 <table frame="all" id="brsbex">
1524         <title>Browse Subnet Example 2</title>          
1525         <tgroup cols="3">
1526                 <colspec align="left"/>
1527                 <colspec align="left"/>
1528                 <colspec align="justify" colwidth="1*"/>
1529         <thead>
1530                 <row><entry>Subnet</entry><entry>Browse Master</entry><entry>List</entry></row>
1531         </thead>
1533         <tbody>
1534                 <row><entry>Subnet1</entry><entry>N1_C</entry><entry>N1_A, N1_B, N1_C, N1_D, N1_E,
1535 N2_A(*), N2_B(*), N2_C(*), N2_D(*)</entry></row>
1536                 <row><entry>Subnet2</entry><entry>N2_B</entry><entry>N2_A, N2_B, N2_C, N2_D, N1_A(*), 
1537 N1_B(*), N1_C(*), N1_D(*), N1_E(*)</entry></row>
1538                 <row><entry>Subnet3</entry><entry>N3_D</entry><entry>N3_A, N3_B, N3_C, N3_D</entry></row>
1539         </tbody>
1540         </tgroup>
1541 </table>
1543 <para>
1544 Servers with an (*) after them are non-authoritative names.
1545 </para>
1547 <para>
1548 At this point users looking in their network neighborhood on
1549 subnets 1 or 2 will see all the servers on both, users on
1550 subnet 3 will still only see the servers on their own subnet.
1551 </para>
1553 <para>
1554 The same sequence of events that occurred for N2_B now occurs
1555 for the Local Master Browser on subnet 3 (N3_D). When it
1556 synchronizes browse lists with the Domain Master Browser (N1_A)
1557 it gets both the server entries on subnet 1, and those on
1558 subnet 2. After N3_D has synchronized with N1_C and vica versa,
1559 the browse lists will appear as shown in <link linkend="brsex2">following example</link>.
1560 </para>
1562 <table frame="all" id="brsex2">
1563         <title>Browse Subnet Example 3</title>          
1564         <tgroup cols="3" align="left">
1565                 <colspec align="left"/>
1566                 <colspec align="left"/>
1567                 <colspec align="justify" colwidth="1*"/>
1569         <thead>
1570                 <row><entry>Subnet</entry><entry>Browse Master</entry><entry>List</entry></row>
1571         </thead>
1573         <tbody>
1574                 <row><entry>Subnet1</entry><entry>N1_C</entry><entry>N1_A, N1_B, N1_C, N1_D, N1_E, 
1575 N2_A(*), N2_B(*), N2_C(*), N2_D(*), N3_A(*), N3_B(*), N3_C(*), N3_D(*)</entry></row>
1576                 <row><entry>Subnet2</entry><entry>N2_B</entry><entry>N2_A, N2_B, N2_C, N2_D, N1_A(*), 
1577 N1_B(*), N1_C(*), N1_D(*), N1_E(*)</entry></row>
1578                 <row><entry>Subnet3</entry><entry>N3_D</entry><entry>N3_A, N3_B, N3_C, N3_D, N1_A(*), 
1579 N1_B(*), N1_C(*), N1_D(*), N1_E(*), N2_A(*), N2_B(*), N2_C(*), N2_D(*)</entry></row>
1580         </tbody>
1581         </tgroup>
1582 </table>
1584 <para>
1585 Servers with an (*) after them are non-authoritative names.
1586 </para>
1588 <para>
1589 At this point, users looking in their network neighborhood on
1590 subnets 1 or 3 will see all the servers on all subnets, while users on
1591 subnet 2 will still only see the servers on subnets 1 and 2, but not 3.
1592 </para>
1594 <para>
1595 Finally, the Local Master Browser for subnet 2 (N2_B) will sync again
1596 with the Domain Master Browser (N1_C) and will receive the missing
1597 server entries. Finally, as when a steady state (if no machines
1598 are removed or shut off) has been achieved, the browse lists will appear
1599 as shown in <link linkend="brsex3">example below</link>.
1600 </para>
1602 <table frame="all" id="brsex3">
1603         <title>Browse Subnet Example 4</title>          
1604         <tgroup cols="3" align="left">
1605                 <colspec align="left"/>
1606                 <colspec align="left"/>
1607                 <colspec align="justify" colwidth="1*"/>
1609         <thead>
1610                 <row><entry>Subnet</entry><entry>Browse Master</entry><entry>List</entry></row>
1611         </thead>
1613         <tbody>
1614                 <row><entry>Subnet1</entry><entry>N1_C</entry><entry>N1_A, N1_B, N1_C, N1_D, N1_E,
1615 N2_A(*), N2_B(*), N2_C(*), N2_D(*), N3_A(*), N3_B(*), 
1616 N3_C(*), N3_D(*)</entry></row>
1617                 <row><entry>Subnet2</entry><entry>N2_B</entry><entry>N2_A, N2_B, N2_C, N2_D, N1_A(*), 
1618 N1_B(*), N1_C(*), N1_D(*), N1_E(*), N3_A(*), N3_B(*), 
1619 N3_C(*), N3_D(*)</entry></row>
1620                 <row><entry>Subnet3</entry><entry>N3_D</entry><entry>N3_A, N3_B, N3_C, N3_D, N1_A(*), 
1621 N1_B(*), N1_C(*), N1_D(*), N1_E(*), N2_A(*), N2_B(*), 
1622 N2_C(*), N2_D(*)</entry></row>
1623         </tbody>
1624         </tgroup>
1625 </table>
1627 <para>
1628 Servers with an (*) after them are non-authoritative names.
1629 </para>
1631 <para>
1632 Synchronizations between the Domain Master Browser and Local
1633 Master Browsers will continue to occur, but this should remain a
1634 steady state operation.
1635 </para>
1637 <para>
1638 If either router R1 or R2 fails, the following will occur:
1639 </para>
1641 <orderedlist>
1642 <listitem>
1643         <para>
1644         Names of computers on each side of the inaccessible network fragments
1645         will be maintained for as long as 36 minutes in the network neighborhood
1646         lists.
1647         </para>
1648 </listitem>
1650 <listitem>
1651         <para>
1652         Attempts to connect to these inaccessible computers will fail, but the
1653         names will not be removed from the network neighborhood lists.
1654         </para>
1655 </listitem>
1657 <listitem>
1658         <para>
1659         If one of the fragments is cut off from the WINS server, it will only
1660         be able to access servers on its local subnet using subnet-isolated
1661         broadcast NetBIOS name resolution. The effects are similar to that of
1662         losing access to a DNS server.
1663         </para>
1664 </listitem>
1665 </orderedlist>
1666 </sect3>
1667 </sect2>
1668 </sect1>
1670 <sect1>
1671 <title>Common Errors</title>
1673 <para>
1674 Many questions are asked on the mailing lists regarding browsing. The majority of browsing
1675 problems originate from incorrect configuration of NetBIOS name resolution. Some are of
1676 particular note.
1677 </para>
1679 <sect2>
1680 <title>How Can One Flush the Samba NetBIOS Name Cache without Restarting Samba?</title>
1682 <para>
1683 <indexterm><primary>flush name cache</primary></indexterm>
1684 Samba's <command>nmbd</command> process controls all browse list handling. Under normal circumstances it is
1685 safe to restart <command>nmbd</command>. This will effectively flush the Samba NetBIOS name cache and cause it
1686 to be rebuilt. This does not make certain that a rogue machine name will not re-appear
1687 in the browse list. When <command>nmbd</command> is taken out of service, another machine on the network will
1688 become the Browse Master. This new list may still have the rogue entry in it. If you really
1689 want to clear a rogue machine from the list, every machine on the network will need to be
1690 shut down and restarted after all machines are down. Failing a complete restart, the only
1691 other thing you can do is wait until the entry times out and is then flushed from the list.
1692 This may take a long time on some networks (perhaps months).
1693 </para>
1695 </sect2>
1697 <sect2>
1698         <title>Server Resources Can Not Be Listed</title>
1700 <para><quote>My Client Reports <quote>This server is not configured to list shared resources</quote></quote></para>
1702                 
1703 <para>
1704 Your guest account is probably invalid for some reason. Samba uses the
1705 guest account for browsing in <command>smbd</command>. Check that your guest account is
1706 valid.
1707 </para>
1709 <para>Also see <smbconfoption name="guest account"/> in the &smb.conf; man page.</para>
1711 </sect2>
1713 <sect2>
1714         <title>I get an <errorname>`Unable to browse the network'</errorname> error</title>
1716         <para>This error can have multiple causes:
1717 <indexterm><primary>browsing problems</primary></indexterm>
1718         </para>
1719         
1720         <itemizedlist>
1721                 <listitem><para>There is no Local Master Browser. Configure &nmbd; 
1722                         or any other machine to serve as Local Master Browser.</para></listitem>
1723                 <listitem><para>You cannot log onto the machine that is the local master 
1724                         browser. Can you logon to it as a guest user? </para></listitem>
1725                 <listitem><para>There is no IP connectivity to the Local Master Browser. 
1726                         Can you reach it by broadcast?</para></listitem>
1727 </itemizedlist>
1728 </sect2>
1730 <sect2>
1731 <title>Browsing of Shares and Directories is Very Slow</title>
1733 <para><quote>
1734 <indexterm><primary>slow browsing</primary></indexterm>
1735 There are only two machines on a test network. One a Samba server, the other a Windows XP machine.
1736 Authentication and logons work perfectly, but when I try to explore shares on the Samba server, the
1737 Windows XP client becomes unresponsive. Sometimes it does not respond for some minutes. Eventually,
1738 Windows Explorer will respond and displays files and directories without problem.
1739 display file and directory.</quote>
1740 </para>
1742 <para><quote>
1743 But, the share is immediately available from a command shell (<command>cmd</command>, followed by 
1744 exploration with dos command. Is this a Samba problem or is it a Windows problem? How can I solve this?
1745 </quote></para>
1747 <para>
1748 Here are a few possibilities:
1749 </para>
1751 <variablelist>
1752         <varlistentry>
1753                 <term>Bad Networking Hardware</term>
1754                 <listitem><para>
1755 <indexterm><primary>bad hardware</primary></indexterm>
1756 <indexterm><primary>WebClient</primary></indexterm>
1757                 Most common defective hardware problems center around low cost or defective HUBs, routers,
1758                 Network Interface Controllers (NICs) and bad wiring. If one piece of hardware is defective
1759                 the whole network may suffer. Bad networking hardware can cause data corruption. Most bad
1760                 networking hardware problems are accompanied by an increase in apparent network traffic,
1761                 but not all.
1762                 </para></listitem>
1763         </varlistentry>
1764         
1765         <varlistentry>
1766                 <term>The Windows XP WebClient</term>
1767                 <listitem><para>
1768                 A number of sites have reported similar slow network browsing problems and found that when
1769                 the WebClient service is turned off, the problem disappears. This is certainly something
1770                 that should be explored as it is a simple solution &smbmdash; if it works.
1771                 </para></listitem>
1772         </varlistentry>
1773         
1774         <varlistentry>
1775                 <term>Inconsistent WINS Configuration</term>
1776                 <listitem><para>
1777                 This type of problem is common when one client is configured to use a WINS server (that is
1778                 a TCP/IP configuration setting) and there is no WINS server on the network. Alternately,
1779                 this will happen is there is a WINS server and Samba is not configured to use it. The use of
1780                 WINS is highly recommended if the network is using NetBIOS over TCP/IP protocols. If use
1781                 of NetBIOS over TCP/IP is disabled on all clients, Samba should not be configured as a WINS
1782                 server neither should it be configured to use one.
1783                 </para></listitem>
1784         </varlistentry>
1785         
1786         <varlistentry>
1787                 <term>Incorrect DNS Configuration</term>
1788                 <listitem><para>
1789                 If use of NetBIOS over TCP/IP is disabled, Active Directory is in use and the DNS server
1790                 has been incorrectly configured. Refer <link linkend="adsdnstech">DNS and Active Directory</link> for more information.
1791                 </para></listitem>
1792         </varlistentry>
1793 </variablelist>
1795 </sect2>
1796 </sect1>
1797 </chapter>