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

📄 network-diskless.html

📁 FreeBSD安装说明概述 FreeBSD 提供了一个以文字为主
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Diskless Operation</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD 使用手册" href="index.html" /><link rel="UP" title="Advanced Networking" href="advanced-networking.html" /><link rel="PREVIOUS" title="NFS" href="network-nfs.html" /><link rel="NEXT" title="ISDN" href="network-isdn.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /><meta http-equiv="Content-Type" content="text/html; charset=GB2312" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD 使用手册</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="network-nfs.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 19. Advanced Networking</td><td width="10%" align="right" valign="bottom"><a href="network-isdn.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="NETWORK-DISKLESS" name="NETWORK-DISKLESS">19.7. DisklessOperation</a></h1><i class="AUTHORGROUP"><span class="CONTRIB">Updated by</span> Jean-Fran鏾is Dock鑣.</i> <p>A FreeBSD machine can boot over the network and operate without a local disk, usingfilesystems mounted from an NFS server. No system modification is necessary, beyondstandard configuration files. Such a system is easy to set up because all the necessaryelements are readily available:</p><ul><li><p>There are at least two possible methods to load the kernel over the network:</p><ul><li><p><span class="emphasis"><i class="EMPHASIS">PXE</i></span>: The <spanclass="TRADEMARK">Intel</span>&reg; Preboot Execution Environment system is a form ofsmart boot ROM built into some networking cards or motherboards. See <spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">pxeboot</span>(8)</span> for moredetails.</p></li><li><p><span class="emphasis"><i class="EMPHASIS">The <b class="APPLICATION">etherboot</b>port</i></span> (<ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/net/etherboot/pkg-descr"><ttclass="FILENAME">net/etherboot</tt></a>) produces ROM-able code to boot kernels over thenetwork. The code can be either burnt into a boot PROM on a network card, or loaded froma local floppy (or hard) disk drive, or from a running <spanclass="TRADEMARK">MS-DOS</span>&reg; system. Many network cards are supported.</p></li></ul></li><li><p>A sample script (<tt class="FILENAME">/usr/share/examples/diskless/clone_root</tt>)eases the creation and maintenance of the workstation's root filesystem on the server.The script will probably require a little customization but it will get you started veryquickly.</p></li><li><p>Standard system startup files exist in <tt class="FILENAME">/etc</tt> to detect andsupport a diskless system startup.</p></li><li><p>Swapping, if needed, can be done either to an NFS file or to a local disk.</p></li></ul><p>There are many ways to set up diskless workstations. Many elements are involved, andmost can be customized to suit local taste. The following will describe the setup of acomplete system, emphasizing simplicity and compatibility with the standard FreeBSDstartup scripts. The system described has the following characteristics:</p><ul><li><p>The diskless workstations use a shared read-only <tt class="FILENAME">root</tt>filesystem, and a shared read-only <tt class="FILENAME">/usr</tt>.</p><p>The <tt class="FILENAME">root</tt> filesystem is a copy of a standard FreeBSD root(typically the server's), with some configuration files overridden by ones specific todiskless operation or, possibly, to the workstation they belong to.</p><p>The parts of the <tt class="FILENAME">root</tt> which have to be writable are overlaidwith <span class="CITEREFENTRY"><span class="REFENTRYTITLE">mfs</span>(8)</span>filesystems. Any changes will be lost when the system reboots.</p></li><li><p>The kernel is loaded by <b class="APPLICATION">etherboot</b> , using DHCP (or BOOTP)and TFTP.</p></li></ul><div class="CAUTION"><blockquote class="CAUTION"><p><b>Caution</b>As described, this system is insecure. It should live in a protectedarea of a network, and be untrusted by other hosts.</p></blockquote></div><div class="SECT2"><h2 class="SECT2"><a id="AEN26498" name="AEN26498">19.7.1. Setup Instructions</a></h2><div class="SECT3"><h3 class="SECT3"><a id="AEN26500" name="AEN26500">19.7.1.1. ConfiguringDHCP/BOOTP</a></h3><p>There are two protocols that are commonly used to boot a workstation that retrievesits configuration over the network: BOOTP and DHCP. They are used at several points inthe workstation bootstrap:</p><ul><li><p><b class="APPLICATION">etherboot</b> uses DHCP (by default) or BOOTP (needs aconfiguration option) to find the kernel. (PXE uses DHCP).</p></li><li><p>The kernel uses BOOTP to locate the NFS root.</p></li></ul><p>It is possible to configure a system to use only BOOTP. The <spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">bootpd</span>(8)</span> server programis included in the base FreeBSD system.</p><p>However, DHCP has a number of advantages over BOOTP (nicer configuration files,possibility of using PXE, plus many others not directly related to diskless operation),and we shall describe both a pure BOOTP, and a BOOTP+DHCP configuration, with an emphasison the latter, which will use the ISC DHCP software package.</p><div class="SECT4"><h4 class="SECT4"><a id="AEN26517" name="AEN26517">19.7.1.1.1. Configuration Using ISCDHCP</a></h4><p>The <b class="APPLICATION">isc-dhcp</b> server can answer both BOOTP and DHCPrequests.</p><p>As of release 4.4, <b class="APPLICATION">isc-dhcp 3.0</b> is not part of the basesystem. You will first need to install the <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/net/isc-dhcp3/pkg-descr"><ttclass="FILENAME">net/isc-dhcp3</tt></a> port or the corresponding package. Please referto <a href="ports.html">Chapter 4</a> for general information about ports andpackages.</p><p>Once <b class="APPLICATION">isc-dhcp</b> is installed, it needs a configuration fileto run, (normally named <tt class="FILENAME">/usr/local/etc/dhcpd.conf</tt>). Herefollows a commented example:</p><pre class="PROGRAMLISTING">          default-lease-time 600;          max-lease-time 7200;          authoritative;          option domain-name "example.com";          option domain-name-servers 192.168.4.1;          option routers 192.168.4.1;          subnet 192.168.4.0 netmask 255.255.255.0 {            use-host-decl-names on; <a id="CO-DHCP-HOST-NAME"name="CO-DHCP-HOST-NAME"><img src="./imagelib/callouts/1.png" hspace="0" vspace="0"border="0" alt="(1)" /></a>            option subnet-mask 255.255.255.0;            option broadcast-address 192.168.4.255;            host margaux {              hardware ethernet 01:23:45:67:89:ab;              fixed-address margaux.example.com;              next-server 192.168.4.4;<a id="CO-DHCP-NEXT-SERVER"name="CO-DHCP-NEXT-SERVER"><img src="./imagelib/callouts/2.png" hspace="0" vspace="0"border="0" alt="(2)" /></a>              filename "/tftpboot/kernel.diskless";<a id="CO-DHCP-FILENAME"name="CO-DHCP-FILENAME"><img src="./imagelib/callouts/3.png" hspace="0" vspace="0"border="0" alt="(3)" /></a>              option root-path "192.168.4.4:/data/misc/diskless";<aid="CO-DHCP-ROOT-PATH" name="CO-DHCP-ROOT-PATH"><img src="./imagelib/callouts/4.png"hspace="0" vspace="0" border="0" alt="(4)" /></a>            }          }         </pre><div class="CALLOUTLIST"><dl compact="COMPACT"><dt><a href="network-diskless.html#CO-DHCP-HOST-NAME"><imgsrc="./imagelib/callouts/1.png" hspace="0" vspace="0" border="0" alt="(1)" /></a></dt><dd>This option tells <tt class="COMMAND">dhcpd</tt> to send the value in the <varclass="LITERAL">host</var> declarations as the hostname for the diskless host. Analternate way would be to add an <var class="LITERAL">option host-name <varclass="REPLACEABLE">margaux</var></var> inside the host declarations.</dd><dt><a href="network-diskless.html#CO-DHCP-NEXT-SERVER"><imgsrc="./imagelib/callouts/2.png" hspace="0" vspace="0" border="0" alt="(2)" /></a></dt><dd>The <var class="LITERAL">next-server</var> directive designates the TFTP server (thedefault is to use the same host as the DHCP server).</dd><dt><a href="network-diskless.html#CO-DHCP-FILENAME"><img src="./imagelib/callouts/3.png"hspace="0" vspace="0" border="0" alt="(3)" /></a></dt><dd>The <var class="LITERAL">filename</var> directive defines the file that <bclass="APPLICATION">etherboot</b> will load as a kernel. <div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> PXE appears to prefer a relative file name, and it loads <ttclass="COMMAND">pxeboot</tt>, not the kernel (<var class="LITERAL">option filename"pxeboot"</var>).</p></blockquote></div></dd><dt><a href="network-diskless.html#CO-DHCP-ROOT-PATH"><imgsrc="./imagelib/callouts/4.png" hspace="0" vspace="0" border="0" alt="(4)" /></a></dt><dd>The <var class="LITERAL">root-path</var> option defines the path to the rootfilesystem, in usual NFS notation.</dd></dl></div></div><div class="SECT4"><h4 class="SECT4"><a id="AEN26557" name="AEN26557">19.7.1.1.2. Configuration UsingBOOTP</a></h4><p>Here follows an equivalent <tt class="COMMAND">bootpd</tt> configuration. This wouldbe found in <tt class="FILENAME">/etc/bootptab</tt>.</p><p>Please note that <b class="APPLICATION">etherboot</b> must be compiled with thenon-default option <var class="LITERAL">NO_DHCP_SUPPORT</var> in order to use BOOTP, andthat PXE <span class="emphasis"><i class="EMPHASIS">needs</i></span> DHCP. The onlyobvious advantage of <b class="APPLICATION">bootpd</b> is that it exists in the basesystem.</p><pre class="PROGRAMLISTING">          .def100:\            :hn:ht=1:sa=192.168.4.4:vm=rfc1048:\            :sm=255.255.255.0:\            :ds=192.168.4.1:\            :gw=192.168.4.1:\            :hd="/tftpboot":\            :bf="/kernel.diskless":\            :rp="192.168.4.4:/data/misc/diskless":          margaux:ha=0123456789ab:tc=.def100         </pre></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN26571" name="AEN26571">19.7.1.2. Preparing a Boot Programwith <b class="APPLICATION">Etherboot</b></a></h3><p><a href="http://etherboot.sourceforge.net" target="_top">Etherboot's Web site</a>contains <a href="http://etherboot.sourceforge.net/doc/html/userman.html"target="_top">extensive documentation</a> mainly intended for Linux systems, butnonetheless containing useful information. The following will just outline how you woulduse <b class="APPLICATION">etherboot</b> on a FreeBSD system.</p><p>You must first install the <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/net/etherboot/pkg-descr"><ttclass="FILENAME">net/etherboot</tt></a> package or port. The <bclass="APPLICATION">etherboot</b> port can normally be found in <ttclass="FILENAME">/usr/ports/net/etherboot</tt>. If the ports tree is installed on yoursystem, just typing <var class="LITERAL">make</var> in this directory should take care of

⌨️ 快捷键说明

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