⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 network-diskless.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
📖 第 1 页 / 共 3 页
字号:
use).</p><p>Build the kernel (see <a href="kernelconfig.html">Chapter 8</a>), and copy it to theplace specified in <tt class="FILENAME">dhcpd.conf</tt>.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> When using <acronym class="ACRONYM">PXE</acronym>, building a kernel withthe above options is not strictly necessary (though suggested). Enabling them will causemore <acronym class="ACRONYM">DHCP</acronym> requests to be issued during kernel startup,with a small risk of inconsistency between the new values and those retrieved by <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=pxeboot&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">pxeboot</span>(8)</span></a> in somespecial cases. The advantage of using them is that the host name will be set as a sideeffect. Otherwise you will need to set the host name by another method, for example in aclient-specific <tt class="FILENAME">rc.conf</tt> file.</p></blockquote></div><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> In order to be loadable with <b class="APPLICATION">Etherboot</b>, a 5.Xkernel needs to have the device hints compiled in. You would typically set the followingoption in the configuration file (see the <tt class="FILENAME">NOTES</tt> configurationcomments file):</p><pre class="PROGRAMLISTING">hints      "GENERIC.hints"</pre></blockquote></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN37388" name="AEN37388">24.6.2.7 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 <tt class="FILENAME">dhcpd.conf</tt>.The following sections describe two ways to do it.</p><div class="SECT4"><h4 class="SECT4"><a id="AEN37396" name="AEN37396">24.6.2.7.1 Using the <ttclass="FILENAME">clone_root</tt> Script</a></h4><p>This is the quickest way to create a root filesystem, but currently it is onlysupported on FreeBSD&nbsp;4.X. This shell script is located at <ttclass="FILENAME">/usr/share/examples/diskless/clone_root</tt> and needs customization, atleast to adjust the place where the filesystem will be created (the <varclass="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 thesystem startup scripts in <tt class="FILENAME">/etc</tt>, which is a little confusing.Use them for reference only, except if you prefer the method that they describe, in whichcase you will need customized <tt class="FILENAME">rc</tt> scripts.</p></div><div class="SECT4"><h4 class="SECT4"><a id="AEN37412" name="AEN37412">24.6.2.7.2 Using the Standard <ttclass="COMMAND">make world</tt> Procedure</a></h4><p>This method can be applied to either FreeBSD&nbsp;4.X or 5.X and will install acomplete virgin system (not only the root filesystem) into <ttclass="ENVAR">DESTDIR</tt>. All you have to do is simply execute the followingscript:</p><pre class="PROGRAMLISTING">#!/bin/shexport DESTDIR=/data/misc/disklessmkdir -p ${DESTDIR}cd /usr/src; make world &#38;&#38; make kernelcd /usr/src/etc; make distribution</pre><p>Once done, you may need to customize your <tt class="FILENAME">/etc/rc.conf</tt> and<tt class="FILENAME">/etc/fstab</tt> placed into <tt class="ENVAR">DESTDIR</tt> accordingto your needs.</p></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN37422" name="AEN37422">24.6.2.8 Configuring Swap</a></h3><p>If needed, a swap file located on the server can be accessed via <acronymclass="ACRONYM">NFS</acronym>. One of the methods commonly used to do this has beendiscontinued in release 5.X.</p><div class="SECT4"><h4 class="SECT4"><a id="AEN37426" name="AEN37426">24.6.2.8.1 <acronymclass="ACRONYM">NFS</acronym> Swap with FreeBSD&nbsp;4.X</a></h4><p>The swap file location and size can be specified with BOOTP/<acronymclass="ACRONYM">DHCP</acronym> FreeBSD-specific options 128 and 129. Examples ofconfiguration files for <b class="APPLICATION">ISC DHCP 3.0</b> or <bclass="APPLICATION">bootpd</b> follow:</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 sectionoption swap-path code 128 = string;option swap-size code 129 = integer 32;host margaux {  ... # Standard lines, see above  option swap-path <var class="REPLACEABLE">"192.168.4.4:/netswapvolume/netswap"</var>;  option swap-size <var class="REPLACEABLE">64000</var>;}       </pre><p><var class="LITERAL">swap-path</var> is the path to a directory where swap files willbe located. Each file will be named <tt class="FILENAME">swap.<varclass="REPLACEABLE">client-ip</var></tt>.</p><p>Older versions of <b class="APPLICATION">dhcpd</b> used a syntax of <varclass="LITERAL">option option-128 "...</var>, which is no longer supported.</p><p><tt class="FILENAME">/etc/bootptab</tt> would use the following syntax instead:</p><pre class="PROGRAMLISTING">T128="192.168.4.4:/netswapvolume/netswap":T129=0000fa00</pre><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> In <tt class="FILENAME">/etc/bootptab</tt>, the swap size must beexpressed in hexadecimal format.</p></blockquote></div></li><li><p>On the <acronym class="ACRONYM">NFS</acronym> swap file server, create the swapfile(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> <kbd class="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 <acronym class="ACRONYM">NFS</acronym> swap file server, add the following lineto <tt class="FILENAME">/etc/exports</tt>:</p><pre class="PROGRAMLISTING"><var class="REPLACEABLE">/netswapvolume</var>  -maproot=0:10 -alldirs <varclass="REPLACEABLE">margaux corbieres</var>       </pre><p>Then tell <b class="APPLICATION">mountd</b> to reread the <ttclass="FILENAME">exports</tt> file, as above.</p></li></ol></div></div><div class="SECT4"><h4 class="SECT4"><a id="AEN37482" name="AEN37482">24.6.2.8.2 <acronymclass="ACRONYM">NFS</acronym> Swap with FreeBSD&nbsp;5.X</a></h4><p>The kernel does not support enabling <acronym class="ACRONYM">NFS</acronym> swap atboot time. Swap must be enabled by the startup scripts, by mounting a writeable filesystem and creating and enabling a swap file. To create a swap file of appropriate size,you can do like this:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">dd if=/dev/zero of=<varclass="REPLACEABLE">/path/to/swapfile</var> bs=1k count=1 oseek=<varclass="REPLACEABLE">100000</var></kbd></pre><p>To enable it you have to add the following line to your <ttclass="FILENAME">rc.conf</tt>:</p><pre class="PROGRAMLISTING">swapfile=<var class="REPLACEABLE">/path/to/swapfile</var></pre></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN37496" name="AEN37496">24.6.2.9 Miscellaneous Issues</a></h3><div class="SECT4"><h4 class="SECT4"><a id="AEN37498" name="AEN37498">24.6.2.9.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 <bclass="APPLICATION">XDM</b> configuration file, which puts the error log on <ttclass="FILENAME">/usr</tt> by default.</p></div><div class="SECT4"><h4 class="SECT4"><a id="AEN37507" name="AEN37507">24.6.2.9.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 <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=devfs&sektion=5&manpath=FreeBSD+6-current"><span class="CITEREFENTRY"><span class="REFENTRYTITLE">devfs</span>(5)</span></a> toallocate device nodes transparently for the user, running <ttclass="COMMAND">MAKEDEV</tt> on these versions is pointless).</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-bridging.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">Bridging</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><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting &#60;<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>&#62;.<br />For questions about this documentation, e-mail &#60;<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>&#62;.</small></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -