preparing for release of 1.9.18alpha12
[kai/samba.git] / docs / textdocs / BROWSING.txt
1 !==
2 !== BROWSING.txt for Samba release 1.9.18alpha12 28 Nov 1997
3 !==
4 Author/s:       Many (Thanks to Luke, Jeremy, Andrew, etc.)
5 Updated:        October 12, 1997
6 Status:         Current - For VERY Advanced Users ONLY
7
8 Summary: This describes how to configure Samba for improved browsing.
9 =====================================================================
10
11 OVERVIEW:
12 =========
13 SMB networking provides a mechanism by which clients can access a list
14 of machines that are available within the network.  This list is called
15 the browse list and is heavily used by all SMB clients.  Configuration
16 of SMB browsing has been problematic for some Samba users, hence this
17 document.
18
19 =====================================================================
20
21 BROWSING
22 ========
23 Samba now fully supports browsing.  The browsing is supported by nmbd
24 and is also controlled by options in the smb.conf file (see smb.conf(5)).
25
26 Samba can act as a local browse master for a workgroup and the ability
27 for samba to support domain logons and scripts is now available.  See
28 DOMAIN.txt for more information on domain logons.
29
30 Samba can also act as a domain master browser for a workgroup.  This
31 means that it will collate lists from local browse masters into a
32 wide area network server list.  In order for browse clients to
33 resolve the names they may find in this list, it is recommended that
34 both samba and your clients use a WINS server.
35
36 Note that you should NOT set Samba to be the domain master for a
37 workgroup that has the same name as an NT Domain: on each wide area
38 network, you must only ever have one domain master browser per workgroup,
39 regardless of whether it is NT, Samba or any other type of domain master
40 that is providing this service.
41
42 [Note that nmbd can be configured as a WINS server, but it is not
43 necessary to specifically use samba as your WINS server.  NTAS can
44 be configured as your WINS server.  In a mixed NT server and
45 samba environment on a Wide Area Network, it is recommended that
46 you use the NT server's WINS server capabilities.  In a samba-only
47 environment, it is recommended that you use one and only one nmbd
48 as your WINS server].
49
50 To get browsing to work you need to run nmbd as usual, but will need
51 to use the "workgroup" option in smb.conf to control what workgroup
52 Samba becomes a part of.
53
54 Samba also has a useful option for a Samba server to offer itself for
55 browsing on another subnet.  It is recommended that this option is only
56 used for 'unusual' purposes: announcements over the internet, for
57 example.  See "remote announce" in the smb.conf man page.  
58
59 If something doesn't work then hopefully the log.nmb file will
60 help you track down the problem.  Try a debug level of 2 or 3 for
61 finding problems.
62
63 Note that if it doesn't work for you, then you should still be able to
64 type the server name as \\SERVER in filemanager then hit enter and
65 filemanager should display the list of available shares.
66
67 Some people find browsing fails because they don't have the global
68 "guest account" set to a valid account.  Remember that the IPC$
69 connection that lists the shares is done as guest, and thus you must
70 have a valid guest account.
71
72 Also, a lot of people are getting bitten by the problem of too many
73 parameters on the command line of nmbd in inetd.conf.  This trick is to
74 not use spaces between the option and the parameter (eg: -d2 instead
75 of -d 2), and to not use the -B and -N options.  New versions of nmbd
76 are now far more likely to correctly find your broadcast and network
77 addess, so in most cases these aren't needed.
78
79 The other big problem people have is that their broadcast address,
80 netmask or IP address is wrong (specified with the "interfaces" option
81 in smb.conf)
82
83
84 BROWSING ACROSS SUBNETS
85 =======================
86
87 With the release of Samba 1.9.17(alpha1 and above) Samba has been
88 updated to enable it to support the replication of browse lists
89 across subnet boundaries.  New code and options have been added to
90 achieve this.  This section describes how to set this feature up
91 in different settings.
92
93 To see browse lists that span TCP/IP subnets (ie.  networks separated
94 by routers that don't pass broadcast traffic) you must set up at least
95 one WINS server.  The WINS server acts as a DNS for NetBIOS names, allowing
96 NetBIOS name to IP address translation to be done by doing a direct
97 query of the WINS server.  This is done via a directed UDP packet on
98 port 137 to the WINS server machine.  The reason for a WINS server is
99 that by default, all NetBIOS name to IP address translation is done
100 by broadcasts from the querying machine.  This means that machines
101 on one subnet will not be able to resolve the names of machines on
102 another subnet without using a WINS server.
103
104 Remember, for browsing across subnets to work correctly, all machines,
105 be they Windows 95, Windows NT, or Samba servers must have the IP address
106 of a WINS server given to them by a DHCP server, or by manual configuration 
107 (for Win95 and WinNT, this is in the TCP/IP Properties, under Network 
108 settings) for Samba this is in the smb.conf file.
109
110 How does cross subnet browsing work ?
111 =====================================
112
113 Cross subnet browsing is a complicated dance, containing multiple
114 moving parts.  It has taken Microsoft several years to get the code
115 that achieves this correct, and Samba lags behind in some areas.
116 However, with the 1.9.17 release, Samba is capable of cross subnet
117 browsing when configured correctly.
118
119 Consider a network set up as follows :
120
121                                    (DMB)
122              N1_A      N1_B        N1_C       N1_D        N1_E
123               |          |           |          |           |
124           -------------------------------------------------------
125             |          subnet 1                       |
126           +---+                                      +---+
127           |R1 | Router 1                  Router 2   |R2 |
128           +---+                                      +---+
129             |                                          |
130             |  subnet 2              subnet 3          |
131   --------------------------       ------------------------------------
132   |     |     |      |               |        |         |           |
133  N2_A  N2_B  N2_C   N2_D           N3_A     N3_B      N3_C        N3_D 
134                     (WINS)
135
136 Consisting of 3 subnets (1, 2, 3) conneted by two routers
137 (R1, R2) - these do not pass broadcasts.  Subnet 1 has 5 machines
138 on it, subnet 2 has 4 machines, subnet 3 has 4 machines.  Assume
139 for the moment that all these machines are configured to be in the
140 same workgroup (for simplicities sake).  Machine N1_C on subnet 1
141 is configured as Domain Master Browser (ie.  it will collate the
142 browse lists for the workgroup).  Machine N2_D is configured as
143 WINS server and all the other machines are configured to register
144 their NetBIOS names with it.
145
146 As all these machines are booted up, elections for master browsers
147 will take place on each of the three subnets.  Assume that machine
148 N1_C wins on subnet 1, N2_B wins on subnet 2, and N3_D wins on
149 subnet 3 - these machines are known as local master browsers for
150 their particular subnet.  N1_C has an advantage in winning as the
151 local master browser on subnet 1 as it is set up as Domain Master
152 Browser.
153
154 On each of the three networks, machines that are configured to 
155 offer sharing services will broadcast that they are offering
156 these services.  The local master browser on each subnet will
157 receive these broadcasts and keep a record of the fact that
158 the machine is offering a service.  This list of records is
159 the basis of the browse list.  For this case, assume that
160 all the machines are configured to offer services so all machines
161 will be on the browse list.
162
163 For each network, the local master browser on that network is
164 considered 'authoritative' for all the names it receives via
165 local broadcast.  This is because a machine seen by the local
166 master browser via a local broadcast must be on the same 
167 network as the local master browser and thus is a 'trusted'
168 and 'verifiable' resource.  Machines on other networks that
169 the local master browsers learn about when collating their
170 browse lists have not been directly seen - these records are
171 called 'non-authoritative'.
172
173 At this point the browse lists look as follows (these are 
174 the machines you would see in your network neighborhood if
175 you looked in it on a particular network right now).
176
177 Subnet           Browse Master   List
178 ------           -------------   ----
179 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E
180
181 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
182
183 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
184
185 Note that at this point all the subnets are separate, no
186 machine is seen across any of the subnets.
187
188 Now examine subnet 2.  As soon as N2_B has become the local
189 master browser it looks for a Domain master browser to synchronize
190 its browse list with.  It does this by querying the WINS server
191 (N2_D) for the IP address associated with the NetBIOS name 
192 WORKGROUP<1B>.  This name was registerd by the Domain master
193 browser (N1_C) with the WINS server as soon as it was booted.
194
195 Once N2_B knows the address of the Domain master browser it
196 tells it that is the local master browser for subnet 2 by
197 sending a MasterAnnouncement packet as a UDP port 138 packet.
198 It then synchronizes with it by doing a NetServerEnum2 call.  This
199 tells the Domain Master Browser to send it all the server
200 names it knows about.  Once the domain master browser receives
201 the MasterAnnouncement packet it schedules a synchronization
202 request to the sender of that packet.  After both synchronizations
203 are done the browse lists look like :
204
205 Subnet           Browse Master   List
206 ------           -------------   ----
207 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E, 
208                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*)
209
210 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
211                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
212
213 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
214
215 Servers with a (*) after them are non-authoritative names.
216
217 At this point users looking in their network neighborhood on
218 subnets 1 or 2 will see all the servers on both, users on
219 subnet 3 will still only see the servers on their own subnet.
220
221 The same sequence of events that occured for N2_B now occurs
222 for the local master browser on subnet 3 (N3_D).  When it
223 synchronizes browse lists with the domain master browser (N1_A)
224 it gets both the server entries on subnet 1, and those on
225 subnet 2.  After N3_D has synchronized with N1_C and vica-versa
226 the browse lists look like.
227
228 Subnet           Browse Master   List
229 ------           -------------   ----
230 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E, 
231                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*),
232                                  N3_A(*), N3_B(*), N3_C(*), N3_D(*)
233
234 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
235                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
236
237 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
238                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*),
239                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*)
240
241 Servers with a (*) after them are non-authoritative names.
242
243 At this point users looking in their network neighborhood on
244 subnets 1 or 3 will see all the servers on all sunbets, users on
245 subnet 2 will still only see the servers on subnets 1 and 2, but not 3.
246
247 Finally, the local master browser for subnet 2 (N2_B) will sync again
248 with the domain master browser (N1_C) and will recieve the missing
249 server entries.  Finally - and as a steady state (if no machines
250 are removed or shut off) the browse lists will look like :
251
252 Subnet           Browse Master   List
253 ------           -------------   ----
254 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E, 
255                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*),
256                                  N3_A(*), N3_B(*), N3_C(*), N3_D(*)
257
258 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
259                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
260                                  N3_A(*), N3_B(*), N3_C(*), N3_D(*)
261
262 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
263                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*),
264                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*)
265
266 Servers with a (*) after them are non-authoritative names.
267
268 Synchronizations between the domain master browser and local
269 master browsers will continue to occur, but this should be a
270 steady state situation.
271
272 If either router R1 or R2 fails the following will occur:
273
274 1) Names of computers on each side of the inaccessible network fragments
275 will be maintained for as long as 36 minutes, in the network neighbourhood
276 lists.
277
278 2) Attempts to connect to these inaccessible computers will fail, but the
279 names will not be removed from the network neighbourhood lists.
280
281 3) If one of the fragments is cut off from the WINS server, it will only
282 be able to access servers on its local subnet, by using subnet-isolated
283 broadcast NetBIOS name resolution.  The effects are similar to that of
284 losing access to a DNS server.
285
286 Setting up a WINS server
287 ========================
288
289 Either a Samba machine or a Windows NT Server machine may be set up
290 as a WINS server.  To set a Samba machine to be a WINS server you must
291 add the following option to the smb.conf file on the selected machine :
292 in the [globals] section add the line 
293
294         wins support = yes
295
296 Versions of Samba previous to 1.9.17 had this parameter default to
297 yes.  If you have any older versions of Samba on your network it is
298 strongly suggested you upgrade to 1.9.17 or above, or at the very
299 least set the parameter to 'no' on all these machines.
300
301 Machines with "wins support = yes" will keep a list of all NetBIOS
302 names registered with them, acting as a DNS for NetBIOS names.
303
304 You should set up only ONE wins server.  Do NOT set the
305 "wins support = yes" option on more than one Samba server.
306
307 To set up a Windows NT Server as a WINS server you need to set up
308 the WINS service - see your NT documentation for details.  Note that
309 Windows NT WINS Servers can replicate to each other, allowing more
310 than one to be set up in a complex subnet environment.  As Microsoft
311 refuse to document these replication protocols Samba cannot currently
312 participate in these replications.  It is possible in the future that
313 a Samba->Samba WINS replication protocol may be defined, in which
314 case more than one Samba machine could be set up as a WINS server
315 but currently only one Samba server should have the "wins support = yes"
316 parameter set.
317
318 After the WINS server has been configured you must ensure that all
319 machines participating on the network are configured with the address
320 of this WINS server.  If your WINS server is a Samba machine, fill in
321 the Samba machine IP address in the "Primary WINS Server" field of
322 the "Control Panel->Network->Protocols->TCP->WINS Server" dialogs
323 in Windows 95 or Windows NT.  To tell a Samba server the IP address
324 of the WINS server add the following line to the [global] section of
325 all smb.conf files :
326
327         wins server = <name or IP address>
328
329 where <name or IP address> is either the DNS name of the WINS server
330 machine or its IP address.
331
332 Note that this line MUST NOT BE SET in the smb.conf file of the Samba
333 server acting as the WINS server itself.  If you set both the
334 "wins support = yes" option and the "wins server = <name>" option then
335 nmbd will fail to start.
336
337 There are two possible scenarios for setting up cross subnet browsing.
338 The first details setting up cross subnet browsing on a network containing
339 Windows 95, Samba and Windows NT machines that are not configured as
340 part of a Windows NT Domain.  The second details setting up cross subnet
341 browsing on networks that contain NT Domains.
342
343 Setting up Browsing in a WORKGROUP
344 ==================================
345
346 To set up cross subnet browsing on a network containing machines
347 in up to be in a WORKGROUP, not an NT Domain you need to set up one
348 Samba server to be the Domain Master Browser (note that this is *NOT*
349 the same as a Primary Domain Controller, although in an NT Domain the
350 same machine plays both roles).  The role of a Domain master browser is
351 to collate the browse lists from local master browsers on all the
352 subnets that have a machine participating in the workgroup.  Without
353 one machine configured as a domain master browser each subnet would
354 be an isolated workgroup, unable to see any machines on any other
355 subnet.  It is the presense of a domain master browser that makes
356 cross subnet browsing possible for a workgroup.
357
358 In an WORKGROUP environment the domain master browser must be a
359 Samba server, and there must only be one domain master browser per
360 workgroup name.  To set up a Samba server as a domain master browser,
361 set the following option in the [global] section of the smb.conf file :
362
363         domain master = yes
364
365 The domain master browser should also preferrably be the local master
366 browser for its own subnet.  In order to achieve this set the following
367 options in the [global] section of the smb.conf file :
368
369         domain master = yes
370         local master = yes
371         preferred master = yes
372         os level = 65
373
374 The domain master browser may be the same machine as the WINS
375 server, if you require.
376
377 Next, you should ensure that each of the subnets contains a
378 machine that can act as a local master browser for the
379 workgroup.  Any NT machine should be able to do this, as will
380 Windows 95 machines (although these tend to get rebooted more
381 often, so it's not such a good idea to use these).  To make a 
382 Samba server a local master browser set the following
383 options in the [global] section of the smb.conf file :
384
385         domain master = no
386         local master = yes
387         preferred master = yes
388         os level = 65
389
390 Do not do this for more than one Samba server on each subnet,
391 or they will war with each other over which is to be the local
392 master browser.
393
394 The "local master" parameter allows Samba to act as a local master
395 browser.  The "preferred master" causes nmbd to force a browser
396 election on startup and the "os level" parameter sets Samba high
397 enough so that it should win any browser elections.
398
399 If you have an NT machine on the subnet that you wish to
400 be the local master browser then you can disable Samba from
401 becoming a local master browser by setting the following
402 options in the [global] section of the smb.conf file :
403
404         domain master = no
405         local master = no
406         preferred master = no
407         os level = 0
408
409 Setting up Browsing in a DOMAIN
410 ===============================
411
412 If you are adding Samba servers to a Windows NT Domain then
413 you must not set up a Samba server as a domain master browser.
414 By default, a Windows NT Primary Domain Controller for a Domain
415 name is also the Domain master browser for that name, and many
416 things will break if a Samba server registers the Domain master
417 browser NetBIOS name (DOMAIN<1B>) with WINS instead of the PDC.
418
419 For subnets other than the one containing the Windows NT PDC
420 you may set up Samba servers as local master browsers as
421 described.  To make a Samba server a local master browser set 
422 the following options in the [global] section of the smb.conf 
423 file :
424
425         domain master = no
426         local master = yes
427         preferred master = yes
428         os level = 65
429
430 If you wish to have a Samba server fight the election with machines
431 on the same subnet you may set the "os level" parameter to lower
432 levels.  By doing this you can tune the order of machines that
433 will become local master browsers if they are running.  For
434 more details on this see the section "FORCING SAMBA TO BE THE MASTER"
435 below.
436
437 If you have Windows NT machines that are members of the domain
438 on all subnets, and you are sure they will always be running then
439 you can disable Samba from taking part in browser elections and
440 ever becoming a local master browser by setting following options 
441 in the [global] section of the smb.conf file :
442  
443         domain master = no
444         local master = no
445         preferred master = no
446         os level = 0
447
448 FORCING SAMBA TO BE THE MASTER
449 ==============================
450
451 Who becomes the "master browser" is determined by an election process
452 using broadcasts.  Each election packet contains a number of parameters
453 which determine what precedence (bias) a host should have in the
454 election.  By default Samba uses a very low precedence and thus loses
455 elections to just about anyone else.
456
457 If you want Samba to win elections then just set the "os level" global
458 option in smb.conf to a higher number.  It defaults to 0.  Using 34
459 would make it win all elections over every other system (except other
460 samba systems!)
461
462 A "os level" of 2 would make it beat WfWg and Win95, but not NTAS.  A
463 NTAS domain controller uses level 32.
464
465 The maximum os level is 255
466
467 If you want samba to force an election on startup, then set the
468 "preferred master" global option in smb.conf to "yes".  Samba will
469 then have a slight advantage over other potential master browsers
470 that are not preferred master browsers.  Use this parameter with
471 care, as if you have two hosts (whether they are windows 95 or NT or
472 samba) on the same local subnet both set with "preferred master" to
473 "yes", then periodically and continually they will force an election
474 in order to become the local master browser.
475
476 If you want samba to be a "domain master browser", then it is
477 recommended that you also set "preferred master" to "yes", because
478 samba will not become a domain master browser for the whole of your
479 LAN or WAN if it is not also a local master browser on its own
480 broadcast isolated subnet.
481
482 It is possible to configure two samba servers to attempt to become
483 the domain master browser for a domain.  The first server that comes
484 up will be the domain master browser.  All other samba servers will
485 attempt to become the domain master browser every 5 minutes.  They
486 will find that another samba server is already the domain master
487 browser and will fail.  This provides automatic redundancy, should
488 the current domain master browser fail.
489  
490
491 MAKING SAMBA THE DOMAIN MASTER
492 ==============================
493
494 The domain master is responsible for collating the browse lists of
495 multiple subnets so that browsing can occur between subnets.  You can
496 make samba act as the domain master by setting "domain master = yes"
497 in smb.conf.  By default it will not be a domain master.
498
499 Note that you should NOT set Samba to be the domain master for a
500 workgroup that has the same name as an NT Domain.
501
502 When samba is the domain master and the master browser it will listen
503 for master announcements (made roughly every twelve minutes) from local
504 master browsers on other subnets and then contact them to synchronise
505 browse lists.
506
507 If you want samba to be the domain master then I suggest you also set
508 the "os level" high enough to make sure it wins elections, and set
509 "preferred master" to "yes", to get samba to force an election on
510 startup.
511
512 Note that all your servers (including samba) and clients should be
513 using a WINS server to resolve NetBIOS names.  If your clients are only
514 using broadcasting to resolve NetBIOS names, then two things will occur:
515
516 a) your local master browsers will be unable to find a domain master
517    browser, as it will only be looking on the local subnet.
518
519 b) if a client happens to get hold of a domain-wide browse list, and
520    a user attempts to access a host in that list, it will be unable to
521    resolve the NetBIOS name of that host.
522
523 If, however, both samba and your clients are using a WINS server, then:
524
525 a) your local master browsers will contact the WINS server and, as long as
526    samba has registered that it is a domain master browser with the WINS
527    server, your local master browser will receive samba's ip address
528    as its domain master browser.
529
530 b) when a client receives a domain-wide browse list, and a user attempts
531    to access a host in that list, it will contact the WINS server to
532    resolve the NetBIOS name of that host.  as long as that host has
533    registered its NetBIOS name with the same WINS server, the user will
534    be able to see that host.  
535
536 NOTE ABOUT BROADCAST ADDRESSES
537 ==============================
538
539 If your network uses a "0" based broadcast address (for example if it
540 ends in a 0) then you will strike problems.  Windows for Workgroups
541 does not seem to support a 0's broadcast and you will probably find
542 that browsing and name lookups won't work.
543
544
545 MULTIPLE INTERFACES
546 ===================
547
548 Samba now supports machines with multiple network interfaces.  If you
549 have multiple interfaces then you will need to use the "interfaces"
550 option in smb.conf to configure them.  See smb.conf(5) for details.
551