📄 network-diskless.html
字号:
everything. Else refer to <a href="ports.html">Chapter 4</a> for information about portsand packages.</p><p>For our setup, we shall use a boot floppy. For other methods (PROM, or dos program),please refer to the <b class="APPLICATION">etherboot</b> documentation.</p><p>To make a boot floppy, insert a floppy in the drive on the machine where you installed<b class="APPLICATION">etherboot</b>, then change your current directory to the <ttclass="FILENAME">src</tt> directory in the <b class="APPLICATION">etherboot</b> tree andtype:</p><pre class="SCREEN"> <samp class="PROMPT">#</samp> <kbd class="USERINPUT">gmake bin32/<varclass="REPLACEABLE">devicetype</var>.fd0</kbd> </pre><p><var class="REPLACEABLE">devicetype</var> depends on the type of the Ethernet card inthe diskless workstation. Refer to the <tt class="FILENAME">NIC</tt> file in the samedirectory to determine the right <var class="REPLACEABLE">devicetype</var>.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN26600" name="AEN26600">19.7.1.3. Configuring the TFTP and NFSServers</a></h3><p>You need to enable <tt class="COMMAND">tftpd</tt> on the TFTP server:</p><div class="PROCEDURE"><ol type="1"><li><p>Create a directory from which <tt class="COMMAND">tftpd</tt> will serve the files,e.g. <tt class="FILENAME">/tftpboot</tt>.</p></li><li><p>Add this line to your <tt class="FILENAME">/etc/inetd.conf</tt>:</p><pre class="PROGRAMLISTING">tftp dgram udp wait root /usr/libexec/tftpd tftpd -s /tftpboot</pre><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> It appears that at least some PXE versions want the TCP version of TFTP.In this case, add a second line, replacing <var class="LITERAL">dgram udp</var> with <varclass="LITERAL">stream tcp</var>.</p></blockquote></div></li><li><p>Tell <tt class="COMMAND">inetd</tt> to reread its configuration file:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">kill -HUP `cat /var/run/inetd.pid`</kbd></pre></li></ol></div><p>You can place the <tt class="FILENAME">tftpboot</tt> directory anywhere on the server.Make sure that the location is set in both <tt class="FILENAME">inetd.conf</tt> and <ttclass="FILENAME">dhcpd.conf</tt>.</p><p>You also need to enable NFS and export the appropriate filesystem on the NFSserver.</p><div class="PROCEDURE"><ol type="1"><li><p>Add this to <tt class="FILENAME">/etc/rc.conf</tt>:</p><pre class="PROGRAMLISTING">nfs_server_enable="YES"</pre></li><li><p>Export the filesystem where the diskless root directory is located by adding thefollowing to <tt class="FILENAME">/etc/exports</tt> (adjust the volume mount point andreplace <var class="REPLACEABLE">margaux</var> with the name of the disklessworkstation):</p><pre class="PROGRAMLISTING"><var class="REPLACEABLE">/data/misc</var> -alldirs -ro <varclass="REPLACEABLE">margaux</var></pre></li><li><p>Tell <tt class="COMMAND">mountd</tt> to reread its configuration file. If you actuallyneeded to enable NFS in <tt class="FILENAME">/etc/rc.conf</tt> at the first step, youprobably want to reboot instead.</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">kill -HUP `cat /var/run/mountd.pid`</kbd></pre></li></ol></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN26653" name="AEN26653">19.7.1.4. Building a DisklessKernel</a></h3><p>Create a kernel configuration file for the diskless client with the following options(in addition to the usual ones):</p><pre class="PROGRAMLISTING"> options BOOTP # Use BOOTP to obtain IP address/hostname options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info options BOOTP_COMPAT # Workaround for broken bootp daemons. </pre><p>You may also want to use <var class="LITERAL">BOOTP_NFSV3</var> and <varclass="LITERAL">BOOTP_WIRED_TO</var> (refer to <tt class="FILENAME">LINT</tt>).</p><p>Build the kernel (See <a href="kernelconfig.html">Chapter 9</a>), and copy it to thetftp directory, under the name listed in <tt class="FILENAME">dhcpd.conf</tt>.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN26667" name="AEN26667">19.7.1.5. Preparing the RootFilesystem</a></h3><p>You need to create a root filesystem for the diskless workstations, in the locationlisted as <var class="LITERAL">root-path</var> in <ttclass="FILENAME">dhcpd.conf</tt>.</p><p>The easiest way to do this is to use the <ttclass="FILENAME">/usr/share/examples/diskless/clone_root</tt> shell script. This scriptneeds customization, at least to adjust the place where the filesystem will be created(the <var class="LITERAL">DEST</var> variable).</p><p>Refer to the comments at the top of the script for instructions. They explain how thebase filesystem is built, and how files may be selectively overridden by versionsspecific to diskless operation, to a subnetwork, or to an individual workstation. Theyalso give examples for the diskless <tt class="FILENAME">/etc/fstab</tt> and <ttclass="FILENAME">/etc/rc.conf</tt> files.</p><p>The <tt class="FILENAME">README</tt> files in <ttclass="FILENAME">/usr/share/examples/diskless</tt> contain a lot of interestingbackground information, but, together with the other examples in the <ttclass="FILENAME">diskless</tt> directory, they actually document a configuration methodwhich is distinct from the one used by <tt class="FILENAME">clone_root</tt> and <ttclass="FILENAME">/etc/rc.diskless[12]</tt>, which is a little confusing. Use them forreference only, except if you prefer the method that they describe, in which case youwill need customized <tt class="FILENAME">rc</tt> scripts.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN26688" name="AEN26688">19.7.1.6. Configuring Swap</a></h3><p>If needed, a swap file located on the server can be accessed via NFS. The exact <ttclass="FILENAME">bootptab</tt> or <tt class="FILENAME">dhcpd.conf</tt> options are notclearly documented at this time. The following configuration suggestions have beenreported to work in some installations using isc-dhcp 3.0rc11.</p><div class="PROCEDURE"><ol type="1"><li><p>Add the following lines to <tt class="FILENAME">dhcpd.conf</tt>:</p><pre class="PROGRAMLISTING"> # Global section option swap-path code 128 = string; option swap-size code 129 = integer 32; host margaux { ... # Standard lines, see above option swap-path <varclass="REPLACEABLE">"192.168.4.4:/netswapvolume/netswap"</var>; option swap-size <var class="REPLACEABLE">64000</var>; } </pre><p>The idea is that, at least for a FreeBSD client, DHCP/BOOTP option code 128 is thepath to the NFS swap file, and option code 129 is the swap size in kilobytes. Olderversions of <tt class="COMMAND">dhcpd</tt> allowed a syntax of <varclass="LITERAL">option option-128 "...</var>, which does not seem to work any more.</p><p><tt class="FILENAME">/etc/bootptab</tt> would use the following syntax instead:</p><p><var class="LITERAL">T128="192.168.4.4:/netswapvolume/netswap":T129=64000</var></p></li><li><p>On the NFS swap file server, create the swap file(s)</p><pre class="SCREEN"> <samp class="PROMPT">#</samp> <kbd class="USERINPUT">mkdir <varclass="REPLACEABLE">/netswapvolume/netswap</var></kbd> <samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd <varclass="REPLACEABLE">/netswapvolume/netswap</var></kbd> <samp class="PROMPT">#</samp> <kbdclass="USERINPUT">dd if=/dev/zero bs=1024 count=<varclass="REPLACEABLE">64000</var> of=swap.<var class="REPLACEABLE">192.168.4.6</var></kbd> <samp class="PROMPT">#</samp> <kbd class="USERINPUT">chmod 0600 swap.<varclass="REPLACEABLE">192.168.4.6</var></kbd> </pre><p><var class="REPLACEABLE">192.168.4.6</var> is the IP address for the disklessclient.</p></li><li><p>On the NFS swap file server, add the following line to <ttclass="FILENAME">/etc/exports</tt>:</p><pre class="PROGRAMLISTING"> <var class="REPLACEABLE">/netswapvolume</var> -maproot=0:10 -alldirs <varclass="REPLACEABLE">margaux</var> </pre><p>Then tell <b class="APPLICATION">mountd</b> to reread the exports file, as above.</p></li></ol></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN26733" name="AEN26733">19.7.1.7. MiscellaneousIssues</a></h3><div class="SECT4"><h4 class="SECT4"><a id="AEN26735" name="AEN26735">19.7.1.7.1. Running with a Read-only<tt class="FILENAME">/usr</tt></a></h4><p>If the diskless workstation is configured to run X, you will have to adjust the xdmconfiguration file, which puts the error log on <tt class="FILENAME">/usr</tt> bydefault.</p></div><div class="SECT4"><h4 class="SECT4"><a id="AEN26743" name="AEN26743">19.7.1.7.2. Using a Non-FreeBSDServer</a></h4><p>When the server for the root filesystem is not running FreeBSD, you will have tocreate the root filesystem on a FreeBSD machine, then copy it to its destination, using<tt class="COMMAND">tar</tt> or <tt class="COMMAND">cpio</tt>.</p><p>In this situation, there are sometimes problems with the special files in <ttclass="FILENAME">/dev</tt>, due to differing major/minor integer sizes. A solution tothis problem is to export a directory from the non-FreeBSD server, mount this directoryonto a FreeBSD machine, and run <tt class="COMMAND">MAKEDEV</tt> on the FreeBSD machineto create the correct device entries (FreeBSD 5.0 and later use <spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">devfs</span>(5)</span> to allocatedevice nodes transparently for the user, running <tt class="COMMAND">MAKEDEV</tt> onthese versions is useless).</p></div></div></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="network-nfs.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="network-isdn.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">NFS</td><td width="34%" align="center" valign="top"><a href="advanced-networking.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">ISDN</td></tr></table></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -