1<HTML> 2<HEAD> 3<TITLE> 4[Chapter 4] 4.6 Networking Options with Samba</title><META NAME="DC.title" CONTENT=""><META NAME="DC.creator" CONTENT=""><META NAME="DC.publisher" CONTENT="O'Reilly & Associates, Inc."><META NAME="DC.date" CONTENT="1999-11-05T21:32:15Z"><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" 10alt="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"> 16Robert 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="ch04_05.html" TITLE="4.5 Disk Share Configuration"> 35<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 4.5 Disk Share Configuration" 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="ch04_01.html" TITLE="4. Disk Shares "> 39Chapter 4<br> 40Disk Shares </a></font></b></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 41<A CLASS="sect1" HREF="ch04_07.html" TITLE="4.7 Virtual Servers"> 42<IMG SRC="gifs/txtnexta.gif" ALT="Next: 4.7 Virtual Servers" BORDER="0"></a></td></tr></table> <hr noshade size=1></center> 43</div> 44<blockquote> 45<div> 46<H2 CLASS="sect1"> 47<A CLASS="title" NAME="ch04-86705"> 484.6 Networking Options with Samba</a></h2><P CLASS="para">If you're running Samba on a multi-homed machine (that is, one on multiple subnets), or even if you want to implement a security policy on your own subnet, you should take a close look at the networking configuration options: </p><P CLASS="para"> 49For the purposes of this exercise, let's assume that our Samba server is connected to a network with more than one subnet. Specifically, the machine can access both the 192.168.220.* and 134.213.233.* subnets. Here are our additions to the ongoing configuration file for the networking configuration options:</p><PRE CLASS="programlisting"> 50[global] 51 netbios name = HYDRA 52 server string = Samba %v on (%L) 53 workgroup = SIMPLE 54 55 # Networking configuration options 56 hosts allow = 192.168.220. 134.213.233. localhost 57 hosts deny = 192.168.220.102 58 interfaces = 192.168.220.100/255.255.255.0 \ 59 134.213.233.110/255.255.255.0 60 bind interfaces only = yes 61 62[data] 63 path = /home/samba/data 64 guest ok = yes 65 comment = Data Drive 66 volume = Sample-Data-Drive 67 writeable = yes 68 </pre><P CLASS="para">Let's first talk about the <CODE CLASS="literal"> 69hosts</code> <CODE CLASS="literal"> 70allow</code> and <CODE CLASS="literal"> 71hosts</code> <CODE CLASS="literal"> 72deny</code> options. If these options sound familiar, you're probably thinking of the <I CLASS="filename"> 73hosts.allow</i> and <I CLASS="filename"> 74hosts.deny</i> files that are found in the <I CLASS="filename"> 75/etc</i> directories of many Unix systems. The purpose of these options is identical to those files; they provide a means of security by allowing or denying the connections of other hosts based on their IP addresses. Why not just use the <I CLASS="filename"> 76hosts.allow</i> and <I CLASS="filename"> 77hosts.deny</i> files themselves? Because there may be services on the server that you want others to access without giving them access Samba's disk or printer shares</p><P CLASS="para"> 78With the <CODE CLASS="literal"> 79hosts</code> <CODE CLASS="literal"> 80allow</code> option above, we've specified a cropped IP address: 192.168.220. (Note that there is still a third period; it's just missing the fourth number.) This is equivalent to saying: "All hosts on the 192.168.220 subnet." However, we've explicitly specified in a hosts deny line that 192.168.220.102 is not to be allowed access.</p><P CLASS="para"> 81You might be wondering: why will 192.168.220.102 be denied even though it is still in the subnet matched by the <CODE CLASS="literal"> 82hosts</code> <CODE CLASS="literal"> 83allow</code> option? Here is how Samba sorts out the rules specified by <CODE CLASS="literal"> 84hosts</code> <CODE CLASS="literal"> 85allow</code> and <CODE CLASS="literal"> 86hosts</code> <CODE CLASS="literal"> 87deny</code>:</p><OL CLASS="orderedlist"> 88<LI CLASS="listitem"> 89<P CLASS="para"> 90<A CLASS="listitem" NAME="ch04-pgfId-961914"> 91</a>If there are no <CODE CLASS="literal"> 92allow</code> or <CODE CLASS="literal"> 93deny</code> options defined anywhere in <I CLASS="filename"> 94smb.conf</i>, Samba will allow connections from any machine allowed by the system itself.</p></li><LI CLASS="listitem"> 95<P CLASS="para"> 96<A CLASS="listitem" NAME="ch04-pgfId-961915"> 97</a>If there are <CODE CLASS="literal"> 98hosts</code> <CODE CLASS="literal"> 99allow</code> or <CODE CLASS="literal"> 100hosts</code> <CODE CLASS="literal"> 101deny</code> options defined in the <CODE CLASS="literal"> 102[global]</code> section of <I CLASS="filename"> 103smb.conf</i>, they will apply to all shares, even if the shares have an overriding option defined.</p></li><LI CLASS="listitem"> 104<P CLASS="para"> 105<A CLASS="listitem" NAME="ch04-pgfId-961916"> 106</a>If there is only a <CODE CLASS="literal"> 107hosts</code> <CODE CLASS="literal"> 108allow</code> option defined for a share, only the hosts listed will be allowed to use the share. All others will be denied.</p></li><LI CLASS="listitem"> 109<P CLASS="para"> 110<A CLASS="listitem" NAME="ch04-pgfId-961917"> 111</a>If there is only a <CODE CLASS="literal"> 112hosts</code> <CODE CLASS="literal"> 113deny</code> option defined for a share, any machine which is not on the list will be able to use the share.</p></li><LI CLASS="listitem"> 114<P CLASS="para"> 115<A CLASS="listitem" NAME="ch04-pgfId-961918"> 116</a>If both a <CODE CLASS="literal"> 117hosts</code> <CODE CLASS="literal"> 118allow</code> and <CODE CLASS="literal"> 119hosts</code> <CODE CLASS="literal"> 120deny</code> option are defined, a host must appear in the allow list and not appear in the deny list (in any form) in order to access the share. Otherwise, the host will not be allowed.</p><BLOCKQUOTE CLASS="warning"> 121<P CLASS="para"> 122<STRONG> 123WARNING:</strong> Take care that you don't explicitly allow a host to access a share, but then deny access to the entire subnet of which the host is part.</p></blockquote></li></ol><P CLASS="para"> 124Let's look at another example of that final item. Consider the following options:</p><PRE CLASS="programlisting"> 125hosts allow = 111.222. 126hosts deny = 111.222.333.</pre><P CLASS="para"> 127In this case, only the hosts that belong to the subnet 111.222.*.* will be allowed access to the Samba shares. However, if a client belongs to the 111.222.333.* subnet, it will be denied access, even though it still matches the qualifications outlined by <CODE CLASS="literal"> 128hosts</code> <CODE CLASS="literal"> 129allow</code>. The client must appear on the <CODE CLASS="literal"> 130hosts</code> <CODE CLASS="literal"> 131allow</code> list and <EM CLASS="emphasis"> 132must not</em> appear on the <CODE CLASS="literal"> 133hosts</code> <CODE CLASS="literal"> 134deny</code> list in order to gain access to a Samba share. If a computer attempts to access a share to which it is not allowed access, it will receive an error message.</p><P CLASS="para"> 135The other two options that we've specified are the <CODE CLASS="literal"> 136interfaces</code> and the <CODE CLASS="literal"> 137bind</code> <CODE CLASS="literal"> 138interface</code> <CODE CLASS="literal"> 139only</code> address. Let's look at the <CODE CLASS="literal"> 140interfaces</code> option first. Samba, by default, sends data only from the primary network interface, which in our example is the 192.168.220.100 subnet. If we would like it to send data to more than that one interface, we need to specify the complete list with the <CODE CLASS="literal"> 141interfaces</code> option. In the previous example, we've bound Samba to interface with both subnets (192.168.220 and 134.213.233) on which the machine is operating by specifying the other network interface address: 134.213.233.100. If you have more than one interface on your computer, you should always set this option as there is no guarantee that the primary interface that Samba chooses will be the right one.</p><P CLASS="para"> 142Finally, the <CODE CLASS="literal"> 143bind</code> <CODE CLASS="literal"> 144interfaces</code> <CODE CLASS="literal"> 145only</code> option instructs the <I CLASS="filename"> 146nmbd</i> process not to accept any broadcast messages other than those subnets specified with the <CODE CLASS="literal"> 147interfaces</code> option. Note that this is different from the <CODE CLASS="literal"> 148hosts</code> <CODE CLASS="literal"> 149allow</code> and <CODE CLASS="literal"> 150hosts</code> <CODE CLASS="literal"> 151deny</code> options, which prevent machines from making connections to services, but not from receiving broadcast messages. Using the <CODE CLASS="literal"> 152bind</code> <CODE CLASS="literal"> 153interfaces</code> <CODE CLASS="literal"> 154only</code> option is a way to shut out even datagrams from foreign subnets from being received by the Samba server. In addition, it instructs the <EM CLASS="emphasis"> 155smbd </em>process to bind to only the interface list given by the <EM CLASS="emphasis"> 156interfaces</em> option. This restricts the networks that Samba will serve.</p><DIV CLASS="sect2"> 157<H3 CLASS="sect2"> 158<A CLASS="title" NAME="ch04-pgfId-961674"> 1594.6.1 Networking Options</a></h3><P CLASS="para">The networking options we introduced above are summarized in <A CLASS="xref" HREF="ch04_06.html#ch04-32963"> 160Table 4.5</a>. </p><br> 161<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 162<CAPTION CLASS="table"> 163<A CLASS="title" NAME="ch04-32963"> 164Table 4.5: Networking Configuration Options </a></caption><THEAD CLASS="thead"> 165<TR CLASS="row" VALIGN="TOP"> 166<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 167<P CLASS="para"> 168Option</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 169<P CLASS="para"> 170Parameters</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 171<P CLASS="para"> 172Function</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 173<P CLASS="para"> 174Default</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 175<P CLASS="para"> 176Scope</p></th></tr></thead><TBODY CLASS="tbody"> 177<TR CLASS="row" VALIGN="TOP"> 178<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 179<P CLASS="para"> 180<CODE CLASS="literal"> 181hosts allow (allow hosts)</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 182<P CLASS="para"> 183string (list of hostnames)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 184<P CLASS="para"> 185Specifies the machines that can connect to Samba.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 186<P CLASS="para"> 187none</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 188<P CLASS="para"> 189Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 190<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 191<P CLASS="para"> 192<CODE CLASS="literal"> 193hosts deny (deny hosts)</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 194<P CLASS="para"> 195string (list of hostnames)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 196<P CLASS="para"> 197Specifies the machines that cannot connect to Samba.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 198<P CLASS="para"> 199none</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 200<P CLASS="para"> 201Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 202<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 203<P CLASS="para"> 204<CODE CLASS="literal"> 205interfaces</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 206<P CLASS="para"> 207string (list of IP/netmask combinations)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 208<P CLASS="para"> 209Sets the network interfaces Samba will respond to. Allows correcting defaults.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 210<P CLASS="para"> 211system-dependent</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 212<P CLASS="para"> 213Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 214<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 215<P CLASS="para"> 216<CODE CLASS="literal"> 217bind</code></p><P CLASS="para"> 218<CODE CLASS="literal"> 219interfaces only</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 220<P CLASS="para"> 221boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 222<P CLASS="para"> 223If set to <CODE CLASS="literal"> 224yes</code>, Samba will bind only to those interfaces specified by the <CODE CLASS="literal"> 225interfaces</code> option.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 226<P CLASS="para"> 227<CODE CLASS="literal"> 228no</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 229<P CLASS="para"> 230Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 231<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 232<P CLASS="para"> 233<CODE CLASS="literal"> 234socket</code></p><P CLASS="para"> 235<CODE CLASS="literal"> 236address</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 237<P CLASS="para"> 238string (IP address)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 239<P CLASS="para"> 240Sets IP address to listen on, for use with multiple virtual interfaces on a server.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 241<P CLASS="para"> 242none</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 243<P CLASS="para"> 244Global</p></td></tr></tbody></table><DIV CLASS="sect3"> 245<H4 CLASS="sect3"> 246<A CLASS="title" NAME="ch04-pgfId-961754"> 2474.6.1.1 hosts allow</a></h4><P CLASS="para">The <CODE CLASS="literal"> 248hosts</code> <CODE CLASS="literal"> 249allow</code> option (sometimes written as <CODE CLASS="literal"> 250allow</code> <CODE CLASS="literal"> 251hosts</code>) specifies the machines that have permission to access shares on the Samba server, written as a comma- or space-separated list of names of machines or their IP addresses. You can gain quite a bit of security by simply placing your LAN's subnet address in this option. For example, we specified the following in our example:</p><PRE CLASS="programlisting"> 252hosts allow = 192.168.220. localhost</pre><P CLASS="para"> 253Note that we placed <CODE CLASS="literal"> 254localhost</code> after the subnet address. One of the most common mistakes when attempting to use the <CODE CLASS="literal"> 255hosts</code> <CODE CLASS="literal"> 256allow</code> option is to accidentally disallow the Samba server from communicating with itself. The <I CLASS="filename"> 257smbpasswd</i> program will occasionally need to connect to the Samba server as a client in order to change a user's encrypted password. In addition, local browsing propagation requires local host access. If this option is enabled and the localhost address is not specified, the locally-generated packets requesting the change of the encrypted password will be discarded by Samba, and browsing propagation will not work properly. To avoid this, explicitly allow the loopback address (either <CODE CLASS="literal"> 258localhost</code> or <CODE CLASS="literal"> 259127.0.0.1</code>) to be used.[<A CLASS="footnote" HREF="#ch04-pgfId-965714">3</a>] </p><BLOCKQUOTE CLASS="footnote"> 260<DIV CLASS="footnote"> 261<P CLASS="para"> 262<A CLASS="footnote" NAME="ch04-pgfId-965714">[3]</a> Starting with Samba 2.0.5, <CODE CLASS="literal"> 263localhost</code> will automatically be allowed unless it is explicitly denied.</p></div></blockquote><P CLASS="para"> 264You can specify any of the following formats for this option: </p><UL CLASS="itemizedlist"> 265<LI CLASS="listitem"> 266<P CLASS="para"> 267<A CLASS="listitem" NAME="ch04-pgfId-959824"> 268</a>Hostnames, such as <CODE CLASS="literal"> 269ftp.example.com</code>.</p></li><LI CLASS="listitem"> 270<P CLASS="para"> 271<A CLASS="listitem" NAME="ch04-pgfId-959825"> 272</a>IP addresses, like <CODE CLASS="literal"> 273130.63.9.252</code>.</p></li><LI CLASS="listitem"> 274<P CLASS="para"> 275<A CLASS="listitem" NAME="ch04-pgfId-959826"> 276</a>Domain names, which can be differentiated from individual hostnames because they start with a dot. For example, <CODE CLASS="literal">.ora.com</code> represents all machines within the <EM CLASS="emphasis"> 277ora.com</em> domain.</p></li><LI CLASS="listitem"> 278<P CLASS="para"> 279<A CLASS="listitem" NAME="ch04-pgfId-959827"> 280</a>Netgroups, which start with an at-sign, such as <CODE CLASS="literal"> 281@printerhosts</code>. Netgroups are available on systems running yellow pages/NIS or NIS+, but rarely otherwise. If netgroups are supported on your system, there should be a <CODE CLASS="literal"> 282netgroups</code> manual page that describes them in more detail.</p></li><LI CLASS="listitem"> 283<P CLASS="para"> 284<A CLASS="listitem" NAME="ch04-pgfId-959828"> 285</a>Subnets, which end with a dot. For example, <CODE CLASS="literal"> 286130.63.9.</code> means all the machines whose IP addresses begin with 130.63.9.</p></li><LI CLASS="listitem"> 287<P CLASS="para"> 288<A CLASS="listitem" NAME="ch04-pgfId-959830"> 289</a>The keyword <CODE CLASS="literal"> 290ALL</code>, which allows any client access.</p></li><LI CLASS="listitem"> 291<P CLASS="para"> 292<A CLASS="listitem" NAME="ch04-pgfId-959831"> 293</a>The keyword <CODE CLASS="literal"> 294EXCEPT</code> followed by more one or more names, IP addresses, domain names, netgroups, or subnets. For example, you could specify that Samba allow all hosts except those on the 192.168.110 subnet with <CODE CLASS="literal"> 295hosts</code> <CODE CLASS="literal"> 296allow</code> <CODE CLASS="literal"> 297=</code> <CODE CLASS="literal"> 298ALL</code> <CODE CLASS="literal"> 299EXCEPT</code> <CODE CLASS="literal"> 300192.168.110.</code> (remember the trailing dot).</p></li></ul><P CLASS="para"> 301Using the <CODE CLASS="literal"> 302ALL</code> keyword is almost always a bad idea, since it means that anyone on any network can browse your files if they guess the name of your server. </p><P CLASS="para"> 303Note that there is no default value for the <CODE CLASS="literal"> 304hosts</code> <CODE CLASS="literal"> 305allow</code> configuration option, although the default course of action in the event that neither option is specified is to allow access from all sources. In addition, if you specify this option in the <CODE CLASS="literal"> 306[global]</code> section of the configuration file, it will override any <CODE CLASS="literal"> 307hosts</code> <CODE CLASS="literal"> 308allow</code> options defined shares.</p></div><DIV CLASS="sect3"> 309<H4 CLASS="sect3"> 310<A CLASS="title" NAME="ch04-pgfId-959836"> 3114.6.1.2 hosts deny</a></h4><P CLASS="para"> 312The <CODE CLASS="literal"> 313hosts</code> <CODE CLASS="literal"> 314deny</code> option (also <CODE CLASS="literal"> 315deny</code> <CODE CLASS="literal"> 316hosts</code>) specifies machines that do not have permission to access a share, written as a comma- or space-separated list of machine names or their IP addresses. Use the same format as specifying clients as the <CODE CLASS="literal"> 317hosts</code> <CODE CLASS="literal"> 318allow</code> option above. For example, to restrict access to the server from everywhere but <I CLASS="filename"> 319example.com</i>, you could write:</p><PRE CLASS="programlisting"> 320hosts deny = ALL EXCEPT .example.com</pre><P CLASS="para"> 321Like <CODE CLASS="literal"> 322hosts</code> <CODE CLASS="literal"> 323allow</code>, there is no default value for the <CODE CLASS="literal"> 324hosts</code> <CODE CLASS="literal"> 325deny</code> configuration option, although the default course of action in the event that neither option is specified is to allow access from all sources. Also, if you specify this option in the <CODE CLASS="literal"> 326[global]</code> section of the configuration file, it will override any <CODE CLASS="literal"> 327hosts</code> <CODE CLASS="literal"> 328deny</code> options defined in shares. If you wish to deny <EM CLASS="emphasis"> 329hosts</em> access to specific shares, omit both the <CODE CLASS="literal"> 330hosts</code> <CODE CLASS="literal"> 331allow</code> and <CODE CLASS="literal"> 332hosts</code> <CODE CLASS="literal"> 333deny</code> options in the <CODE CLASS="literal"> 334[global]</code> section of the configuration file.</p></div><DIV CLASS="sect3"> 335<H4 CLASS="sect3"> 336<A CLASS="title" NAME="ch04-pgfId-958192"> 3374.6.1.3 interfaces</a></h4><P CLASS="para">The <CODE CLASS="literal"> 338interfaces</code> option outlines the network addresses to which you want the Samba server to recognize and respond. This option is handy if you have a computer that resides on more than one network subnet. If this option is not set, Samba searches for the primary network interface of the server (typically the first Ethernet card) upon startup and configures itself to operate on only that subnet. If the server is configured for more than one subnet and you do not specify this option, Samba will only work on the first subnet it encounters. You must use this option to force Samba to serve the other subnets on your network.</p><P CLASS="para"> 339The value of this option is one or more sets of IP address/netmask pairs, such as the following:</p><PRE CLASS="programlisting"> 340interfaces = 192.168.220.100/255.255.255.0 192.168.210.30/255.255.255.0</pre><P CLASS="para"> 341You can optionally specify a CIDR format bitmask, as follows:</p><PRE CLASS="programlisting"> 342interfaces = 192.168.220.100/24 192.168.210.30/24</pre><P CLASS="para"> 343The bitmask number specifies the first number of bits that will be turned on in the netmask. For example, the number 24 means that the first 24 (of 32) bits will be activated in the bit mask, which is the same as saying 255.255.255.0. Likewise, 16 would be equal to 255.255.0.0, and 8 would be equal to 255.0.0.0.</p><P CLASS="para"> 344This option may not work correctly if you are using DHCP.</p></div><DIV CLASS="sect3"> 345<H4 CLASS="sect3"> 346<A CLASS="title" NAME="ch04-pgfId-968052"> 3474.6.1.4 bind interfaces only</a></h4><P CLASS="para"> 348The <CODE CLASS="literal"> 349bind</code> <CODE CLASS="literal"> 350interfaces</code> <CODE CLASS="literal"> 351only</code> option can be used to force the <EM CLASS="emphasis"> 352smbd</em> and <EM CLASS="emphasis"> 353nmbd</em> processes to serve SMB requests to only those addresses specified by the <CODE CLASS="literal"> 354interfaces</code> option. The <EM CLASS="emphasis"> 355nmbd</em> process normally binds to the all addresses interface (0.0.0.0.) on ports 137 and 138, allowing it to receive broadcasts from anywhere. However, you can override this behavior with the following:</p><PRE CLASS="programlisting"> 356bind interfaces only = yes</pre><P CLASS="para"> 357This will cause both Samba processes to ignore any packets whose origination address does not match the broadcast address(es) specified by the <CODE CLASS="literal"> 358interfaces</code> option, including broadcast packets. With <EM CLASS="emphasis"> 359smbd</em>, this option will cause Samba to not serve file requests to subnets other than those listed in the <CODE CLASS="literal"> 360interfaces</code> option. You should avoid using this option if you want to allow temporary network connections, such as those created through SLIP or PPP. It's very rare that this option is needed, and it should only be used by experts.</p><P CLASS="para"> 361If you set <CODE CLASS="literal"> 362bind interfaces only</code> to <CODE CLASS="literal"> 363yes</code>, you should add the localhost address (127.0.01) to the "interfaces" list. Otherwise, <EM CLASS="emphasis"> 364smbpasswd</em> will be unable to connect to the server using its default mode in order to change a password. </p></div><DIV CLASS="sect3"> 365<H4 CLASS="sect3"> 366<A CLASS="title" NAME="ch04-pgfId-958204"> 3674.6.1.5 socket address</a></h4><P CLASS="para">The <CODE CLASS="literal"> 368socket</code> <CODE CLASS="literal"> 369address</code> option dictates which of the addresses specified with the <CODE CLASS="literal"> 370interfaces</code> parameter Samba should listen on for connections. Samba accepts connections on all addresses specified by default. When used in an <I CLASS="filename"> 371smb.conf</i> file, this option will force Samba to listen on only one IP address. For example:</p><PRE CLASS="programlisting"> 372interfaces = 192.168.220.100/24 192.168.210.30/24 373socket address = 192.168.210.30</pre><P CLASS="para"> 374This option is a programmer's tool and we recommend that you do not use it. </p></div></div></div></blockquote> 375<div> 376<center> 377<hr noshade size=1><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 378<TR> 379<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 380<A CLASS="sect1" HREF="ch04_05.html" TITLE="4.5 Disk Share Configuration"> 381<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 4.5 Disk Share Configuration" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 382<A CLASS="book" HREF="index.html" TITLE=""> 383<IMG SRC="gifs/txthome.gif" ALT="" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 384<A CLASS="sect1" HREF="ch04_07.html" TITLE="4.7 Virtual Servers"> 385<IMG SRC="gifs/txtnexta.gif" ALT="Next: 4.7 Virtual Servers" BORDER="0"></a></td></tr><TR> 386<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 3874.5 Disk Share Configuration</td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 388<A CLASS="index" HREF="inx.html" TITLE="Book Index"> 389<IMG SRC="gifs/index.gif" ALT="Book Index" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 3904.7 Virtual Servers</td></tr></table><hr noshade size=1></center> 391</div> 392 393<!-- End of sample chapter --> 394<CENTER> 395<FONT SIZE="1" FACE="Verdana, Arial, Helvetica"> 396<A HREF="http://www.oreilly.com/"> 397<B>O'Reilly Home</B></A> <B> | </B> 398<A HREF="http://www.oreilly.com/sales/bookstores"> 399<B>O'Reilly Bookstores</B></A> <B> | </B> 400<A HREF="http://www.oreilly.com/order_new/"> 401<B>How to Order</B></A> <B> | </B> 402<A HREF="http://www.oreilly.com/oreilly/contact.html"> 403<B>O'Reilly Contacts<BR></B></A> 404<A HREF="http://www.oreilly.com/international/"> 405<B>International</B></A> <B> | </B> 406<A HREF="http://www.oreilly.com/oreilly/about.html"> 407<B>About O'Reilly</B></A> <B> | </B> 408<A HREF="http://www.oreilly.com/affiliates.html"> 409<B>Affiliated Companies</B></A><p> 410<EM>© 1999, O'Reilly & Associates, Inc.</EM> 411</FONT> 412</CENTER> 413</BODY> 414</html> 415