Docbook XML conversion: manpages
[Samba/wip.git] / docs / docbook / projdoc / NetworkBrowsing.sgml
blob29768ea42ae809fa4ae887fd0d5eac8776d49ece
1 <chapter id="NetworkBrowsing">
2 <chapterinfo>
3 &author.jht;
4 <pubdate>July 5, 1998</pubdate>
5 <pubdate>Updated: April 21, 2003</pubdate>
6 </chapterinfo>
8 <title>Samba / MS Windows Network Browsing Guide</title>
10 <para>
11 This document contains detailed information as well as a fast track guide to
12 implementing browsing across subnets and / or across workgroups (or domains).
13 WINS is the best tool for resolution of NetBIOS names to IP addesses. WINS is
14 NOT involved in browse list handling except by way of name to address resolution.
15 </para>
17 <note><para>
18 MS Windows 2000 and later can be configured to operate with NO NetBIOS
19 over TCP/IP. Samba-3 and later also supports this mode of operation.
20 When the use of NetBIOS over TCP/IP has been disabled then the primary
21 means for resolution of MS Windows machine names is via DNS and Active Directory.
22 The following information assumes that your site is running NetBIOS over TCP/IP.
23 </para></note>
25 <sect1>
26 <title>What is Browsing?</title>
28 <para>
29 To most people browsing means that they can see the MS Windows and Samba servers
30 in the Network Neighborhood, and when the computer icon for a particular server is
31 clicked, it opens up and shows the shares and printers available on the target server.
32 </para>
34 <para>
35 What seems so simple is in fact a very complex interaction of different technologies.
36 The technologies (or methods) employed in making all of this work includes:
37 </para>
39 <simplelist>
40 <member>MS Windows machines register their presence to the network</member>
41 <member>Machines announce themselves to other machines on the network</member>
42 <member>One or more machine on the network collates the local announcements</member>
43 <member>The client machine finds the machine that has the collated list of machines</member>
44 <member>The client machine is able to resolve the machine names to IP addresses</member>
45 <member>The client machine is able to connect to a target machine</member>
46 </simplelist>
48 <para>
49 The samba application that controls/manages browse list management and name resolution is
50 called <filename>nmbd</filename>. The configuration parameters involved in nmbd's operation are:
51 </para>
53 <para><programlisting>
54 Browsing options:
55 -----------------
56 * os level
57 lm announce
58 lm interval
59 * preferred master
60 * local master
61 * domain master
62 browse list
63 enhanced browsing
65 Name Resolution Method:
66 -----------------------
67 * name resolve order
69 WINS options:
70 -------------
71 dns proxy
72 wins proxy
73 * wins server
74 * wins support
75 wins hook
76 </programlisting></para>
78 <para>
79 WINS Server and WINS Support are mutually exclusive options. Those marked with an '*' are
80 the only options that commonly MAY need to be modified. Even if not one of these parameters
81 is set nmbd will still do it's job.
82 </para>
83 </sect1>
85 <sect1>
86 <title>Discussion</title>
88 <para>
89 Firstly, all MS Windows networking is based on SMB (Server Message
90 Block) based messaging. SMB messaging may be implemented using NetBIOS or
91 without NetBIOS. Samba implements NetBIOS by encapsulating it over TCP/IP.
92 MS Windows products can do likewise. NetBIOS based networking uses broadcast
93 messaging to affect browse list management. When running NetBIOS over
94 TCP/IP this uses UDP based messaging. UDP messages can be broadcast or unicast.
95 </para>
97 <para>
98 Normally, only unicast UDP messaging can be forwarded by routers. The
99 <command>remote announce</command>
100 parameter to smb.conf helps to project browse announcements
101 to remote network segments via unicast UDP. Similarly, the
102 <command>remote browse sync</command> parameter of <filename>smb.conf</filename>
103 implements browse list collation using unicast UDP.
104 </para>
106 <para>
107 Secondly, in those networks where Samba is the only SMB server technology
108 wherever possible <filename>nmbd</filename> should be configured on one (1) machine as the WINS
109 server. This makes it easy to manage the browsing environment. If each network
110 segment is configured with it's own Samba WINS server, then the only way to
111 get cross segment browsing to work is by using the
112 <command>remote announce</command> and the <command>remote browse sync</command>
113 parameters to your <filename>smb.conf</filename> file.
114 </para>
116 <para>
117 If only one WINS server is used for an entire multi-segment network then
118 the use of the <command>remote announce</command> and the
119 <command>remote browse sync</command> parameters should NOT be necessary.
120 </para>
122 <para>
123 As of Samba 3 WINS replication is being worked on. The bulk of the code has
124 been committed, but it still needs maturation.
125 </para>
127 <para>
128 Right now samba WINS does not support MS-WINS replication. This means that
129 when setting up Samba as a WINS server there must only be one <filename>nmbd</filename> configured
130 as a WINS server on the network. Some sites have used multiple Samba WINS
131 servers for redundancy (one server per subnet) and then used
132 <command>remote browse sync</command> and <command>remote announce</command>
133 to affect browse list collation across all
134 segments. Note that this means clients will only resolve local names,
135 and must be configured to use DNS to resolve names on other subnets in
136 order to resolve the IP addresses of the servers they can see on other
137 subnets. This setup is not recommended, but is mentioned as a practical
138 consideration (ie: an 'if all else fails' scenario).
139 </para>
141 <para>
142 Lastly, take note that browse lists are a collection of unreliable broadcast
143 messages that are repeated at intervals of not more than 15 minutes. This means
144 that it will take time to establish a browse list and it can take up to 45
145 minutes to stabilise, particularly across network segments.
146 </para>
148 </sect1>
150 <sect1>
151 <title>How Browsing Functions</title>
153 <para>
154 As stated above, MS Windows machines register their NetBIOS names
155 (ie: the machine name for each service type in operation) on start
156 up. Also, as stated above, the exact method by which this name registration
157 takes place is determined by whether or not the MS Windows client/server
158 has been given a WINS server address, whether or not LMHOSTS lookup
159 is enabled, or if DNS for NetBIOS name resolution is enabled, etc.
160 </para>
162 <para>
163 In the case where there is no WINS server all name registrations as
164 well as name lookups are done by UDP broadcast. This isolates name
165 resolution to the local subnet, unless LMHOSTS is used to list all
166 names and IP addresses. In such situations Samba provides a means by
167 which the samba server name may be forcibly injected into the browse
168 list of a remote MS Windows network (using the
169 <command>remote announce</command> parameter).
170 </para>
172 <para>
173 Where a WINS server is used, the MS Windows client will use UDP
174 unicast to register with the WINS server. Such packets can be routed
175 and thus WINS allows name resolution to function across routed networks.
176 </para>
178 <para>
179 During the startup process an election will take place to create a
180 local master browser if one does not already exist. On each NetBIOS network
181 one machine will be elected to function as the domain master browser. This
182 domain browsing has nothing to do with MS security domain control.
183 Instead, the domain master browser serves the role of contacting each local
184 master browser (found by asking WINS or from LMHOSTS) and exchanging browse
185 list contents. This way every master browser will eventually obtain a complete
186 list of all machines that are on the network. Every 11-15 minutes an election
187 is held to determine which machine will be the master browser. By the nature of
188 the election criteria used, the machine with the highest uptime, or the
189 most senior protocol version, or other criteria, will win the election
190 as domain master browser.
191 </para>
193 <para>
194 Clients wishing to browse the network make use of this list, but also depend
195 on the availability of correct name resolution to the respective IP
196 address/addresses.
197 </para>
199 <para>
200 Any configuration that breaks name resolution and/or browsing intrinsics
201 will annoy users because they will have to put up with protracted
202 inability to use the network services.
203 </para>
205 <para>
206 Samba supports a feature that allows forced synchonisation
207 of browse lists across routed networks using the <command>remote
208 browse sync</command> parameter in the <filename>smb.conf</filename> file.
209 This causes Samba to contact the local master browser on a remote network and
210 to request browse list synchronisation. This effectively bridges
211 two networks that are separated by routers. The two remote
212 networks may use either broadcast based name resolution or WINS
213 based name resolution, but it should be noted that the <command>remote
214 browse sync</command> parameter provides browse list synchronisation - and
215 that is distinct from name to address resolution, in other
216 words, for cross subnet browsing to function correctly it is
217 essential that a name to address resolution mechanism be provided.
218 This mechanism could be via DNS, <filename>/etc/hosts</filename>,
219 and so on.
220 </para>
222 <sect2>
223 <title>Setting up WORKGROUP Browsing</title>
225 <para>
226 To set up cross subnet browsing on a network containing machines
227 in up to be in a WORKGROUP, not an NT Domain you need to set up one
228 Samba server to be the Domain Master Browser (note that this is *NOT*
229 the same as a Primary Domain Controller, although in an NT Domain the
230 same machine plays both roles). The role of a Domain master browser is
231 to collate the browse lists from local master browsers on all the
232 subnets that have a machine participating in the workgroup. Without
233 one machine configured as a domain master browser each subnet would
234 be an isolated workgroup, unable to see any machines on any other
235 subnet. It is the presense of a domain master browser that makes
236 cross subnet browsing possible for a workgroup.
237 </para>
239 <para>
240 In an WORKGROUP environment the domain master browser must be a
241 Samba server, and there must only be one domain master browser per
242 workgroup name. To set up a Samba server as a domain master browser,
243 set the following option in the [global] section of the &smb.conf; file :
244 </para>
246 <para>
247 <programlisting>
248 domain master = yes
249 </programlisting>
250 </para>
252 <para>
253 The domain master browser should also preferrably be the local master
254 browser for its own subnet. In order to achieve this set the following
255 options in the [global] section of the &smb.conf; file :
256 </para>
258 <para>
259 <programlisting>
260 domain master = yes
261 local master = yes
262 preferred master = yes
263 os level = 65
264 </programlisting>
265 </para>
267 <para>
268 The domain master browser may be the same machine as the WINS
269 server, if you require.
270 </para>
272 <para>
273 Next, you should ensure that each of the subnets contains a
274 machine that can act as a local master browser for the
275 workgroup. Any MS Windows NT/2K/XP/2003 machine should be
276 able to do this, as will Windows 9x machines (although these
277 tend to get rebooted more often, so it's not such a good idea
278 to use these). To make a Samba server a local master browser
279 set the following options in the [global] section of the
280 &smb.conf; file :
281 </para>
283 <para>
284 <programlisting>
285 domain master = no
286 local master = yes
287 preferred master = yes
288 os level = 65
289 </programlisting>
290 </para>
292 <para>
293 Do not do this for more than one Samba server on each subnet,
294 or they will war with each other over which is to be the local
295 master browser.
296 </para>
298 <para>
299 The <command>local master</command> parameter allows Samba to act as a
300 local master browser. The <command>preferred master</command> causes nmbd
301 to force a browser election on startup and the <command>os level</command>
302 parameter sets Samba high enough so that it should win any browser elections.
303 </para>
305 <para>
306 If you have an NT machine on the subnet that you wish to
307 be the local master browser then you can disable Samba from
308 becoming a local master browser by setting the following
309 options in the <command>[global]</command> section of the
310 &smb.conf; file :
311 </para>
313 <para>
314 <programlisting>
315 domain master = no
316 local master = no
317 preferred master = no
318 os level = 0
319 </programlisting>
320 </para>
322 </sect2>
324 <sect2>
325 <title>Setting up DOMAIN Browsing</title>
327 <para>
328 If you are adding Samba servers to a Windows NT Domain then
329 you must not set up a Samba server as a domain master browser.
330 By default, a Windows NT Primary Domain Controller for a Domain
331 name is also the Domain master browser for that name, and many
332 things will break if a Samba server registers the Domain master
333 browser NetBIOS name (<replaceable>DOMAIN</replaceable>&lt;1B&gt;)
334 with WINS instead of the PDC.
335 </para>
337 <para>
338 For subnets other than the one containing the Windows NT PDC
339 you may set up Samba servers as local master browsers as
340 described. To make a Samba server a local master browser set
341 the following options in the <command>[global]</command> section
342 of the &smb.conf; file :
343 </para>
345 <para>
346 <programlisting>
347 domain master = no
348 local master = yes
349 preferred master = yes
350 os level = 65
351 </programlisting>
352 </para>
354 <para>
355 If you wish to have a Samba server fight the election with machines
356 on the same subnet you may set the <command>os level</command> parameter
357 to lower levels. By doing this you can tune the order of machines that
358 will become local master browsers if they are running. For
359 more details on this see the section <link linkend="browse-force-master">
360 Forcing samba to be the master browser</link>
361 below.
362 </para>
364 <para>
365 If you have Windows NT machines that are members of the domain
366 on all subnets, and you are sure they will always be running then
367 you can disable Samba from taking part in browser elections and
368 ever becoming a local master browser by setting following options
369 in the <command>[global]</command> section of the &smb.conf;
370 file :
371 </para>
373 <para>
374 <programlisting>
375 domain master = no
376 local master = no
377 preferred master = no
378 os level = 0
379 </programlisting>
380 </para>
382 </sect2>
384 <sect2 id="browse-force-master">
385 <title>Forcing samba to be the master</title>
387 <para>
388 Who becomes the <command>master browser</command> is determined by an election
389 process using broadcasts. Each election packet contains a number of parameters
390 which determine what precedence (bias) a host should have in the
391 election. By default Samba uses a very low precedence and thus loses
392 elections to just about anyone else.
393 </para>
395 <para>
396 If you want Samba to win elections then just set the <command>os level</command> global
397 option in &smb.conf; to a higher number. It defaults to 0. Using 34
398 would make it win all elections over every other system (except other
399 samba systems!)
400 </para>
402 <para>
403 A <command>os level</command> of 2 would make it beat WfWg and Win95, but not MS Windows
404 NT/2K Server. A MS Windows NT/2K Server domain controller uses level 32.
405 </para>
407 <para>The maximum os level is 255</para>
409 <para>
410 If you want samba to force an election on startup, then set the
411 <command>preferred master</command> global option in &smb.conf; to "yes". Samba will
412 then have a slight advantage over other potential master browsers
413 that are not preferred master browsers. Use this parameter with
414 care, as if you have two hosts (whether they are windows 95 or NT or
415 samba) on the same local subnet both set with <command>preferred master</command> to
416 "yes", then periodically and continually they will force an election
417 in order to become the local master browser.
418 </para>
420 <para>
421 If you want samba to be a <command>domain master browser</command>, then it is
422 recommended that you also set <command>preferred master</command> to "yes", because
423 samba will not become a domain master browser for the whole of your
424 LAN or WAN if it is not also a local master browser on its own
425 broadcast isolated subnet.
426 </para>
428 <para>
429 It is possible to configure two samba servers to attempt to become
430 the domain master browser for a domain. The first server that comes
431 up will be the domain master browser. All other samba servers will
432 attempt to become the domain master browser every 5 minutes. They
433 will find that another samba server is already the domain master
434 browser and will fail. This provides automatic redundancy, should
435 the current domain master browser fail.
436 </para>
438 </sect2>
440 <sect2>
441 <title>Making samba the domain master</title>
443 <para>
444 The domain master is responsible for collating the browse lists of
445 multiple subnets so that browsing can occur between subnets. You can
446 make samba act as the domain master by setting <command>domain master = yes</command>
447 in &smb.conf;. By default it will not be a domain master.
448 </para>
450 <para>
451 Note that you should NOT set Samba to be the domain master for a
452 workgroup that has the same name as an NT Domain.
453 </para>
455 <para>
456 When samba is the domain master and the master browser it will listen
457 for master announcements (made roughly every twelve minutes) from local
458 master browsers on other subnets and then contact them to synchronise
459 browse lists.
460 </para>
462 <para>
463 If you want samba to be the domain master then I suggest you also set
464 the <command>os level</command> high enough to make sure it wins elections, and set
465 <command>preferred master</command> to "yes", to get samba to force an election on
466 startup.
467 </para>
469 <para>
470 Note that all your servers (including samba) and clients should be
471 using a WINS server to resolve NetBIOS names. If your clients are only
472 using broadcasting to resolve NetBIOS names, then two things will occur:
473 </para>
475 <orderedlist>
476 <listitem>
477 <para>
478 your local master browsers will be unable to find a domain master
479 browser, as it will only be looking on the local subnet.
480 </para>
481 </listitem>
483 <listitem>
484 <para>
485 if a client happens to get hold of a domain-wide browse list, and
486 a user attempts to access a host in that list, it will be unable to
487 resolve the NetBIOS name of that host.
488 </para>
489 </listitem>
490 </orderedlist>
492 <para>
493 If, however, both samba and your clients are using a WINS server, then:
494 </para>
496 <orderedlist>
497 <listitem>
498 <para>
499 your local master browsers will contact the WINS server and, as long as
500 samba has registered that it is a domain master browser with the WINS
501 server, your local master browser will receive samba's ip address
502 as its domain master browser.
503 </para>
504 </listitem>
506 <listitem>
507 <para>
508 when a client receives a domain-wide browse list, and a user attempts
509 to access a host in that list, it will contact the WINS server to
510 resolve the NetBIOS name of that host. as long as that host has
511 registered its NetBIOS name with the same WINS server, the user will
512 be able to see that host.
513 </para>
514 </listitem>
515 </orderedlist>
517 </sect2>
519 <sect2>
520 <title>Note about broadcast addresses</title>
522 <para>
523 If your network uses a "0" based broadcast address (for example if it
524 ends in a 0) then you will strike problems. Windows for Workgroups
525 does not seem to support a 0's broadcast and you will probably find
526 that browsing and name lookups won't work.
527 </para>
528 </sect2>
530 <sect2>
531 <title>Multiple interfaces</title>
533 <para>
534 Samba now supports machines with multiple network interfaces. If you
535 have multiple interfaces then you will need to use the <command>interfaces</command>
536 option in &smb.conf; to configure them.
537 </para>
538 </sect2>
539 <sect2>
540 <title>Use of the <command>Remote Announce</command> parameter</title>
541 <para>
542 The <command>remote announce</command> parameter of
543 <filename>smb.conf</filename> can be used to forcibly ensure
544 that all the NetBIOS names on a network get announced to a remote network.
545 The syntax of the <command>remote announce</command> parameter is:
546 <programlisting>
547 remote announce = a.b.c.d [e.f.g.h] ...
548 </programlisting>
549 _or_
550 <programlisting>
551 remote announce = a.b.c.d/WORKGROUP [e.f.g.h/WORKGROUP] ...
552 </programlisting>
554 where:
555 <variablelist>
556 <varlistentry><term><replaceable>a.b.c.d</replaceable> and
557 <replaceable>e.f.g.h</replaceable></term>
558 <listitem><para>is either the LMB (Local Master Browser) IP address
559 or the broadcst address of the remote network.
560 ie: the LMB is at 192.168.1.10, or the address
561 could be given as 192.168.1.255 where the netmask
562 is assumed to be 24 bits (255.255.255.0).
563 When the remote announcement is made to the broadcast
564 address of the remote network every host will receive
565 our announcements. This is noisy and therefore
566 undesirable but may be necessary if we do NOT know
567 the IP address of the remote LMB.</para></listitem>
568 </varlistentry>
570 <varlistentry>
571 <term><replaceable>WORKGROUP</replaceable></term>
572 <listitem><para>is optional and can be either our own workgroup
573 or that of the remote network. If you use the
574 workgroup name of the remote network then our
575 NetBIOS machine names will end up looking like
576 they belong to that workgroup, this may cause
577 name resolution problems and should be avoided.
578 </para></listitem>
579 </varlistentry>
580 </variablelist>
581 </para>
583 </sect2>
585 <sect2>
586 <title>Use of the <command>Remote Browse Sync</command> parameter</title>
588 <para>
589 The <command>remote browse sync</command> parameter of
590 <filename>smb.conf</filename> is used to announce to
591 another LMB that it must synchronise it's NetBIOS name list with our
592 Samba LMB. It works ONLY if the Samba server that has this option is
593 simultaneously the LMB on it's network segment.
594 </para>
596 <para>
597 The syntax of the <command>remote browse sync</command> parameter is:
599 <programlisting>
600 remote browse sync = <replaceable>a.b.c.d</replaceable>
601 </programlisting>
603 where <replaceable>a.b.c.d</replaceable> is either the IP address of the
604 remote LMB or else is the network broadcast address of the remote segment.
605 </para>
607 </sect2>
609 </sect1>
611 <sect1>
612 <title>WINS - The Windows Internetworking Name Server</title>
614 <para>
615 Use of WINS (either Samba WINS _or_ MS Windows NT Server WINS) is highly
616 recommended. Every NetBIOS machine registers it's name together with a
617 name_type value for each of of several types of service it has available.
618 eg: It registers it's name directly as a unique (the type 0x03) name.
619 It also registers it's name if it is running the lanmanager compatible
620 server service (used to make shares and printers available to other users)
621 by registering the server (the type 0x20) name.
622 </para>
624 <para>
625 All NetBIOS names are up to 15 characters in length. The name_type variable
626 is added to the end of the name - thus creating a 16 character name. Any
627 name that is shorter than 15 characters is padded with spaces to the 15th
628 character. ie: All NetBIOS names are 16 characters long (including the
629 name_type information).
630 </para>
632 <para>
633 WINS can store these 16 character names as they get registered. A client
634 that wants to log onto the network can ask the WINS server for a list
635 of all names that have registered the NetLogon service name_type. This saves
636 broadcast traffic and greatly expedites logon processing. Since broadcast
637 name resolution can not be used across network segments this type of
638 information can only be provided via WINS _or_ via statically configured
639 <filename>lmhosts</filename> files that must reside on all clients in the
640 absence of WINS.
641 </para>
643 <para>
644 WINS also serves the purpose of forcing browse list synchronisation by all
645 LMB's. LMB's must synchronise their browse list with the DMB (domain master
646 browser) and WINS helps the LMB to identify it's DMB. By definition this
647 will work only within a single workgroup. Note that the domain master browser
648 has NOTHING to do with what is referred to as an MS Windows NT Domain. The
649 later is a reference to a security environment while the DMB refers to the
650 master controller for browse list information only.
651 </para>
653 <para>
654 Use of WINS will work correctly only if EVERY client TCP/IP protocol stack
655 has been configured to use the WINS server/s. Any client that has not been
656 configured to use the WINS server will continue to use only broadcast based
657 name registration so that WINS may NEVER get to know about it. In any case,
658 machines that have not registered with a WINS server will fail name to address
659 lookup attempts by other clients and will therefore cause workstation access
660 errors.
661 </para>
663 <para>
664 To configure Samba as a WINS server just add
665 <command>wins support = yes</command> to the <filename>smb.conf</filename>
666 file [globals] section.
667 </para>
669 <para>
670 To configure Samba to register with a WINS server just add
671 "wins server = a.b.c.d" to your smb.conf file [globals] section.
672 </para>
674 <important><para>
675 Never use both <command>wins support = yes</command> together
676 with <command>wins server = a.b.c.d</command>
677 particularly not using it's own IP address.
678 Specifying both will cause &nmbd; to refuse to start!
679 </para></important>
681 <sect2>
682 <title>Setting up a WINS server</title>
684 <para>
685 Either a Samba machine or a Windows NT Server machine may be set up
686 as a WINS server. To set a Samba machine to be a WINS server you must
687 add the following option to the &smb.conf; file on the selected machine :
688 in the [globals] section add the line
689 </para>
691 <para>
692 <programlisting>
693 wins support = yes
694 </programlisting>
695 </para>
697 <para>
698 Versions of Samba prior to 1.9.17 had this parameter default to
699 yes. If you have any older versions of Samba on your network it is
700 strongly suggested you upgrade to a recent version, or at the very
701 least set the parameter to 'no' on all these machines.
702 </para>
704 <para>
705 Machines with <command>wins support = yes</command> will keep a list of
706 all NetBIOS names registered with them, acting as a DNS for NetBIOS names.
707 </para>
709 <para>
710 You should set up only ONE wins server. Do NOT set the
711 <command>wins support = yes</command> option on more than one Samba
712 server.
713 </para>
715 <para>
716 To set up a Windows NT Server as a WINS server you need to set up
717 the WINS service - see your NT documentation for details. Note that
718 Windows NT WINS Servers can replicate to each other, allowing more
719 than one to be set up in a complex subnet environment. As Microsoft
720 refuse to document these replication protocols Samba cannot currently
721 participate in these replications. It is possible in the future that
722 a Samba->Samba WINS replication protocol may be defined, in which
723 case more than one Samba machine could be set up as a WINS server
724 but currently only one Samba server should have the
725 <command>wins support = yes</command> parameter set.
726 </para>
728 <para>
729 After the WINS server has been configured you must ensure that all
730 machines participating on the network are configured with the address
731 of this WINS server. If your WINS server is a Samba machine, fill in
732 the Samba machine IP address in the "Primary WINS Server" field of
733 the "Control Panel->Network->Protocols->TCP->WINS Server" dialogs
734 in Windows 95 or Windows NT. To tell a Samba server the IP address
735 of the WINS server add the following line to the [global] section of
736 all &smb.conf; files :
737 </para>
739 <para>
740 <programlisting>
741 wins server = &lt;name or IP address&gt;
742 </programlisting>
743 </para>
745 <para>
746 where &lt;name or IP address&gt; is either the DNS name of the WINS server
747 machine or its IP address.
748 </para>
750 <para>
751 Note that this line MUST NOT BE SET in the &smb.conf; file of the Samba
752 server acting as the WINS server itself. If you set both the
753 <command>wins support = yes</command> option and the
754 <command>wins server = &lt;name&gt;</command> option then
755 nmbd will fail to start.
756 </para>
758 <para>
759 There are two possible scenarios for setting up cross subnet browsing.
760 The first details setting up cross subnet browsing on a network containing
761 Windows 95, Samba and Windows NT machines that are not configured as
762 part of a Windows NT Domain. The second details setting up cross subnet
763 browsing on networks that contain NT Domains.
764 </para>
766 </sect2>
768 <sect2>
769 <title>WINS Replication</title>
771 <para>
772 Samba-3 permits WINS replication through the use of the <filename>wrepld</filename> utility.
773 This tool is not currently capable of being used as it is still in active development.
774 As soon as this tool becomes moderately functional we will prepare man pages and enhance this
775 section of the documentation to provide usage and technical details.
776 </para>
778 </sect2>
779 <sect2>
780 <title>Static WINS Entries</title>
782 <para>
783 New to Samba-3 is a tool called <filename>winsedit</filename> that may be used to add
784 static WINS entries to the WINS database. This tool can be used also to modify entries
785 existing in the WINS database.
786 </para>
788 <para>
789 The development of the winsedit tool was made necessary due to the migration
790 of the older style wins.dat file into a new tdb binary backend data store.
791 </para>
793 </sect2>
794 </sect1>
796 <sect1>
797 <title>Helpful Hints</title>
799 <para>
800 The following hints should be carefully considered as they are stumbling points
801 for many new network administrators.
802 </para>
804 <sect2>
805 <title>Windows Networking Protocols</title>
807 <warning><para>
808 Do NOT use more than one (1) protocol on MS Windows machines
809 </para></warning>
811 <para>
812 A very common cause of browsing problems results from installing more than
813 one protocol on an MS Windows machine.
814 </para>
816 <para>
817 Every NetBIOS machine takes part in a process of electing the LMB (and DMB)
818 every 15 minutes. A set of election criteria is used to determine the order
819 of precidence for winning this election process. A machine running Samba or
820 Windows NT will be biased so that the most suitable machine will predictably
821 win and thus retain it's role.
822 </para>
824 <para>
825 The election process is "fought out" so to speak over every NetBIOS network
826 interface. In the case of a Windows 9x machine that has both TCP/IP and IPX
827 installed and has NetBIOS enabled over both protocols the election will be
828 decided over both protocols. As often happens, if the Windows 9x machine is
829 the only one with both protocols then the LMB may be won on the NetBIOS
830 interface over the IPX protocol. Samba will then lose the LMB role as Windows
831 9x will insist it knows who the LMB is. Samba will then cease to function
832 as an LMB and thus browse list operation on all TCP/IP only machines will
833 fail.
834 </para>
836 <para><emphasis>
837 Windows 95, 98, 98se, Me are referred to generically as Windows 9x.
838 The Windows NT4, 2000, XP and 2003 use common protocols. These are roughly
839 referred to as the WinNT family, but it should be recognised that 2000 and
840 XP/2003 introduce new protocol extensions that cause them to behave
841 differently from MS Windows NT4. Generally, where a server does NOT support
842 the newer or extended protocol, these will fall back to the NT4 protocols.
843 </emphasis></para>
845 <para>
846 The safest rule of all to follow it this - USE ONLY ONE PROTOCOL!
847 </para>
849 </sect2>
851 <sect2>
852 <title>Name Resolution Order</title>
854 <para>
855 Resolution of NetBIOS names to IP addresses can take place using a number
856 of methods. The only ones that can provide NetBIOS name_type information
857 are:</para>
859 <simplelist>
860 <member>WINS: the best tool!</member>
861 <member>LMHOSTS: is static and hard to maintain.</member>
862 <member>Broadcast: uses UDP and can not resolve names across remote segments.</member>
863 </simplelist>
865 <para>
866 Alternative means of name resolution includes:</para>
867 <simplelist>
868 <member>/etc/hosts: is static, hard to maintain, and lacks name_type info</member>
869 <member>DNS: is a good choice but lacks essential name_type info.</member>
870 </simplelist>
872 <para>
873 Many sites want to restrict DNS lookups and want to avoid broadcast name
874 resolution traffic. The "name resolve order" parameter is of great help here.
875 The syntax of the "name resolve order" parameter is:
876 <programlisting>
877 name resolve order = wins lmhosts bcast host
878 </programlisting>
879 _or_
880 <programlisting>
881 name resolve order = wins lmhosts (eliminates bcast and host)
882 </programlisting>
883 The default is:
884 <programlisting>
885 name resolve order = host lmhost wins bcast
886 </programlisting>
887 where "host" refers the the native methods used by the Unix system
888 to implement the gethostbyname() function call. This is normally
889 controlled by <filename>/etc/host.conf</filename>, <filename>/etc/nsswitch.conf</filename> and <filename>/etc/resolv.conf</filename>.
890 </para>
891 </sect2>
892 </sect1>
894 <sect1>
895 <title>Technical Overview of browsing</title>
897 <para>
898 SMB networking provides a mechanism by which clients can access a list
899 of machines in a network, a so-called <command>browse list</command>. This list
900 contains machines that are ready to offer file and/or print services
901 to other machines within the network. Thus it does not include
902 machines which aren't currently able to do server tasks. The browse
903 list is heavily used by all SMB clients. Configuration of SMB
904 browsing has been problematic for some Samba users, hence this
905 document.
906 </para>
908 <para>
909 MS Windows 2000 and later, as with Samba 3 and later, can be
910 configured to not use NetBIOS over TCP/IP. When configured this way
911 it is imperative that name resolution (using DNS/LDAP/ADS) be correctly
912 configured and operative. Browsing will NOT work if name resolution
913 from SMB machine names to IP addresses does not function correctly.
914 </para>
916 <para>
917 Where NetBIOS over TCP/IP is enabled use of a WINS server is highly
918 recommended to aid the resolution of NetBIOS (SMB) names to IP addresses.
919 WINS allows remote segment clients to obtain NetBIOS name_type information
920 that can NOT be provided by any other means of name resolution.
921 </para>
923 <sect2>
924 <title>Browsing support in samba</title>
926 <para>
927 Samba facilitates browsing. The browsing is supported by &nmbd;
928 and is also controlled by options in the &smb.conf; file.
929 Samba can act as a local browse master for a workgroup and the ability
930 to support domain logons and scripts is now available.
931 </para>
933 <para>
934 Samba can also act as a domain master browser for a workgroup. This
935 means that it will collate lists from local browse masters into a
936 wide area network server list. In order for browse clients to
937 resolve the names they may find in this list, it is recommended that
938 both samba and your clients use a WINS server.
939 </para>
941 <para>
942 Note that you should NOT set Samba to be the domain master for a
943 workgroup that has the same name as an NT Domain: on each wide area
944 network, you must only ever have one domain master browser per workgroup,
945 regardless of whether it is NT, Samba or any other type of domain master
946 that is providing this service.
947 </para>
949 <note><para>
950 Nmbd can be configured as a WINS server, but it is not
951 necessary to specifically use samba as your WINS server. MS Windows
952 NT4, Server or Advanced Server 2000 or 2003 can be configured as
953 your WINS server. In a mixed NT/2000/2003 server and samba environment on
954 a Wide Area Network, it is recommended that you use the Microsoft
955 WINS server capabilities. In a samba-only environment, it is
956 recommended that you use one and only one Samba server as your WINS server.
957 </para></note>
959 <para>
960 To get browsing to work you need to run nmbd as usual, but will need
961 to use the <command>workgroup</command> option in &smb.conf;
962 to control what workgroup Samba becomes a part of.
963 </para>
965 <para>
966 Samba also has a useful option for a Samba server to offer itself for
967 browsing on another subnet. It is recommended that this option is only
968 used for 'unusual' purposes: announcements over the internet, for
969 example. See <command>remote announce</command> in the
970 &smb.conf; man page.
971 </para>
972 </sect2>
974 <sect2>
975 <title>Problem resolution</title>
977 <para>
978 If something doesn't work then hopefully the log.nmb file will help
979 you track down the problem. Try a debug level of 2 or 3 for finding
980 problems. Also note that the current browse list usually gets stored
981 in text form in a file called <filename>browse.dat</filename>.
982 </para>
984 <para>
985 Note that if it doesn't work for you, then you should still be able to
986 type the server name as <filename>\\SERVER</filename> in filemanager then
987 hit enter and filemanager should display the list of available shares.
988 </para>
990 <para>
991 Some people find browsing fails because they don't have the global
992 <command>guest account</command> set to a valid account. Remember that the
993 IPC$ connection that lists the shares is done as guest, and thus you must
994 have a valid guest account.
995 </para>
997 <para><emphasis>
998 MS Windows 2000 and upwards (as with Samba) can be configured to disallow
999 anonymous (ie: Guest account) access to the IPC$ share. In that case, the
1000 MS Windows 2000/XP/2003 machine acting as an SMB/CIFS client will use the
1001 name of the currently logged in user to query the IPC$ share. MS Windows
1002 9X clients are not able to do this and thus will NOT be able to browse
1003 server resources.
1004 </emphasis></para>
1006 <para>
1007 The other big problem people have is that their broadcast address,
1008 netmask or IP address is wrong (specified with the "interfaces" option
1009 in &smb.conf;)
1010 </para>
1011 </sect2>
1013 <sect2>
1014 <title>Browsing across subnets</title>
1015 <para>
1016 Since the release of Samba 1.9.17(alpha1) Samba has been
1017 updated to enable it to support the replication of browse lists
1018 across subnet boundaries. New code and options have been added to
1019 achieve this. This section describes how to set this feature up
1020 in different settings.
1021 </para>
1023 <para>
1024 To see browse lists that span TCP/IP subnets (ie. networks separated
1025 by routers that don't pass broadcast traffic) you must set up at least
1026 one WINS server. The WINS server acts as a DNS for NetBIOS names, allowing
1027 NetBIOS name to IP address translation to be done by doing a direct
1028 query of the WINS server. This is done via a directed UDP packet on
1029 port 137 to the WINS server machine. The reason for a WINS server is
1030 that by default, all NetBIOS name to IP address translation is done
1031 by broadcasts from the querying machine. This means that machines
1032 on one subnet will not be able to resolve the names of machines on
1033 another subnet without using a WINS server.
1034 </para>
1036 <para>
1037 Remember, for browsing across subnets to work correctly, all machines,
1038 be they Windows 95, Windows NT, or Samba servers must have the IP address
1039 of a WINS server given to them by a DHCP server, or by manual configuration
1040 (for Win95 and WinNT, this is in the TCP/IP Properties, under Network
1041 settings) for Samba this is in the &smb.conf; file.
1042 </para>
1044 <sect3>
1045 <title>How does cross subnet browsing work ?</title>
1047 <para>
1048 Cross subnet browsing is a complicated dance, containing multiple
1049 moving parts. It has taken Microsoft several years to get the code
1050 that achieves this correct, and Samba lags behind in some areas.
1051 Samba is capable of cross subnet browsing when configured correctly.
1052 </para>
1054 <para>
1055 Consider a network set up as follows :
1056 </para>
1058 <para>
1059 <programlisting>
1060 (DMB)
1061 N1_A N1_B N1_C N1_D N1_E
1062 | | | | |
1063 -------------------------------------------------------
1064 | subnet 1 |
1065 +---+ +---+
1066 |R1 | Router 1 Router 2 |R2 |
1067 +---+ +---+
1069 | subnet 2 subnet 3 |
1070 -------------------------- ------------------------------------
1071 | | | | | | | |
1072 N2_A N2_B N2_C N2_D N3_A N3_B N3_C N3_D
1073 (WINS)
1074 </programlisting>
1075 </para>
1077 <para>
1078 Consisting of 3 subnets (1, 2, 3) connected by two routers
1079 (R1, R2) - these do not pass broadcasts. Subnet 1 has 5 machines
1080 on it, subnet 2 has 4 machines, subnet 3 has 4 machines. Assume
1081 for the moment that all these machines are configured to be in the
1082 same workgroup (for simplicities sake). Machine N1_C on subnet 1
1083 is configured as Domain Master Browser (ie. it will collate the
1084 browse lists for the workgroup). Machine N2_D is configured as
1085 WINS server and all the other machines are configured to register
1086 their NetBIOS names with it.
1087 </para>
1089 <para>
1090 As all these machines are booted up, elections for master browsers
1091 will take place on each of the three subnets. Assume that machine
1092 N1_C wins on subnet 1, N2_B wins on subnet 2, and N3_D wins on
1093 subnet 3 - these machines are known as local master browsers for
1094 their particular subnet. N1_C has an advantage in winning as the
1095 local master browser on subnet 1 as it is set up as Domain Master
1096 Browser.
1097 </para>
1099 <para>
1100 On each of the three networks, machines that are configured to
1101 offer sharing services will broadcast that they are offering
1102 these services. The local master browser on each subnet will
1103 receive these broadcasts and keep a record of the fact that
1104 the machine is offering a service. This list of records is
1105 the basis of the browse list. For this case, assume that
1106 all the machines are configured to offer services so all machines
1107 will be on the browse list.
1108 </para>
1110 <para>
1111 For each network, the local master browser on that network is
1112 considered 'authoritative' for all the names it receives via
1113 local broadcast. This is because a machine seen by the local
1114 master browser via a local broadcast must be on the same
1115 network as the local master browser and thus is a 'trusted'
1116 and 'verifiable' resource. Machines on other networks that
1117 the local master browsers learn about when collating their
1118 browse lists have not been directly seen - these records are
1119 called 'non-authoritative'.
1120 </para>
1122 <para>
1123 At this point the browse lists look as follows (these are
1124 the machines you would see in your network neighborhood if
1125 you looked in it on a particular network right now).
1126 </para>
1128 <para>
1129 <programlisting>
1130 Subnet Browse Master List
1131 ------ ------------- ----
1132 Subnet1 N1_C N1_A, N1_B, N1_C, N1_D, N1_E
1134 Subnet2 N2_B N2_A, N2_B, N2_C, N2_D
1136 Subnet3 N3_D N3_A, N3_B, N3_C, N3_D
1137 </programlisting>
1138 </para>
1140 <para>
1141 Note that at this point all the subnets are separate, no
1142 machine is seen across any of the subnets.
1143 </para>
1145 <para>
1146 Now examine subnet 2. As soon as N2_B has become the local
1147 master browser it looks for a Domain master browser to synchronize
1148 its browse list with. It does this by querying the WINS server
1149 (N2_D) for the IP address associated with the NetBIOS name
1150 WORKGROUP&lt;1B&gt;. This name was registerd by the Domain master
1151 browser (N1_C) with the WINS server as soon as it was booted.
1152 </para>
1154 <para>
1155 Once N2_B knows the address of the Domain master browser it
1156 tells it that is the local master browser for subnet 2 by
1157 sending a MasterAnnouncement packet as a UDP port 138 packet.
1158 It then synchronizes with it by doing a NetServerEnum2 call. This
1159 tells the Domain Master Browser to send it all the server
1160 names it knows about. Once the domain master browser receives
1161 the MasterAnnouncement packet it schedules a synchronization
1162 request to the sender of that packet. After both synchronizations
1163 are done the browse lists look like :
1164 </para>
1166 <para>
1167 <programlisting>
1168 Subnet Browse Master List
1169 ------ ------------- ----
1170 Subnet1 N1_C N1_A, N1_B, N1_C, N1_D, N1_E,
1171 N2_A(*), N2_B(*), N2_C(*), N2_D(*)
1173 Subnet2 N2_B N2_A, N2_B, N2_C, N2_D
1174 N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
1176 Subnet3 N3_D N3_A, N3_B, N3_C, N3_D
1178 Servers with a (*) after them are non-authoritative names.
1179 </programlisting>
1180 </para>
1182 <para>
1183 At this point users looking in their network neighborhood on
1184 subnets 1 or 2 will see all the servers on both, users on
1185 subnet 3 will still only see the servers on their own subnet.
1186 </para>
1188 <para>
1189 The same sequence of events that occured for N2_B now occurs
1190 for the local master browser on subnet 3 (N3_D). When it
1191 synchronizes browse lists with the domain master browser (N1_A)
1192 it gets both the server entries on subnet 1, and those on
1193 subnet 2. After N3_D has synchronized with N1_C and vica-versa
1194 the browse lists look like.
1195 </para>
1197 <para>
1198 <programlisting>
1199 Subnet Browse Master List
1200 ------ ------------- ----
1201 Subnet1 N1_C N1_A, N1_B, N1_C, N1_D, N1_E,
1202 N2_A(*), N2_B(*), N2_C(*), N2_D(*),
1203 N3_A(*), N3_B(*), N3_C(*), N3_D(*)
1205 Subnet2 N2_B N2_A, N2_B, N2_C, N2_D
1206 N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
1208 Subnet3 N3_D N3_A, N3_B, N3_C, N3_D
1209 N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*),
1210 N2_A(*), N2_B(*), N2_C(*), N2_D(*)
1212 Servers with a (*) after them are non-authoritative names.
1213 </programlisting>
1214 </para>
1216 <para>
1217 At this point users looking in their network neighborhood on
1218 subnets 1 or 3 will see all the servers on all sunbets, users on
1219 subnet 2 will still only see the servers on subnets 1 and 2, but not 3.
1220 </para>
1222 <para>
1223 Finally, the local master browser for subnet 2 (N2_B) will sync again
1224 with the domain master browser (N1_C) and will recieve the missing
1225 server entries. Finally - and as a steady state (if no machines
1226 are removed or shut off) the browse lists will look like :
1227 </para>
1229 <para>
1230 <programlisting>
1231 Subnet Browse Master List
1232 ------ ------------- ----
1233 Subnet1 N1_C N1_A, N1_B, N1_C, N1_D, N1_E,
1234 N2_A(*), N2_B(*), N2_C(*), N2_D(*),
1235 N3_A(*), N3_B(*), N3_C(*), N3_D(*)
1237 Subnet2 N2_B N2_A, N2_B, N2_C, N2_D
1238 N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
1239 N3_A(*), N3_B(*), N3_C(*), N3_D(*)
1241 Subnet3 N3_D N3_A, N3_B, N3_C, N3_D
1242 N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*),
1243 N2_A(*), N2_B(*), N2_C(*), N2_D(*)
1245 Servers with a (*) after them are non-authoritative names.
1246 </programlisting>
1247 </para>
1249 <para>
1250 Synchronizations between the domain master browser and local
1251 master browsers will continue to occur, but this should be a
1252 steady state situation.
1253 </para>
1255 <para>
1256 If either router R1 or R2 fails the following will occur:
1257 </para>
1259 <orderedlist>
1260 <listitem>
1261 <para>
1262 Names of computers on each side of the inaccessible network fragments
1263 will be maintained for as long as 36 minutes, in the network neighbourhood
1264 lists.
1265 </para>
1266 </listitem>
1268 <listitem>
1269 <para>
1270 Attempts to connect to these inaccessible computers will fail, but the
1271 names will not be removed from the network neighbourhood lists.
1272 </para>
1273 </listitem>
1275 <listitem>
1276 <para>
1277 If one of the fragments is cut off from the WINS server, it will only
1278 be able to access servers on its local subnet, by using subnet-isolated
1279 broadcast NetBIOS name resolution. The effects are similar to that of
1280 losing access to a DNS server.
1281 </para>
1282 </listitem>
1283 </orderedlist>
1284 </sect3>
1285 </sect2>
1287 </sect1>
1288 </chapter>