67a867753010d714865d66cb3a5b025c23588acd
[ira/wip.git] / docs / htmldocs / using_samba / ch01_03.html
1 <HTML>
2 <HEAD>
3 <TITLE>
4 [Chapter 1] 1.3 Getting Familiar with a SMB/CIFS Network</title><META NAME="DC.title" CONTENT=""><META NAME="DC.creator" CONTENT=""><META NAME="DC.publisher" CONTENT="O'Reilly &amp; Associates, Inc."><META NAME="DC.date" CONTENT="1999-11-05T21:29:52Z"><META NAME="DC.type" CONTENT="Text.Monograph"><META NAME="DC.format" CONTENT="text/html" SCHEME="MIME"><META NAME="DC.source" CONTENT="" SCHEME="ISBN"><META NAME="DC.language" CONTENT="en-US"><META NAME="generator" CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"></head>
5 <BODY BGCOLOR="#FFFFFF" TEXT="#000000" link="#990000" vlink="#0000CC">
6 <table BORDER="0" CELLPADDING="0" CELLSPACING="0" width="90%">
7 <tr>
8 <td width="25%" valign="TOP">
9 <img hspace=10 vspace=10 src="gifs/samba.s.gif" 
10 alt="Using Samba" align=left valign=top border=0>
11 </td>
12 <td height="105" valign="TOP">
13 <br>
14 <H2>Using Samba</H2>
15 <font size="-1">
16 Robert Eckstein, David Collier-Brown, Peter Kelly
17 <br>1st Edition November 1999
18 <br>1-56592-449-5, Order Number: 4495
19 <br>416 pages, $34.95
20 </font>
21 <p> <a href="http://www.oreilly.com/catalog/samba/">Buy the hardcopy</a>
22 <p><a href="index.html">Table of Contents</a>
23 </td>
24 </tr>
25 </table>
26 <hr size=1 noshade>
27 <!--sample chapter begins -->
28
29 <center>
30 <DIV CLASS="htmlnav">
31 <TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0">
32 <TR>
33 <TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172">
34 <A CLASS="sect1" HREF="ch01_02.html" TITLE="1.2 What Can Samba Do For Me?">
35 <IMG SRC="gifs/txtpreva.gif" ALT="Previous: 1.2 What Can Samba Do For Me?" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171">
36 <B>
37 <FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">
38 <A CLASS="chapter" REL="up" HREF="ch01_01.html" TITLE="1. Learning the Samba">
39 Chapter 1<br>
40 Learning the Samba</a></font></b></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172">
41 <A CLASS="sect1" HREF="ch01_04.html" TITLE="1.4 Microsoft Implementations">
42 <IMG SRC="gifs/txtnexta.gif" ALT="Next: 1.4 Microsoft Implementations" BORDER="0"></a></td></tr></table>&nbsp;<hr noshade size=1></center>
43 </div>
44 <blockquote>
45 <div>
46 <H2 CLASS="sect1">
47 <A CLASS="title" NAME="ch01-88536">
48 1.3 Getting Familiar with a SMB/CIFS Network</a></h2><P CLASS="para">Now that you have had a brief tour of Samba, let's take some time to get familiar with Samba's adopted environment: an SMB/CIFS network. Networking with SMB is significantly different from working with a Unix TCP/IP network, because there are several new concepts to learn and a lot of information to cover. First, we will discuss the basic concepts behind an SMB network, followed by some Microsoft implementations of it, and finally we will show you where a Samba server can and cannot fit into the picture.</p><DIV CLASS="sect2">
49 <H3 CLASS="sect2">
50 <A CLASS="title" NAME="ch01-pgfId-941409">
51 1.3.1 Understanding NetBIOS</a></h3><P CLASS="para">
52 To begin, let's step back in time. In 1984, IBM authored a simple application programming interface (API) for networking its computers called the <I CLASS="firstterm">
53 Network Basic Input/Output System </i>(NetBIOS). The NetBIOS API provided a rudimentary design for an application to connect and share data with other computers.</p><P CLASS="para">
54 It's helpful to think of the NetBIOS API as networking extensions to the standard BIOS API calls. With BIOS, each low-level call is confined to the hardware of the local machine and doesn't need any help traveling to its destination. NetBIOS, however, originally had to exchange instructions with computers across IBM PC or Token Ring networks. It therefore required a low-level transport protocol to carry its requests from one computer to the next.</p><P CLASS="para">
55 In late 1985, IBM released one such protocol, which it merged with the NetBIOS API to become the <I CLASS="firstterm">
56 NetBIOS Extended User Interface</i> (<EM CLASS="emphasis">NetBEUI</em>). NetBEUI was designed for small local area networks (LANs), and it let each machine claim a name (up to 15 characters) that wasn't already in use on the network. By a "small LAN," we mean fewer than 255 nodes on the network&nbsp;- which was considered a practical restriction in 1985!</p><P CLASS="para">
57 The NetBEUI protocol was very popular with networking applications, including those running under Windows for Workgroups. Later, implementations of NetBIOS over Novell's IPX networking protocols also emerged, which competed with NetBEUI. However, the networking protocols of choice for the burgeoning Internet community were TCP/IP and UDP/IP, and implementing the NetBIOS APIs over those protocols soon became a necessity.</p><P CLASS="para">
58 Recall that TCP/IP uses numbers to represent computer addresses, such as 192.168.220.100, while NetBIOS uses only names. This was a major issue when trying to mesh the two protocols together. In 1987, the Internet Engineering Task Force (IETF) published a series of standardization documents, titled RFC 1001 and 1002, that outlined how NetBIOS would work over a TCP/UDP network. This set of documents still governs each of the implementations that exist today, including those provided by Microsoft with their Windows operating systems as well as the Samba suite.</p><P CLASS="para">
59 Since then, the standard this document governs has become known as <I CLASS="firstterm">
60 NetBIOS over TCP/IP</i>, or NBT for short. The NBT standard (RFC 1001/1002) currently outlines a trio of services on a network:</p><UL CLASS="itemizedlist">
61 <LI CLASS="listitem">
62 <P CLASS="para">
63 <A CLASS="listitem" NAME="ch01-pgfId-946789">
64 </a>A name service</p></li><LI CLASS="listitem">
65 <P CLASS="para">
66 <A CLASS="listitem" NAME="ch01-pgfId-946790">
67 </a>Two communication services: </p><UL CLASS="itemizedlist">
68 <LI CLASS="listitem">
69 <P CLASS="para">
70 <A CLASS="listitem" NAME="ch01-pgfId-952037">
71 </a>Datagrams </p></li><LI CLASS="listitem">
72 <P CLASS="para">
73 <A CLASS="listitem" NAME="ch01-pgfId-952038">
74 </a>Sessions</p></li></ul></li></ul><P CLASS="para">
75 The name service solves the name-to-address problem mentioned earlier; it allows each computer to declare a specific name on the network that can be translated to a machine-readable IP address, much like today's DNS on the Internet. The datagram and session services are both secondary communication protocols used to transmit data back and forth from NetBIOS machines across the network.</p></div><DIV CLASS="sect2">
76 <H3 CLASS="sect2">
77 <A CLASS="title" NAME="ch01-pgfId-945521">
78 1.3.2 Getting a Name</a></h3><P CLASS="para">For a human being, getting a name is easy. However, for a machine on a NetBIOS network, it can be a little more complicated. Let's look at a few of the issues.</p><P CLASS="para">
79 In the NetBIOS world, when each machine comes online, it wants to claim a name for itself; this is called <I CLASS="firstterm">
80 name registration</i>. However, no two machines in the same workgroup should be able to claim the same name; this would cause endless confusion for any machine that wanted to communicate with either machine. There are two different approaches to ensuring that this doesn't happen:</p><UL CLASS="itemizedlist">
81 <LI CLASS="listitem">
82 <P CLASS="para">
83 <A CLASS="listitem" NAME="ch01-pgfId-945120">
84 </a>Use a <I CLASS="firstterm">
85 NetBIOS Name Server</i> (NBNS) to keep track of which hosts have registered a NetBIOS name. </p></li><LI CLASS="listitem">
86 <P CLASS="para">
87 <A CLASS="listitem" NAME="ch01-pgfId-945121">
88 </a>Allow each machine on the network to defend its name in the event that another machine attempts to use it.</p></li></ul><P CLASS="para">
89 <A CLASS="xref" HREF="ch01_03.html#ch01-86658">
90 Figure 1.8</a> illustrates a (failed) name registration, with and without a NetBIOS Name Server. </p><H4 CLASS="figure">
91 <A CLASS="title" NAME="ch01-86658">
92 Figure 1.8: NBNS versus non-NBNS name registration</a></h4><IMG CLASS="graphic" SRC="figs/sam.0108.gif" ALT="Figure 1.8"><P CLASS="para">
93 In addition, there must be a way to resolve a NetBIOS name to a specific IP address as mentioned earlier; this is known as <I CLASS="firstterm">
94 name resolution</i>. There are two different approaches with NBT here as well:</p><UL CLASS="itemizedlist">
95 <LI CLASS="listitem">
96 <P CLASS="para">
97 <A CLASS="listitem" NAME="ch01-pgfId-945526">
98 </a>Have each machine report back its IP address when it "hears" a broadcast request for its NetBIOS name.</p></li><LI CLASS="listitem">
99 <P CLASS="para">
100 <A CLASS="listitem" NAME="ch01-pgfId-945527">
101 </a>Use the NBNS to help resolve NetBIOS names to IP addresses. </p></li></ul><P CLASS="para">
102 <A CLASS="xref" HREF="ch01_03.html#ch01-72484">
103 Figure 1.9</a> illustrates the two types of name resolution. </p><H4 CLASS="figure">
104 <A CLASS="title" NAME="ch01-72484">
105 Figure 1.9: NBNS versus non-NBNS name resolution</a></h4><IMG CLASS="graphic" SRC="figs/sam.0109.gif" ALT="Figure 1.9"><P CLASS="para">
106 As you might expect, having an NBNS on your network can help out tremendously. To see exactly why, let's look at the non-NBNS method.</p><P CLASS="para">
107 Here, when a client machine boots, it will broadcast a message declaring that it wishes to register a specified NetBIOS name as its own. If nobody objects to the use of the name after multiple registration attempts, it keeps the name. On the other hand, if another machine on the local subnet is currently using the requested name, it will send a message back to the requesting client that the name is already taken. This is known as <I CLASS="firstterm">
108 defending</i> the hostname. This type of system comes in handy when one client has unexpectedly dropped off the network&nbsp;- another can take its name unchallenged&nbsp;- but it does incur an inordinate amount of traffic on the network for something as simple as name registration.</p><P CLASS="para">
109 With an NBNS, the same thing occurs, except that the communication is confined to the requesting machine and the NBNS server. No broadcasting occurs when the machine wishes to register the name; the registration message is simply sent directly from the client to NBNS server and the NBNS server replies whether or not the name is already taken. This is known as <I CLASS="firstterm">
110 point-to-point communication</i>, and is often beneficial on networks with more than one subnet. This is because routers are often preconfigured to block incoming packets that are broadcast to all machines in the subnet.</p><P CLASS="para">
111 The same principles apply to name resolution. Without an NBNS, NetBIOS name resolution would also be done with a broadcast mechanism. All request packets would be sent to each computer in the network, with the hope that one machine that might be affected will respond directly back to the machine that asked. At this point, it's clear that using an NBNS server and point-to-point communication for this purpose is far less taxing on the network than flooding the network with broadcasts for every name resolution request. </p></div><DIV CLASS="sect2">
112 <H3 CLASS="sect2">
113 <A CLASS="title" NAME="ch01-pgfId-945664">
114 1.3.3 Node Types</a></h3><P CLASS="para">How can you tell what strategy each client on your network will use when performing name registration and resolution? Each machine on an NBT network earns one of the following designations, depending on how it handles name registration and resolution: b-node, p-node, m-node, and h-node. The behaviors of each type of node are summarized in <A CLASS="xref" HREF="ch01_03.html#ch01-91681">
115 Table 1.1</a>. </p><br>
116 <TABLE CLASS="table" BORDER="1" CELLPADDING="3">
117 <CAPTION CLASS="table">
118 <A CLASS="title" NAME="ch01-91681">
119 Table 1.1: NetBIOS Node Types </a></caption><THEAD CLASS="thead">
120 <TR CLASS="row" VALIGN="TOP">
121 <TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
122 <P CLASS="para">
123 Role</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
124 <P CLASS="para">
125 Value</p></th></tr></thead><TBODY CLASS="tbody">
126 <TR CLASS="row" VALIGN="TOP">
127 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
128 <P CLASS="para">
129 b-node</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
130 <P CLASS="para">
131 Uses broadcast registration and resolution only.</p></td></tr><TR CLASS="row" VALIGN="TOP">
132 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
133 <P CLASS="para">
134 p-node</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
135 <P CLASS="para">
136 Uses point-to-point registration and resolution only.</p></td></tr><TR CLASS="row" VALIGN="TOP">
137 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
138 <P CLASS="para">
139 m-node</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
140 <P CLASS="para">
141 Uses broadcast for registration. If successful, it notifies the NBNS server of the result. Uses broadcast for resolution; uses NBNS server if broadcast is unsuccessful.</p></td></tr><TR CLASS="row" VALIGN="TOP">
142 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
143 <P CLASS="para">
144 h-node (hybrid)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
145 <P CLASS="para">
146 Uses NBNS server for registration and resolution; uses broadcast if the NBNS server is unresponsive or inoperative.</p></td></tr></tbody></table><P CLASS="para">
147 In the case of Windows clients, you will usually find them listed as <I CLASS="firstterm">
148 h-nodes</i> or <I CLASS="firstterm">
149 hybrid nodes</i>. Incidentally, h-nodes were invented later by Microsoft, as a more  fault-tolerant route, and do not appear in RFC 1001/1002.</p><P CLASS="para">
150 You can find out the node type of any Windows machine by typing the command <CODE CLASS="literal">
151 ipconfig</code> <CODE CLASS="literal">
152 /all</code> and searching for the line that says <CODE CLASS="literal">
153 Node Type</code>.</p>
154
155 <PRE CLASS="programlisting"><B CLASS="emphasis.bold">C:\&gt; ipconfig /all</b>
156 </pre><PRE CLASS="programlisting">
157 Windows 98 IP Configuration
158 ...
159   Node Type .  .  .  .  .  .  .  .  .  .  : Hybrid
160 ...</pre></div><DIV CLASS="sect2">
161 <H3 CLASS="sect2">
162 <A CLASS="title" NAME="ch01-pgfId-945128">
163 1.3.4 What's in a Name?</a></h3><P CLASS="para">
164 The names NetBIOS uses are quite different from the DNS hostnames you might be familiar with. First, NetBIOS names exist in a flat namespace. In other words, there are no qualifiers such as <i>ora.com</i> or <i>samba.org</i> to section off hostnames; there is only a single unique name to represent each computer. Second, NetBIOS names are allowed to be only 15 characters, may not begin with an asterisk (*), and can consist only of standard alphanumeric characters (a-z, A-Z, 0-9) and the following:</p><PRE CLASS="programlisting">
165 ! @ # $ % ^ &amp; ( ) - ' { } . ~ </pre><P CLASS="para">
166 Although you are allowed to use a period (.) in a NetBIOS name, we recommend against it because those names are not guaranteed to work in future versions of NetBIOS over TCP/IP.</p><P CLASS="para">
167 It's not a coincidence that all valid DNS names are also valid NetBIOS names. In fact, the DNS name for a Samba server is often reused as its NetBIOS name. For example, if you had a machine <CODE CLASS="literal">
168 phoenix.ora.com</code>, its NetBIOS name would likely be PHOENIX (followed by 8 blanks).</p><DIV CLASS="sect3">
169 <H4 CLASS="sect3">
170 <A CLASS="title" NAME="ch01-pgfId-946016">
171 1.3.4.1 Resource names and types</a></h4><P CLASS="para">
172 With NetBIOS, a machine not only advertises its presence, but also tells others what types of services it offers. For example, <CODE CLASS="literal">
173 phoenix</code> can indicate that it's not just a workstation, but is also a file server and can receive WinPopup messages. This is done by adding a 16th byte to the end of the machine (resource) name, called the <I CLASS="firstterm">resource type</i>, and registering the name more than once. See <A CLASS="xref" HREF="ch01_03.html#ch01-74707">
174 Figure 1.10</a>. </p><H4 CLASS="figure">
175 <A CLASS="title" NAME="ch01-74707">
176 Figure 1.10: The structure of NetBIOS names</a></h4><IMG CLASS="graphic" SRC="figs/sam.0110.gif" ALT="Figure 1.10"><P CLASS="para">
177 The one-byte resource type indicates a unique service the named machine provides. In this book, you will often see the resource type shown in angled brackets (&lt;&gt;) after the NetBIOS name, such as:</p><PRE CLASS="programlisting">PHOENIX&lt;00&gt;</pre><P CLASS="para">
178 You can see which names are registered for a particular NBT machine using the Windows command-line NBTSTAT utility. Because these services are unique (i.e., there cannot be more than one registered), you will see them listed as type UNIQUE in the output. For example, the following partial output describes the <CODE CLASS="literal">
179 hydra</code> server:</p><PRE CLASS="programlisting"><B CLASS="emphasis.bold">D:\&gt; NBTSTAT -a hydra</b><B CLASS="emphasis.bold"></b></pre><PRE CLASS="programlisting">
180        NetBIOS Remote Machine Name Table
181    Name               Type         Status
182 ---------------------------------------------
183 HYDRA          &lt;00&gt;  UNIQUE      Registered
184 HYDRA          &lt;03&gt;  UNIQUE      Registered
185 HYDRA          &lt;20&gt;  UNIQUE      Registered
186 ...</pre><P CLASS="para">
187 This says the server has registered the NetBIOS name <CODE CLASS="literal">
188 hydra</code> as a machine (workstation) name, a recipient of WinPopup messages, and a file server. Some possible attributes a name can have are listed in <A CLASS="xref" HREF="ch01_03.html#ch01-11471">
189 Table 1.2</a>. </p><br>
190 <TABLE CLASS="table" BORDER="1" CELLPADDING="3">
191 <CAPTION CLASS="table">
192 <A CLASS="title" NAME="ch01-11471">
193 Table 1.2: NetBIOS Unique Resource Types </a></caption><THEAD CLASS="thead">
194 <TR CLASS="row" VALIGN="TOP">
195 <TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
196 <P CLASS="para">Named Resource</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
197 <P CLASS="para">Hexidecimal Byte Value</p></th></tr></thead><TBODY CLASS="tbody">
198 <TR CLASS="row" VALIGN="TOP">
199 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
200 <P CLASS="para">
201 Standard Workstation Service</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
202 <P CLASS="para">
203 00</p></td></tr><TR CLASS="row" VALIGN="TOP">
204 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
205 <P CLASS="para">
206 Messenger Service (WinPopup)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
207 <P CLASS="para">
208 03</p></td></tr><TR CLASS="row" VALIGN="TOP">
209 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
210 <P CLASS="para">
211 RAS Server Service</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
212 <P CLASS="para">
213 06</p></td></tr><TR CLASS="row" VALIGN="TOP">
214 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
215 <P CLASS="para">
216 Domain Master Browser Service (associated with primary domain controller)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
217 <P CLASS="para">
218 1B</p></td></tr><TR CLASS="row" VALIGN="TOP">
219 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
220 <P CLASS="para">
221 Master Browser name</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
222 <P CLASS="para">
223 1D</p></td></tr><TR CLASS="row" VALIGN="TOP">
224 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
225 <P CLASS="para">
226 NetDDE Service</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
227 <P CLASS="para">
228 1F</p></td></tr><TR CLASS="row" VALIGN="TOP">
229 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
230 <P CLASS="para">
231 Fileserver (including printer server)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
232 <P CLASS="para">
233 20</p></td></tr><TR CLASS="row" VALIGN="TOP">
234 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
235 <P CLASS="para">
236 RAS Client Service</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
237 <P CLASS="para">
238 21</p></td></tr><TR CLASS="row" VALIGN="TOP">
239 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
240 <P CLASS="para">
241 Network Monitor Agent</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
242 <P CLASS="para">
243 BE</p></td></tr><TR CLASS="row" VALIGN="TOP">
244 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
245 <P CLASS="para">
246 Network Monitor Utility</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
247 <P CLASS="para">
248 BF</p></td></tr></tbody></table><P CLASS="para">
249 Note that because DNS names don't have resource types, the designers intentionally made hexidecimal value 20 (an ASCII space) default to the type for a file server.</p></div><DIV CLASS="sect3">
250 <H4 CLASS="sect3">
251 <A CLASS="title" NAME="ch01-pgfId-946074">
252 1.3.4.2 Group names and types</a></h4><P CLASS="para">SMB also uses the concept of groups, with which machines can register themselves. Earlier, we mentioned that the machines in our example belonged to a <I CLASS="firstterm">
253 workgroup</i>, which is a partition of machines on the same network. For example, a business might very easily have an ACCOUNTING and a SALES workgroup, each with different servers and printers. In the Windows world, a workgroup and an SMB group are the same thing.</p><P CLASS="para">
254 Continuing our NBTSTAT example, the <CODE CLASS="literal">
255 hydra</code> Samba server is also a member of the SIMPLE workgroup (the GROUP attribute hex 00), and will stand for election as a browse master (GROUP attribute 1E). Here is the remainder of the NBTSTAT utility output:</p><PRE CLASS="programlisting">
256        NetBIOS Remote Machine Name Table, continued
257    Name               Type         Status
258 ---------------------------------------------
259 SIMPLE           &lt;00&gt;  GROUP       Registered
260 SIMPLE           &lt;1E&gt;  GROUP       Registered
261 ..__MSBROWSE__.  &lt;01&gt;  GROUP       Registered</pre><P CLASS="para">
262 The possible group attributes a machine can have are illustrated in <A CLASS="xref" HREF="ch01_03.html#ch01-52395">
263 Table 1.3</a>. More information is available in <i>Windows NT in a Nutshell</i> by Eric Pearce, also published by O'Reilly.  </p><br>
264 <TABLE CLASS="table" BORDER="1" CELLPADDING="3">
265 <CAPTION CLASS="table">
266 <A CLASS="title" NAME="ch01-52395">
267 Table 1.3: NetBIOS Group Resource Types </a></caption><THEAD CLASS="thead">
268 <TR CLASS="row" VALIGN="TOP">
269 <TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
270 <P CLASS="para">
271 Named Resource  </p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
272 <P CLASS="para">Hexidecimal Byte Value</p></th></tr></thead><TBODY CLASS="tbody">
273 <TR CLASS="row" VALIGN="TOP">
274 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
275 <P CLASS="para">
276 Standard Workstation group</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
277 <P CLASS="para">
278 00</p></td></tr><TR CLASS="row" VALIGN="TOP">
279 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
280 <P CLASS="para">
281 Logon Server </p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
282 <P CLASS="para">
283 1C</p></td></tr><TR CLASS="row" VALIGN="TOP">
284 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
285 <P CLASS="para">
286 Master Browser name </p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
287 <P CLASS="para">
288 1D</p></td></tr><TR CLASS="row" VALIGN="TOP">
289 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
290 <P CLASS="para">
291 Normal Group name (used in browser elections)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
292 <P CLASS="para">
293 1E</p></td></tr><TR CLASS="row" VALIGN="TOP">
294 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
295 <P CLASS="para">
296 Internet Group name (administrative)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
297 <P CLASS="para">
298 20</p></td></tr><TR CLASS="row" VALIGN="TOP">
299 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
300 <P CLASS="para">
301 <CODE CLASS="literal">
302 &lt;01&gt;&lt;02&gt;__MSBROWSE__&lt;02&gt;</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
303 <P CLASS="para">
304 01</p></td></tr></tbody></table><P CLASS="para">
305 The final entry, <CODE CLASS="literal">
306 __MSBROWSE__</code>, is used to announce a group to other master browsers. The nonprinting characters in the name show up as dots in a NBTSTAT printout. Don't worry if you don't understand all of the resource or group types. Some of them you will not need with Samba, and others you will pick up as you move through the rest of the chapter. The important thing to remember here is the logistics of the naming mechanism. </p></div></div><DIV CLASS="sect2">
307 <H3 CLASS="sect2">
308 <A CLASS="title" NAME="ch01-pgfId-946130">
309 1.3.5 Datagrams and Sessions</a></h3><P CLASS="para">
310 <I CLASS="firstterm">
311 </i>At this point, let's digress to introduce another responsibility of NBT: to provide connection services between two NetBIOS machines. There are actually two services offered by NetBIOS over TCP/IP: the <I CLASS="firstterm">
312 session service</i> and the <I CLASS="firstterm">
313 datagram service</i>. Understanding how these two services work is not essential to using Samba, but it does give you an idea of how NBT works and how to troubleshoot Samba when it doesn't work.</p><P CLASS="para">
314 The datagram service has no stable connection between one machine and another. Packets of data are simply sent or broadcast from one machine to another, without regard for the order that they arrive at the destination, or even if they arrive at all. The use of datagrams is not as network intensive as sessions, although they can bog down a network if used unwisely (remember broadcast name resolution earlier?) Datagrams, therefore, are used for quickly sending simple blocks of data to one or more machines. The datagram service communicates using the simple primitives shown in <A CLASS="xref" HREF="ch01_03.html#ch01-pgfId-946185">
315 Table 1.4</a>. </p><br>
316 <TABLE CLASS="table" BORDER="1" CELLPADDING="3">
317 <CAPTION CLASS="table">
318 <A CLASS="title" NAME="ch01-pgfId-946185">
319 Table 1.4: Datagram Primitives </a></caption><THEAD CLASS="thead">
320 <TR CLASS="row" VALIGN="TOP">
321 <TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
322 <P CLASS="para">
323 Primitive</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
324 <P CLASS="para">
325 Description</p></th></tr></thead><TBODY CLASS="tbody">
326 <TR CLASS="row" VALIGN="TOP">
327 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
328 <P CLASS="para">
329 Send Datagram</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
330 <P CLASS="para">
331 Send datagram packet to machine or groups of machines.</p></td></tr><TR CLASS="row" VALIGN="TOP">
332 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
333 <P CLASS="para">
334 Send Broadcast Datagram</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
335 <P CLASS="para">
336 Broadcast datagram to any machine waiting with a Receive Broadcast Datagram.</p></td></tr><TR CLASS="row" VALIGN="TOP">
337 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
338 <P CLASS="para">
339 Receive Datagram</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
340 <P CLASS="para">
341 Receive a datagram from a machine.</p></td></tr><TR CLASS="row" VALIGN="TOP">
342 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
343 <P CLASS="para">
344 Receive Broadcast Datagram</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
345 <P CLASS="para">
346 Wait for a broadcast datagram.</p></td></tr></tbody></table><P CLASS="para">
347 The session service is more complex. Sessions are a communication method that, in theory, offers the ability to detect problematic or inoperable connections between two NetBIOS applications. It helps to think of an NBT session in terms of a telephone call.[<A CLASS="footnote" HREF="#ch01-pgfId-946249">5</a>] A full-duplex connection is opened between a caller machine and a called machine, and it must remain open throughout the duration of their conversation. Each side knows who the caller and the called machine is, and can communicate with the simple primitives shown in <A CLASS="xref" HREF="ch01_03.html#ch01-pgfId-946256">
348 Table 1.5</a>. </p><BLOCKQUOTE CLASS="footnote">
349 <DIV CLASS="footnote">
350 <P CLASS="para">
351 <A CLASS="footnote" NAME="ch01-pgfId-946249">[5]</a> As you can see in RFC 1001, the telephone analogy was strongly evident in the creation of the NBT service.</p></div></blockquote><br>
352 <TABLE CLASS="table" BORDER="1" CELLPADDING="3">
353 <CAPTION CLASS="table">
354 <A CLASS="title" NAME="ch01-pgfId-946256">
355 Table 1.5: Session Primitives </a></caption><THEAD CLASS="thead">
356 <TR CLASS="row" VALIGN="TOP">
357 <TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
358 <P CLASS="para">
359 Primitive</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
360 <P CLASS="para">
361 Description</p></th></tr></thead><TBODY CLASS="tbody">
362 <TR CLASS="row" VALIGN="TOP">
363 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
364 <P CLASS="para">
365 Call</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
366 <P CLASS="para">
367 Initiate a session with a machine listening under a specified name.</p></td></tr><TR CLASS="row" VALIGN="TOP">
368 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
369 <P CLASS="para">
370 Listen</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
371 <P CLASS="para">
372 Wait for a call from a known caller or any caller.</p></td></tr><TR CLASS="row" VALIGN="TOP">
373 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
374 <P CLASS="para">
375 Hang-up</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
376 <P CLASS="para">
377 Exit a call.</p></td></tr><TR CLASS="row" VALIGN="TOP">
378 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
379 <P CLASS="para">
380 Send</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
381 <P CLASS="para">
382 Send data to the other machine.</p></td></tr><TR CLASS="row" VALIGN="TOP">
383 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
384 <P CLASS="para">
385 Receive</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
386 <P CLASS="para">
387 Receive data from the other machine.</p></td></tr><TR CLASS="row" VALIGN="TOP">
388 <TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
389 <P CLASS="para">
390 Session Status</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
391 <P CLASS="para">
392 Get information on requested sessions.</p></td></tr></tbody></table><P CLASS="para">
393 Sessions are the backbone of resource sharing on an NBT network. They are typically used for establishing stable connections from client machines to disk or printer shares on a server. The client "calls" the server and starts trading information such as which files it wishes to open, which data it wishes to exchange, etc. These calls can last a long time&nbsp;- hours, even days&nbsp;- and all of this occurs within the context of a single connection. If there is an error, the session software (TCP) will retransmit until the data is received properly, unlike the "punt-and-pray" approach of the datagram service (UDP).</p><P CLASS="para">
394 In truth, while sessions are supposed to be able to handle problematic communications, they often don't. As you've probably already discovered when using Windows networks, this is a serious detriment to using NBT sessions. If the connection is interrupted for some reason, session information that is open between the two computers can easily become invalidated. If that happens, the only way to regain the session information is for the same two computers to call each other again and start over.</p><P CLASS="para">
395 If you want more information on each of these services, we recommend you look at RFC 1001. However, there are two important things to remember here:</p><UL CLASS="itemizedlist">
396 <LI CLASS="listitem">
397 <P CLASS="para">
398 <A CLASS="listitem" NAME="ch01-pgfId-946210">
399 </a>Sessions always occur between <EM CLASS="emphasis">
400 two</em> NetBIOS machines&nbsp;- no more and no less. If a session service is interrupted, the client is supposed to store sufficient state information for it to re-establish the connection. However, in practice, this is rarely the case.</p></li><LI CLASS="listitem">
401 <P CLASS="para">
402 <A CLASS="listitem" NAME="ch01-pgfId-946211">
403 </a>Datagrams can be broadcast to multiple machines, but they are unreliable. In other words, there is no way for the source to know that the datagrams it sent have indeed arrived at their<I CLASS="firstterm">
404 </i> destinations. </p></li></ul></div></div></blockquote>
405 <div>
406 <center>
407 <hr noshade size=1><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0">
408 <TR>
409 <TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172">
410 <A CLASS="sect1" HREF="ch01_02.html" TITLE="1.2 What Can Samba Do For Me?">
411 <IMG SRC="gifs/txtpreva.gif" ALT="Previous: 1.2 What Can Samba Do For Me?" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171">
412 <A CLASS="book" HREF="index.html" TITLE="">
413 <IMG SRC="gifs/txthome.gif" ALT="" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172">
414 <A CLASS="sect1" HREF="ch01_04.html" TITLE="1.4 Microsoft Implementations">
415 <IMG SRC="gifs/txtnexta.gif" ALT="Next: 1.4 Microsoft Implementations" BORDER="0"></a></td></tr><TR>
416 <TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172">
417 1.2 What Can Samba Do For Me?</td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171">
418 <A CLASS="index" HREF="inx.html" TITLE="Book Index">
419 <IMG SRC="gifs/index.gif" ALT="Book Index" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172">
420 1.4 Microsoft Implementations</td></tr></table><hr noshade size=1></center>
421 </div>
422
423 <!-- End of sample chapter -->
424 <CENTER>
425 <FONT SIZE="1" FACE="Verdana, Arial, Helvetica">
426 <A HREF="http://www.oreilly.com/">
427 <B>O'Reilly Home</B></A> <B> | </B>
428 <A HREF="http://www.oreilly.com/sales/bookstores">
429 <B>O'Reilly Bookstores</B></A> <B> | </B>
430 <A HREF="http://www.oreilly.com/order_new/">
431 <B>How to Order</B></A> <B> | </B>
432 <A HREF="http://www.oreilly.com/oreilly/contact.html">
433 <B>O'Reilly Contacts<BR></B></A>
434 <A HREF="http://www.oreilly.com/international/">
435 <B>International</B></A> <B> | </B>
436 <A HREF="http://www.oreilly.com/oreilly/about.html">
437 <B>About O'Reilly</B></A> <B> | </B>
438 <A HREF="http://www.oreilly.com/affiliates.html">
439 <B>Affiliated Companies</B></A><p>
440 <EM>&copy; 1999, O'Reilly &amp; Associates, Inc.</EM>
441 </FONT>
442 </CENTER>
443 </BODY>
444 </html>