Last merge shuffle in prep for technical review.

Next few commits will clarify the info and check the order
in which it is presented.

Sponsored by: iXsystems
This commit is contained in:
Dru Lavigne 2014-03-05 16:29:37 +00:00
parent f80b8a1073
commit d7edc5dbb1
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=44131

View file

@ -3891,6 +3891,11 @@ ifconfig_<literal>lagg0</literal>="laggproto failover laggport <replaceable>bge0
</listitem>
</itemizedlist>
<para>To use <acronym>PXE</acronym> when the machine starts,
select the <literal>Boot from network</literal> option in
the <acronym>BIOS</acronym> setup or type a function key
during system initialization.</para>
<para>There are many ways to set up diskless workstations. Many
elements are involved, and most can be customized to suit local
taste. The following will describe variations on the setup of a
@ -3983,9 +3988,200 @@ ifconfig_<literal>lagg0</literal>="laggproto failover laggport <replaceable>bge0
</listitem>
</itemizedlist>
<para>Place <filename>tftpboot</filename>
anywhere on the server. Make sure that the location is
set in both <filename>/etc/inetd.conf</filename> and
<filename>/usr/local/etc/dhcpd.conf</filename>.</para>
<para>Refer to &man.diskless.8; for more information.</para>
</sect2>
<sect2 xml:id="network-pxe-nfs">
<info>
<title>Setting Up the &man.chroot.8; Environment for the
<acronym>NFS</acronym> Root File System</title>
<authorgroup>
<author>
<personname>
<firstname>Craig</firstname>
<surname>Rodrigues</surname>
</personname>
<affiliation>
<address>rodrigc@FreeBSD.org</address>
</affiliation>
<contrib>Written by </contrib>
</author>
</authorgroup>
</info>
<para>The &intel; Preboot eXecution Environment
(<acronym>PXE</acronym>) allows booting the operating system
over the network. <acronym>PXE</acronym> support is usually
provided in the <acronym>BIOS</acronym> where it can be enabled
in the <acronym>BIOS</acronym> settings which enable booting
from the network. A fully functioning
<acronym>PXE</acronym> setup also requires properly configured
<acronym>DHCP</acronym> and <acronym>TFTP</acronym>
servers.</para>
<para>When the host computer boots, it receives information over
<acronym>DHCP</acronym> about where to obtain the initial boot
loader via <acronym>TFTP</acronym>. After the host computer
receives this information, it downloads the boot loader via
<acronym>TFTP</acronym> and then executes the boot loader.
This is documented in section 2.2.1 of the <link
xlink:href="http://download.intel.com/design/archives/wfm/downloads/pxespec.pdf">Preboot
Execution Environment (<acronym>PXE</acronym>)
Specification</link>. In &os;, the boot loader retrieved
during the <acronym>PXE</acronym> process is
<filename>/boot/pxeboot</filename>. After
<filename>/boot/pxeboot</filename> executes, the &os; kernel is
loaded and the rest of the &os; bootup sequence proceeds.
Refer to <xref linkend="boot"/> for more information about the
&os; booting process.</para>
<procedure>
<step>
<para>Choose a directory which will have a &os;
installation which will be <acronym>NFS</acronym>
mountable. For example, a directory such as
<filename>/b/tftpboot/FreeBSD/install</filename> can be
used.</para>
<screen>&prompt.root; <userinput>export NFSROOTDIR=/b/tftpboot/FreeBSD/install</userinput>
&prompt.root; <userinput>mkdir -p ${NFSROOTDIR}</userinput></screen>
</step>
<step>
<para>Enable the <acronym>NFS</acronym> server by adding this line to
<filename>/etc/rc.conf</filename></para>
<programlisting>nfs_server_enable="YES"</programlisting>
</step>
<step>
<para>Export the diskless root directory via <acronym>NFS</acronym> by
adding the following to
<filename>/etc/exports</filename>:</para>
<programlisting>/b -ro -alldirs</programlisting>
</step>
<step>
<para>Restart the <acronym>NFS</acronym> server:</para>
<screen>&prompt.root; <userinput>service nfsd restart</userinput></screen>
</step>
<step>
<para>Enable &man.inetd.8; by adding the following line to
<filename>/etc/rc.conf</filename>:</para>
<programlisting>inetd_enable="YES"</programlisting>
</step>
<step>
<para>Add the following line to
<filename>/etc/inetd.conf</filename>:</para>
<programlisting>tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /b/tftpboot</programlisting>
<note>
<para>Some
<acronym>PXE</acronym> versions require the
<acronym>TCP</acronym> version of
<acronym>TFTP</acronym>. In this case, add a second
line, replacing <literal>dgram udp</literal> with
<literal>stream tcp</literal>.</para>
</note>
</step>
<step>
<para>Restart &man.inetd.8;:</para>
<screen>&prompt.root; <userinput>service inetd restart</userinput></screen>
</step>
<step>
<para>Rebuild the &os; kernel and userland (<xref
linkend="makeworld"/>):</para>
<screen>&prompt.root; <userinput>cd /usr/src</userinput>
&prompt.root; <userinput>make buildworld</userinput>
&prompt.root; <userinput>make buildkernel</userinput></screen>
</step>
<step>
<para>Install &os; into the directory mounted over
<acronym>NFS</acronym>:</para>
<screen>&prompt.root; <userinput>make installworld DESTDIR=${NFSROOTDIR}</userinput>
&prompt.root; <userinput>make installkernel DESTDIR=${NFSROOTDIR}</userinput>
&prompt.root; <userinput>make distribution DESTDIR=${NFSROOTDIR}</userinput></screen>
</step>
<step>
<para>Test that the <acronym>TFTP</acronym> server works
and can download the boot loader which will be obtained
via <acronym>PXE</acronym>:</para>
<screen>&prompt.root; <userinput>tftp localhost</userinput>
tftp&gt; <userinput>get FreeBSD/install/boot/pxeboot</userinput>
Received 264951 bytes in 0.1 seconds</screen>
</step>
<step>
<para>Edit <filename>${NFSROOTDIR}/etc/fstab</filename> and
create an entry to mount the root file system over
<acronym>NFS</acronym>:</para>
<programlisting># Device Mountpoint FSType Options Dump Pass
myhost.example.com:/b/tftpboot/FreeBSD/install / nfs ro 0 0</programlisting>
<para>Replace <replaceable>myhost.example.com</replaceable>
with the hostname or <acronym>IP</acronym> address of the
<acronym>NFS</acronym> server. In this example, the root
file system is mounted read-only in order to prevent
<acronym>NFS</acronym> clients from potentially deleting
the contents of the root file system.</para>
</step>
<step>
<para>Set the root password in the &man.chroot.8;
environment:</para>
<screen>&prompt.root; <userinput>chroot ${NFSROOTDIR}</userinput>
&prompt.root; <userinput>passwd</userinput></screen>
<para>This sets the root password for client machines which
are <acronym>PXE</acronym> booting.</para>
</step>
<step>
<para>Enable &man.ssh.1; root logins for client machines
which are <acronym>PXE</acronym> booting by editing
<filename>${NFSROOTDIR}/etc/ssh/sshd_config</filename>
and enabling <literal>PermitRootLogin</literal>. This
option is documented in &man.sshd.config.5;.</para>
</step>
<step>
<para>Perform other customizations of the &man.chroot.8;
environment in ${NFSROOTDIR}. These customizations could
include things like adding packages with &man.pkg.add.1;,
editing the password file with &man.vipw.8;, or editing
&man.amd.conf.5; maps for automounting. For
example:</para>
<screen>&prompt.root; <userinput>chroot ${NFSROOTDIR}</userinput>
&prompt.root; <userinput>pkg_add -r bash</userinput></screen>
</step>
</procedure>
</sect2>
<sect2 xml:id="network-pxe-setting-up-dhcp">
<title>Configuring the <application>ISC
DHCP</application> Server</title>
@ -4090,94 +4286,6 @@ ifconfig_<literal>lagg0</literal>="laggproto failover laggport <replaceable>bge0
same as the <acronym>TFTP</acronym> one.</para>
</sect2>
<sect2>
<title>Configuring the
<acronym>NFS</acronym> Server</title>
<para>Enable
<acronym>NFS</acronym> and export the appropriate file
system on the <acronym>NFS</acronym> server.</para>
<para>Add this line to
<filename>/etc/rc.conf</filename>:</para>
<programlisting>nfs_server_enable="YES"</programlisting>
<para>Export the file system where the diskless root
directory is located by adding the following to
<filename>/etc/exports</filename>. Adjust the
mount point and replace <replaceable>
corbieres</replaceable> with the names of the diskless
workstations:</para>
<programlisting><replaceable>/data/misc</replaceable> -alldirs -ro <replaceable>margaux corbieres</replaceable></programlisting>
<para>Tell &man.mountd.8; to reread its configuration
file. If <acronym>NFS</acronym> is enabled in
<filename>/etc/rc.conf</filename>, it is recommended
to reboot instead.</para>
<screen>&prompt.root; <userinput>service mountd restart</userinput></screen>
</sect2>
<sect2>
<title>Configuring the <acronym>TFTP</acronym> Server</title>
<para>To use <acronym>PXE</acronym> when the machine starts,
select the <literal>Boot from network</literal> option in
the <acronym>BIOS</acronym> setup or type a function key
during system initialization.</para>
<indexterm>
<primary>TFTP</primary>
<secondary>diskless operation</secondary>
</indexterm>
<indexterm>
<primary>NFS</primary>
<secondary>diskless operation</secondary>
</indexterm>
<para>To enable &man.tftpd.8;, perform the following steps:</para>
<procedure>
<step>
<para>Create a directory from which &man.tftpd.8; will
serve the files, such as
<filename>/tftpboot</filename>.</para>
</step>
<step>
<para>Add this line to
<filename>/etc/inetd.conf</filename>:</para>
<programlisting>tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /tftpboot</programlisting>
<note>
<para>Some
<acronym>PXE</acronym> versions require the
<acronym>TCP</acronym> version of
<acronym>TFTP</acronym>. In this case, add a second
line, replacing <literal>dgram udp</literal> with
<literal>stream tcp</literal>.</para>
</note>
</step>
<step>
<para>Tell &man.inetd.8; to reread its configuration file.
Add <option>inetd_enable="YES"</option> to
<filename>/etc/rc.conf</filename> in order for this
command to execute correctly:</para>
<screen>&prompt.root; <userinput>service inetd restart</userinput></screen>
</step>
</procedure>
<para>Place <filename>tftpboot</filename>
anywhere on the server. Make sure that the location is
set in both <filename>/etc/inetd.conf</filename> and
<filename>/usr/local/etc/dhcpd.conf</filename>.</para>
</sect2>
<sect2>
<title>Preparing the Root File System</title>
@ -4294,183 +4402,6 @@ cd /usr/src/etc; make distribution</programlisting>
the user.</para>
</sect2>
<sect2 xml:id="network-pxe-nfs">
<info>
<title>PXE Booting with an <acronym>NFS</acronym> Root File
System</title>
<authorgroup>
<author>
<personname>
<firstname>Craig</firstname>
<surname>Rodrigues</surname>
</personname>
<affiliation>
<address>rodrigc@FreeBSD.org</address>
</affiliation>
<contrib>Written by </contrib>
</author>
</authorgroup>
</info>
<para>The &intel; Preboot eXecution Environment
(<acronym>PXE</acronym>) allows booting the operating system
over the network. <acronym>PXE</acronym> support is usually
provided in the <acronym>BIOS</acronym> where it can be enabled
in the <acronym>BIOS</acronym> settings which enable booting
from the network. A fully functioning
<acronym>PXE</acronym> setup also requires properly configured
<acronym>DHCP</acronym> and <acronym>TFTP</acronym>
servers.</para>
<para>When the host computer boots, it receives information over
<acronym>DHCP</acronym> about where to obtain the initial boot
loader via <acronym>TFTP</acronym>. After the host computer
receives this information, it downloads the boot loader via
<acronym>TFTP</acronym> and then executes the boot loader.
This is documented in section 2.2.1 of the <link
xlink:href="http://download.intel.com/design/archives/wfm/downloads/pxespec.pdf">Preboot
Execution Environment (<acronym>PXE</acronym>)
Specification</link>. In &os;, the boot loader retrieved
during the <acronym>PXE</acronym> process is
<filename>/boot/pxeboot</filename>. After
<filename>/boot/pxeboot</filename> executes, the &os; kernel is
loaded and the rest of the &os; bootup sequence proceeds.
Refer to <xref linkend="boot"/> for more information about the
&os; booting process.</para>
</sect2>
<sect2>
<title>Setting Up the &man.chroot.8; Environment for the
<acronym>NFS</acronym> Root File System</title>
<procedure>
<step>
<para>Choose a directory which will have a &os;
installation which will be <acronym>NFS</acronym>
mountable. For example, a directory such as
<filename>/b/tftpboot/FreeBSD/install</filename> can be
used.</para>
<screen>&prompt.root; <userinput>export NFSROOTDIR=/b/tftpboot/FreeBSD/install</userinput>
&prompt.root; <userinput>mkdir -p ${NFSROOTDIR}</userinput></screen>
</step>
<step>
<para>Enable the <acronym>NFS</acronym> server by following
the instructions in <xref
linkend="network-configuring-nfs"/>.</para>
</step>
<step>
<para>Export the directory via <acronym>NFS</acronym> by
adding the following to
<filename>/etc/exports</filename>:</para>
<programlisting>/b -ro -alldirs</programlisting>
</step>
<step>
<para>Restart the <acronym>NFS</acronym> server:</para>
<screen>&prompt.root; <userinput>service nfsd restart</userinput></screen>
</step>
<step>
<para>Enable &man.inetd.8; by following the steps outlined
in <xref linkend="network-inetd-conf"/>.</para>
</step>
<step>
<para>Add the following line to
<filename>/etc/inetd.conf</filename>:</para>
<programlisting>tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /b/tftpboot</programlisting>
</step>
<step>
<para>Restart &man.inetd.8;:</para>
<screen>&prompt.root; <userinput>service inetd restart</userinput></screen>
</step>
<step>
<para>Rebuild the &os; kernel and userland (<xref
linkend="makeworld"/>):</para>
<screen>&prompt.root; <userinput>cd /usr/src</userinput>
&prompt.root; <userinput>make buildworld</userinput>
&prompt.root; <userinput>make buildkernel</userinput></screen>
</step>
<step>
<para>Install &os; into the directory mounted over
<acronym>NFS</acronym>:</para>
<screen>&prompt.root; <userinput>make installworld DESTDIR=${NFSROOTDIR}</userinput>
&prompt.root; <userinput>make installkernel DESTDIR=${NFSROOTDIR}</userinput>
&prompt.root; <userinput>make distribution DESTDIR=${NFSROOTDIR}</userinput></screen>
</step>
<step>
<para>Test that the <acronym>TFTP</acronym> server works
and can download the boot loader which will be obtained
via <acronym>PXE</acronym>:</para>
<screen>&prompt.root; <userinput>tftp localhost</userinput>
tftp&gt; <userinput>get FreeBSD/install/boot/pxeboot</userinput>
Received 264951 bytes in 0.1 seconds</screen>
</step>
<step>
<para>Edit <filename>${NFSROOTDIR}/etc/fstab</filename> and
create an entry to mount the root file system over
<acronym>NFS</acronym>:</para>
<programlisting># Device Mountpoint FSType Options Dump Pass
myhost.example.com:/b/tftpboot/FreeBSD/install / nfs ro 0 0</programlisting>
<para>Replace <replaceable>myhost.example.com</replaceable>
with the hostname or <acronym>IP</acronym> address of the
<acronym>NFS</acronym> server. In this example, the root
file system is mounted read-only in order to prevent
<acronym>NFS</acronym> clients from potentially deleting
the contents of the root file system.</para>
</step>
<step>
<para>Set the root password in the &man.chroot.8;
environment:</para>
<screen>&prompt.root; <userinput>chroot ${NFSROOTDIR}</userinput>
&prompt.root; <userinput>passwd</userinput></screen>
<para>This sets the root password for client machines which
are <acronym>PXE</acronym> booting.</para>
</step>
<step>
<para>Enable &man.ssh.1; root logins for client machines
which are <acronym>PXE</acronym> booting by editing
<filename>${NFSROOTDIR}/etc/ssh/sshd_config</filename>
and enabling <literal>PermitRootLogin</literal>. This
option is documented in &man.sshd.config.5;.</para>
</step>
<step>
<para>Perform other customizations of the &man.chroot.8;
environment in ${NFSROOTDIR}. These customizations could
include things like adding packages with &man.pkg.add.1;,
editing the password file with &man.vipw.8;, or editing
&man.amd.conf.5; maps for automounting. For
example:</para>
<screen>&prompt.root; <userinput>chroot ${NFSROOTDIR}</userinput>
&prompt.root; <userinput>pkg_add -r bash</userinput></screen>
</step>
</procedure>
</sect2>
<sect2>
<title>Configuring Memory File Systems Used by
<filename>/etc/rc.initdiskless</filename></title>