|
Lines 2275-2284
Link Here
|
| 2275 |
<indexterm><primary>diskless operation</primary></indexterm> |
2275 |
<indexterm><primary>diskless operation</primary></indexterm> |
| 2276 |
|
2276 |
|
| 2277 |
<para>A FreeBSD machine can boot over the network and operate without a |
2277 |
<para>A FreeBSD machine can boot over the network and operate without a |
| 2278 |
local disk, using filesystems mounted from an NFS server. No system |
2278 |
local disk, using filesystems mounted from an NFS server. No |
| 2279 |
modification is necessary, beyond standard configuration files. |
2279 |
system modification is necessary, beyond standard configuration |
| 2280 |
Such a system is easy to set up because all the necessary elements |
2280 |
files. Such a system is relatively easy to set up because all |
| 2281 |
are readily available:</para> |
2281 |
the necessary elements are readily available:</para> |
| 2282 |
<itemizedlist> |
2282 |
<itemizedlist> |
| 2283 |
<listitem> |
2283 |
<listitem> |
| 2284 |
<para>There are at least two possible methods to load the kernel over |
2284 |
<para>There are at least two possible methods to load the kernel over |
|
Lines 2324-2333
Link Here
|
| 2324 |
|
2324 |
|
| 2325 |
<para>There are many ways to set up diskless workstations. Many |
2325 |
<para>There are many ways to set up diskless workstations. Many |
| 2326 |
elements are involved, and most can be customized to suit local |
2326 |
elements are involved, and most can be customized to suit local |
| 2327 |
taste. The following will describe the setup of a complete system, |
2327 |
taste. The following will describe variations on the setup of a |
| 2328 |
emphasizing simplicity and compatibility with the |
2328 |
complete system, emphasizing simplicity and compatibility with |
| 2329 |
standard FreeBSD startup scripts. The system described has the |
2329 |
the standard FreeBSD startup scripts. The system described has |
| 2330 |
following characteristics:</para> |
2330 |
the following characteristics:</para> |
| 2331 |
|
2331 |
|
| 2332 |
<itemizedlist> |
2332 |
<itemizedlist> |
| 2333 |
<listitem> |
2333 |
<listitem> |
|
Lines 2339-2350
Link Here
|
| 2339 |
configuration files overridden by ones specific to diskless |
2339 |
configuration files overridden by ones specific to diskless |
| 2340 |
operation or, possibly, to the workstation they belong to.</para> |
2340 |
operation or, possibly, to the workstation they belong to.</para> |
| 2341 |
<para>The parts of the <filename>root</filename> which have to be |
2341 |
<para>The parts of the <filename>root</filename> which have to be |
| 2342 |
writable are overlaid with &man.mfs.8; filesystems. Any changes |
2342 |
writable are overlaid with &man.mfs.8; (FreeBSD 4.X) or |
| 2343 |
will be lost when the system reboots.</para> |
2343 |
&man.md.4; (FreeBSD 5.X) filesystems. Any changes will be lost |
|
|
2344 |
when the system reboots.</para> |
| 2344 |
</listitem> |
2345 |
</listitem> |
| 2345 |
<listitem> |
2346 |
<listitem> |
| 2346 |
<para>The kernel is loaded by <application>etherboot |
2347 |
<para>The kernel is transferred and loaded either with |
| 2347 |
</application>, using DHCP (or BOOTP) and TFTP.</para> |
2348 |
<application>etherboot</application>, or <emphasis>PXE</emphasis>, |
|
|
2349 |
as some situations may mandate the use of either method.</para> |
| 2348 |
</listitem> |
2350 |
</listitem> |
| 2349 |
</itemizedlist> |
2351 |
</itemizedlist> |
| 2350 |
|
2352 |
|
|
Lines 2353-2358
Link Here
|
| 2353 |
other hosts.</para> |
2355 |
other hosts.</para> |
| 2354 |
</caution> |
2356 |
</caution> |
| 2355 |
|
2357 |
|
|
|
2358 |
<para>All the information in this section has been tested |
| 2359 |
using FreeBSD releases 4.9-RELEASE-p2 and 5.2-RELEASE. The text is |
| 2360 |
primarily structured for 4.X usage. Notes have been inserted where |
| 2361 |
appropriate to indicate 5.X changes.</para> |
| 2362 |
|
| 2363 |
|
| 2364 |
|
| 2365 |
<sect2> |
| 2366 |
<title>Background information</title> |
| 2367 |
|
| 2368 |
<para>Setting up diskless workstations is both relatively |
| 2369 |
straightforward and prone to errors. These are sometimes |
| 2370 |
difficult to diagnose for a number of reasons. For example: |
| 2371 |
<itemizedlist> |
| 2372 |
<listitem> |
| 2373 |
<para>Compile time options may determine the possible values |
| 2374 |
or syntax of runtime parameters.</para> |
| 2375 |
</listitem> |
| 2376 |
<listitem> |
| 2377 |
<para>Error messages are often cryptic or totally |
| 2378 |
absent.</para> |
| 2379 |
</listitem> |
| 2380 |
</itemizedlist> |
| 2381 |
|
| 2382 |
<para>In this context, having some knowledge of the background |
| 2383 |
mechanisms involved is very useful to solve the problems that |
| 2384 |
may arise.</para> |
| 2385 |
|
| 2386 |
<para>Several operations need to be performed for a successful |
| 2387 |
bootstrap:</para> |
| 2388 |
|
| 2389 |
<itemizedlist> |
| 2390 |
<listitem> |
| 2391 |
<para>The machine needs to obtain initial |
| 2392 |
parameters such as its IP address, executable file name, |
| 2393 |
server name, root path. This is done using the DHCP or |
| 2394 |
BOOTP protocols. DHCP is a compatible extension of BOOTP, |
| 2395 |
and uses the same port numbers and basic packet |
| 2396 |
format.</para> |
| 2397 |
<para>It is possible to configure a system to use only BOOTP. |
| 2398 |
The &man.bootpd.8; server program is included in the |
| 2399 |
base FreeBSD system.</para> |
| 2400 |
|
| 2401 |
<para>However, DHCP has a number of advantages over BOOTP (nicer |
| 2402 |
configuration files, possibility of using PXE, plus many |
| 2403 |
others not directly related to diskless operation), and |
| 2404 |
we shall describe mainly a DHCP configuration, with |
| 2405 |
equivalent exemples using &man.bootpd.8; when possible. |
| 2406 |
The sample configuration will use the ISC DHCP software |
| 2407 |
package (release 3.0.1.r11 was installed on the test |
| 2408 |
server: ).</para> |
| 2409 |
</listitem> |
| 2410 |
|
| 2411 |
<listitem> |
| 2412 |
<para>The machine needs to transfer one or several |
| 2413 |
programs to local memory. Either TFTP or NFS are used. The |
| 2414 |
choice between TFTP and NFS is a compile time option in |
| 2415 |
several places. A common source of error is to specify file |
| 2416 |
names for the wrong protocol: TFTP typically transfers all |
| 2417 |
files from a single directory on the server, and would |
| 2418 |
expect simple file names relative to this directory. NFS |
| 2419 |
needs absolute file paths.</para> |
| 2420 |
</listitem> |
| 2421 |
|
| 2422 |
<listitem> |
| 2423 |
<para>The possible intermediate bootstrap programs and the |
| 2424 |
kernel need to be initialized and executed. There are |
| 2425 |
several important variations in this area:</para> |
| 2426 |
<itemizedlist> |
| 2427 |
<listitem> |
| 2428 |
<para>When using PXE, the machine will load &man.pxeboot.8;, |
| 2429 |
which is a modified version of the FreeBSD third stage |
| 2430 |
loader. The loader will obtain most parameters necessary |
| 2431 |
to system startup, and leave them in the kernel |
| 2432 |
environment before transferring control. It is possible to |
| 2433 |
use a GENERIC kernel in this case.</para> |
| 2434 |
</listitem> |
| 2435 |
|
| 2436 |
<listitem> |
| 2437 |
<para><application>etherboot</application>, will directly |
| 2438 |
load the kernel, with less preparation. A kernel with |
| 2439 |
specific options will need to be built.</para> |
| 2440 |
</listitem> |
| 2441 |
</itemizedlist> |
| 2442 |
|
| 2443 |
<para>PXE and <application>etherboot</application> work |
| 2444 |
equally well with 4.X systems. Because 5.X kernels |
| 2445 |
normally let the loader do more work for them, PXE is |
| 2446 |
preferred for 5.X systems.</para> |
| 2447 |
<para>If your BIOS and network |
| 2448 |
cards support PXE, you should probably use it. However, |
| 2449 |
it is still possible to start a 5.2 system with |
| 2450 |
<application>etherboot</application></para> |
| 2451 |
|
| 2452 |
</listitem> |
| 2453 |
|
| 2454 |
<listitem> |
| 2455 |
<para>Finally, the machine needs to access its filesystems. NFS |
| 2456 |
is used in all cases.</para> |
| 2457 |
</listitem> |
| 2458 |
</itemizedlist> |
| 2459 |
|
| 2460 |
<para>See also &man.diskless.8;</para> |
| 2461 |
|
| 2462 |
</sect2> |
| 2356 |
|
2463 |
|
| 2357 |
<sect2> |
2464 |
<sect2> |
| 2358 |
<title>Setup Instructions</title> |
2465 |
<title>Setup Instructions</title> |
|
Lines 2364-2394
Link Here
|
| 2364 |
<secondary>booting</secondary> |
2471 |
<secondary>booting</secondary> |
| 2365 |
</indexterm> |
2472 |
</indexterm> |
| 2366 |
|
2473 |
|
| 2367 |
<para>There are two protocols that are commonly used to boot a |
2474 |
|
| 2368 |
workstation that retrieves its configuration over the network: BOOTP |
|
|
| 2369 |
and DHCP. They are used at several points in the workstation |
| 2370 |
bootstrap:</para> |
| 2371 |
<itemizedlist> |
| 2372 |
<listitem><para><application>etherboot</application> uses |
| 2373 |
DHCP (by default) or BOOTP (needs a configuration option) to |
| 2374 |
find the kernel. (PXE uses DHCP).</para> |
| 2375 |
</listitem> |
| 2376 |
<listitem><para>The kernel uses BOOTP to locate the NFS |
| 2377 |
root.</para> |
| 2378 |
</listitem> |
| 2379 |
</itemizedlist> |
| 2380 |
|
| 2381 |
<para>It is possible to configure a system to use only BOOTP. |
| 2382 |
The &man.bootpd.8; server program is included in the |
| 2383 |
base FreeBSD system.</para> |
| 2384 |
|
| 2385 |
<para>However, DHCP has a number of advantages over BOOTP (nicer |
| 2386 |
configuration files, possibility of using PXE, plus many others |
| 2387 |
not directly related to diskless operation), and we shall describe |
| 2388 |
both a pure BOOTP, and a BOOTP+DHCP configuration, with an |
| 2389 |
emphasis on the latter, which will use the ISC DHCP software |
| 2390 |
package.</para> |
| 2391 |
|
| 2392 |
<sect4> |
2475 |
<sect4> |
| 2393 |
<title>Configuration Using ISC DHCP</title> |
2476 |
<title>Configuration Using ISC DHCP</title> |
| 2394 |
<indexterm> |
2477 |
<indexterm> |
|
Lines 2399-2405
Link Here
|
| 2399 |
<para>The <application>isc-dhcp</application> server can answer |
2482 |
<para>The <application>isc-dhcp</application> server can answer |
| 2400 |
both BOOTP and DHCP requests.</para> |
2483 |
both BOOTP and DHCP requests.</para> |
| 2401 |
|
2484 |
|
| 2402 |
<para>As of release 4.4, <application>isc-dhcp |
2485 |
<para>As of release 4.9, <application>isc-dhcp |
| 2403 |
3.0</application> is not part of the base |
2486 |
3.0</application> is not part of the base |
| 2404 |
system. You will first need to install the |
2487 |
system. You will first need to install the |
| 2405 |
<filename role="package">net/isc-dhcp3-server</filename> port or the |
2488 |
<filename role="package">net/isc-dhcp3-server</filename> port or the |
|
Lines 2409-2415
Link Here
|
| 2409 |
<para>Once <application>isc-dhcp</application> is installed, it |
2492 |
<para>Once <application>isc-dhcp</application> is installed, it |
| 2410 |
needs a configuration file to run, (normally named |
2493 |
needs a configuration file to run, (normally named |
| 2411 |
<filename>/usr/local/etc/dhcpd.conf</filename>). Here follows |
2494 |
<filename>/usr/local/etc/dhcpd.conf</filename>). Here follows |
| 2412 |
a commented example:</para> |
2495 |
a commented example, where host <literal>margaux</literal> |
|
|
2496 |
uses <application>etherboot</application> and host |
| 2497 |
<literal>corbieres</literal> uses PXE.</para> |
| 2413 |
|
2498 |
|
| 2414 |
<programlisting> |
2499 |
<programlisting> |
| 2415 |
default-lease-time 600; |
2500 |
default-lease-time 600; |
|
Lines 2429-2437
Link Here
|
| 2429 |
hardware ethernet 01:23:45:67:89:ab; |
2514 |
hardware ethernet 01:23:45:67:89:ab; |
| 2430 |
fixed-address margaux.example.com; |
2515 |
fixed-address margaux.example.com; |
| 2431 |
next-server 192.168.4.4;<co id="co-dhcp-next-server"> |
2516 |
next-server 192.168.4.4;<co id="co-dhcp-next-server"> |
| 2432 |
filename "/tftpboot/kernel.diskless";<co id="co-dhcp-filename"> |
2517 |
filename "/data/misc/kernel.diskless";<co id="co-dhcp-filename"> |
| 2433 |
option root-path "192.168.4.4:/data/misc/diskless";<co id="co-dhcp-root-path"> |
2518 |
option root-path "192.168.4.4:/data/misc/diskless";<co id="co-dhcp-root-path"> |
| 2434 |
} |
2519 |
} |
|
|
2520 |
host corbieres { |
| 2521 |
hardware ethernet 00:02:b3:27:62:df; |
| 2522 |
fixed-address corbieres.example.com; |
| 2523 |
filename "pxeboot";<co id="co-dhcp-filenamePxe"> |
| 2524 |
next-server 192.168.4.4; |
| 2525 |
option root-path "192.168.4.4:/data/misc/diskless"; |
| 2526 |
} |
| 2435 |
} |
2527 |
} |
| 2436 |
</programlisting> |
2528 |
</programlisting> |
| 2437 |
|
2529 |
|
|
Lines 2446-2466
Link Here
|
| 2446 |
</callout> |
2538 |
</callout> |
| 2447 |
|
2539 |
|
| 2448 |
<callout arearefs="co-dhcp-next-server"><para>The |
2540 |
<callout arearefs="co-dhcp-next-server"><para>The |
| 2449 |
<literal>next-server</literal> directive designates |
2541 |
<literal>next-server</literal> directive designates the TFTP |
| 2450 |
the TFTP server (the default is to use the same host as the |
2542 |
or NFS server to use for loading loader or kernel file (the |
| 2451 |
DHCP server).</para> |
2543 |
default is to use the same host as the DHCP server).</para> |
| 2452 |
</callout> |
2544 |
</callout> |
| 2453 |
|
2545 |
|
| 2454 |
<callout arearefs="co-dhcp-filename"><para>The |
2546 |
<callout arearefs="co-dhcp-filename"><para>The |
| 2455 |
<literal>filename</literal> directive defines the file that |
2547 |
<literal>filename</literal> directive defines the file that |
| 2456 |
<application>etherboot</application> will load as a |
2548 |
<application>etherboot</application> or PXE will load for the |
| 2457 |
kernel. |
2549 |
next execution step. It must be specified according to the |
| 2458 |
<note><para>PXE appears to prefer a relative file |
2550 |
transfer method used. <application>etherboot</application> can |
| 2459 |
name, and it loads <command>pxeboot</command>, not the |
2551 |
be compiled to use NFS or TFTP. The FreeBSD port |
| 2460 |
kernel (<literal>option filename |
2552 |
configures NFS by default.</para> |
| 2461 |
"pxeboot"</literal>).</para> |
2553 |
</callout> |
| 2462 |
</note> |
2554 |
|
| 2463 |
</para> |
2555 |
<callout arearefs="co-dhcp-filenamePxe"><para>PXE uses TFTP, |
|
|
2556 |
which is why a relative file name is used here (this may |
| 2557 |
depend on the TFTP |
| 2558 |
server configuration, but would be fairly typical). Also, PXE |
| 2559 |
loads <filename>pxeboot</filename>, not the kernel.</para> |
| 2464 |
</callout> |
2560 |
</callout> |
| 2465 |
|
2561 |
|
| 2466 |
<callout arearefs="co-dhcp-root-path"><para>The |
2562 |
<callout arearefs="co-dhcp-root-path"><para>The |
|
Lines 2478-2484
Link Here
|
| 2478 |
</indexterm> |
2574 |
</indexterm> |
| 2479 |
|
2575 |
|
| 2480 |
<para>Here follows an equivalent <command>bootpd</command> |
2576 |
<para>Here follows an equivalent <command>bootpd</command> |
| 2481 |
configuration. This would be found in |
2577 |
configuration (reduced to one client). This would be found in |
| 2482 |
<filename>/etc/bootptab</filename>.</para> |
2578 |
<filename>/etc/bootptab</filename>.</para> |
| 2483 |
|
2579 |
|
| 2484 |
<para>Please note that <application>etherboot</application> |
2580 |
<para>Please note that <application>etherboot</application> |
|
Lines 2529-2534
Link Here
|
| 2529 |
of everything. Else refer to <xref linkend="ports"> for |
2625 |
of everything. Else refer to <xref linkend="ports"> for |
| 2530 |
information about ports and packages.</para> |
2626 |
information about ports and packages.</para> |
| 2531 |
|
2627 |
|
|
|
2628 |
<para>You can change the <application>etherboot</application> |
| 2629 |
configuration (ie: to use TFTP instead of NFS) by editing the |
| 2630 |
Config file in the etherboot source directory.</para> |
| 2631 |
|
| 2532 |
<para>For our setup, we shall use a boot floppy. For other methods |
2632 |
<para>For our setup, we shall use a boot floppy. For other methods |
| 2533 |
(PROM, or dos program), please refer to the |
2633 |
(PROM, or dos program), please refer to the |
| 2534 |
<application>etherboot</application> documentation.</para> |
2634 |
<application>etherboot</application> documentation.</para> |
|
Lines 2550-2555
Link Here
|
| 2550 |
|
2650 |
|
| 2551 |
</sect3> |
2651 |
</sect3> |
| 2552 |
|
2652 |
|
|
|
2653 |
<sect3> |
| 2654 |
<title>Booting with PXE</title> |
| 2655 |
|
| 2656 |
<para>By default, the &man.pxeboot.8; loader loads the kernel via NFS. |
| 2657 |
It can be compiled to use TFTP instead by specifying the |
| 2658 |
LOADER_TFTP_SUPPORT option in |
| 2659 |
<filename>/etc/make.conf</filename>. See the comments in |
| 2660 |
<filename>/etc/defaults/make.conf</filename> for |
| 2661 |
instructions.</para> |
| 2662 |
|
| 2663 |
<para>To use PXE when the machine starts, you will usually |
| 2664 |
need to select the <literal>Boot from network</literal> option |
| 2665 |
in your BIOS setup, or type a function key during the PC |
| 2666 |
initialization.</para> |
| 2667 |
|
| 2668 |
</sect3> |
| 2553 |
|
2669 |
|
| 2554 |
<sect3> |
2670 |
<sect3> |
| 2555 |
<title>Configuring the TFTP and NFS Servers</title> |
2671 |
<title>Configuring the TFTP and NFS Servers</title> |
|
Lines 2563-2570
Link Here
|
| 2563 |
<secondary>diskless operation</secondary> |
2679 |
<secondary>diskless operation</secondary> |
| 2564 |
</indexterm> |
2680 |
</indexterm> |
| 2565 |
|
2681 |
|
| 2566 |
<para>You need to enable <command>tftpd</command> on the TFTP |
2682 |
<para>If any of the boostrap programs (PXE, pxeboot, or etherboot) |
| 2567 |
server:</para> |
2683 |
are configured to use TFTP, you need to enable |
|
|
2684 |
<command>tftpd</command> on the file server:</para> |
| 2685 |
|
| 2568 |
<procedure> |
2686 |
<procedure> |
| 2569 |
<step> |
2687 |
<step> |
| 2570 |
<para>Create a directory from which <command>tftpd</command> |
2688 |
<para>Create a directory from which <command>tftpd</command> |
|
Lines 2575-2581
Link Here
|
| 2575 |
<para>Add this line to your |
2693 |
<para>Add this line to your |
| 2576 |
<filename>/etc/inetd.conf</filename>:</para> |
2694 |
<filename>/etc/inetd.conf</filename>:</para> |
| 2577 |
|
2695 |
|
| 2578 |
<programlisting>tftp dgram udp wait root /usr/libexec/tftpd tftpd -s /tftpboot</programlisting> |
2696 |
<programlisting>tftp dgram udp wait root /usr/libexec/tftpd tftpd -s /tftpboot</programlisting> |
| 2579 |
|
2697 |
|
| 2580 |
<note><para>It appears that at least some PXE versions want |
2698 |
<note><para>It appears that at least some PXE versions want |
| 2581 |
the TCP version of TFTP. In this case, add a second line, |
2699 |
the TCP version of TFTP. In this case, add a second line, |
|
Lines 2595-2601
Link Here
|
| 2595 |
location is set in both <filename>inetd.conf</filename> and |
2713 |
location is set in both <filename>inetd.conf</filename> and |
| 2596 |
<filename>dhcpd.conf</filename>.</para> |
2714 |
<filename>dhcpd.conf</filename>.</para> |
| 2597 |
|
2715 |
|
| 2598 |
<para>You also need to enable NFS and export the |
2716 |
<para>In all cases, you also need to enable NFS and export the |
| 2599 |
appropriate filesystem on the NFS server.</para> |
2717 |
appropriate filesystem on the NFS server.</para> |
| 2600 |
|
2718 |
|
| 2601 |
<procedure> |
2719 |
<procedure> |
|
Lines 2611-2617
Link Here
|
| 2611 |
point and replace <replaceable>margaux</replaceable> |
2729 |
point and replace <replaceable>margaux</replaceable> |
| 2612 |
with the name of the diskless workstation):</para> |
2730 |
with the name of the diskless workstation):</para> |
| 2613 |
|
2731 |
|
| 2614 |
<programlisting><replaceable>/data/misc</replaceable> -alldirs -ro <replaceable>margaux</replaceable></programlisting> |
2732 |
<programlisting><replaceable>/data/misc</replaceable> -alldirs -ro <replaceable>margaux corbieres</replaceable></programlisting> |
| 2615 |
</step> |
2733 |
</step> |
| 2616 |
<step> |
2734 |
<step> |
| 2617 |
<para>Tell <command>mountd</command> to reread its configuration |
2735 |
<para>Tell <command>mountd</command> to reread its configuration |
|
Lines 2632-2654
Link Here
|
| 2632 |
<secondary>kernel configuration</secondary> |
2750 |
<secondary>kernel configuration</secondary> |
| 2633 |
</indexterm> |
2751 |
</indexterm> |
| 2634 |
|
2752 |
|
| 2635 |
<para>Create a kernel configuration file for the diskless client |
2753 |
<para>If using <application>etherboot</application>, you need to |
| 2636 |
with the following options (in addition to the usual |
2754 |
create a kernel configuration file for the diskless client |
| 2637 |
ones):</para> |
2755 |
with the following options (in addition to the usual ones):</para> |
| 2638 |
|
2756 |
|
| 2639 |
<programlisting> |
2757 |
<programlisting> |
| 2640 |
options BOOTP # Use BOOTP to obtain IP address/hostname |
2758 |
options BOOTP # Use BOOTP to obtain IP address/hostname |
| 2641 |
options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info |
2759 |
options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info |
| 2642 |
options BOOTP_COMPAT # Workaround for broken bootp daemons. |
|
|
| 2643 |
</programlisting> |
2760 |
</programlisting> |
| 2644 |
|
2761 |
|
| 2645 |
<para>You may also want to use <literal>BOOTP_NFSV3</literal> and |
2762 |
<para>You may also want to use <literal>BOOTP_NFSV3</literal>, |
| 2646 |
<literal>BOOTP_WIRED_TO</literal> (refer to <filename>LINT</filename>).</para> |
2763 |
<literal>BOOT_COMPAT</literal> and |
| 2647 |
|
2764 |
<literal>BOOTP_WIRED_TO</literal> (refer to |
|
|
2765 |
<filename>LINT</filename>).</para> |
| 2766 |
|
| 2767 |
<para>These option names are historical and slightly |
| 2768 |
misleading as they actually enable indifferent use of DHCP or BOOTP |
| 2769 |
inside the kernel (it is also possible to force strict BOOTP or |
| 2770 |
DHCP use).</para> |
| 2771 |
|
| 2648 |
<para>Build the kernel (See <xref linkend="kernelconfig">), |
2772 |
<para>Build the kernel (See <xref linkend="kernelconfig">), |
| 2649 |
and copy it to the tftp directory, under the name listed |
2773 |
and copy it to the place specified in |
| 2650 |
in <filename>dhcpd.conf</filename>.</para> |
2774 |
<filename>dhcpd.conf</filename>.</para> |
| 2651 |
|
2775 |
|
|
|
2776 |
<note><para>When using PXE, building a kernel with the above |
| 2777 |
options is not strictly necessary. Enabling them will |
| 2778 |
cause more DHCP requests to be issued during kernel |
| 2779 |
startup, with a small risk of inconsistency between the |
| 2780 |
new values and those retrieved by pxeboot in some special |
| 2781 |
cases. The advantage of using them is that the host name |
| 2782 |
will be set as a side effect. Else you will need to set |
| 2783 |
the host name by another method, for example in a |
| 2784 |
client-specific <filename>rc.conf</filename> file.</para> |
| 2785 |
</note> |
| 2786 |
|
| 2787 |
<note><para>In order to be loadable with |
| 2788 |
<application>etherboot</application>, a 5.x kernel needs |
| 2789 |
to have the device hints compiled in. You would typically |
| 2790 |
set the following option in the configuration file (see |
| 2791 |
the NOTES configuration comments file). |
| 2792 |
<programlisting>hints "GENERIC.hints" </programlisting> |
| 2793 |
</para> |
| 2794 |
</note> |
| 2652 |
|
2795 |
|
| 2653 |
</sect3> |
2796 |
</sect3> |
| 2654 |
|
2797 |
|
|
Lines 2671-2676
Link Here
|
| 2671 |
the place where the filesystem will be created (the |
2814 |
the place where the filesystem will be created (the |
| 2672 |
<literal>DEST</literal> variable).</para> |
2815 |
<literal>DEST</literal> variable).</para> |
| 2673 |
|
2816 |
|
|
|
2817 |
<note><para>The <filename>clone_root</filename> script distributed |
| 2818 |
with FreeBSD 5.2 is out of date relative to the 4.x version, and |
| 2819 |
also needs a few specific 5.x adjustments. Please refer to PR |
| 2820 |
<ulink url="http://www.freebsd.org/cgi/query-pr.cgi?pr=misc/62417"> |
| 2821 |
misc/62417</ulink>.</para> |
| 2822 |
</note> |
| 2823 |
|
| 2674 |
<para>Refer to the comments at the top of the script for |
2824 |
<para>Refer to the comments at the top of the script for |
| 2675 |
instructions. They explain how the base filesystem is built, |
2825 |
instructions. They explain how the base filesystem is built, |
| 2676 |
and how files may be selectively overridden by versions specific |
2826 |
and how files may be selectively overridden by versions specific |
|
Lines 2689-2723
Link Here
|
| 2689 |
confusing. Use them for reference only, except if you prefer |
2839 |
confusing. Use them for reference only, except if you prefer |
| 2690 |
the method that they describe, in which case you will need |
2840 |
the method that they describe, in which case you will need |
| 2691 |
customized <filename>rc</filename> scripts.</para> |
2841 |
customized <filename>rc</filename> scripts.</para> |
|
|
2842 |
|
| 2843 |
<note><para>When using PXE, it may happen that the loader will |
| 2844 |
get a wrong idea of the root filesystem to be used by the |
| 2845 |
kernel (this will be the case if the cloned root |
| 2846 |
<filename>/etc/fstab</filename> is a copy of the server's, |
| 2847 |
as the client-specific version will not be visible by the |
| 2848 |
loader, which looks for hints there).</para> |
| 2849 |
<para>This will cause |
| 2850 |
error messages at the end of the kernel initialization, |
| 2851 |
when the kernel tries to mount the wrong root and fails, |
| 2852 |
or even actual errors if it succeeds because a local disk |
| 2853 |
happens to be present. </para> |
| 2854 |
|
| 2855 |
<para>It is possible to prevent this problem from happening |
| 2856 |
by inserting the following line in |
| 2857 |
<filename>/boot/loader.conf</filename>:</para> |
| 2858 |
<programlisting> |
| 2859 |
vfs.root.mountfrom="" |
| 2860 |
</programlisting> |
| 2861 |
</note> |
| 2862 |
|
| 2863 |
|
| 2692 |
</sect3> |
2864 |
</sect3> |
| 2693 |
|
2865 |
|
| 2694 |
<sect3> |
2866 |
<sect3> |
| 2695 |
<title>Configuring Swap</title> |
2867 |
<title>Configuring Swap</title> |
| 2696 |
|
2868 |
|
| 2697 |
<para>If needed, a swap file located on the server can be |
2869 |
<para>If needed, a swap file located on the server can be |
| 2698 |
accessed via NFS. The exact <filename>bootptab</filename> |
2870 |
accessed via NFS. One of the methods commonly used to do this |
| 2699 |
or <filename>dhcpd.conf</filename> options are not clearly |
2871 |
has been discontinued in release 5.X.</para> |
| 2700 |
documented at this time. The following configuration |
2872 |
|
| 2701 |
suggestions have been reported to work in some installations |
2873 |
<sect4> |
| 2702 |
using isc-dhcp 3.0rc11.</para> |
2874 |
<title>NFS swap with FreeBSD 4.x</title> |
|
|
2875 |
|
| 2876 |
<para>The swap file location and size can be specified with |
| 2877 |
BOOTP/DHCP FreeBSD-specific options 128 and 129. Examples of |
| 2878 |
configuration files for isc-dhcp 3 or bootpd follow.</para> |
| 2879 |
|
| 2703 |
<procedure> |
2880 |
<procedure> |
| 2704 |
<step><para>Add the following lines to |
2881 |
<step><para>Add the following lines to |
| 2705 |
<filename>dhcpd.conf</filename>:</para> |
2882 |
<filename>dhcpd.conf</filename>:</para> |
| 2706 |
<programlisting> |
2883 |
<programlisting> |
| 2707 |
# Global section |
2884 |
# Global section |
| 2708 |
option swap-path code 128 = string; |
2885 |
option swap-path code 128 = string; |
| 2709 |
option swap-size code 129 = integer 32; |
2886 |
option swap-size code 129 = integer 32; |
| 2710 |
|
2887 |
|
| 2711 |
host margaux { |
2888 |
host margaux { |
| 2712 |
... # Standard lines, see above |
2889 |
... # Standard lines, see above |
| 2713 |
option swap-path <replaceable>"192.168.4.4:/netswapvolume/netswap"</replaceable>; |
2890 |
option swap-path <replaceable>"192.168.4.4:/netswapvolume/netswap"</replaceable>; |
| 2714 |
option swap-size <replaceable>64000</replaceable>; |
2891 |
option swap-size <replaceable>64000</replaceable>; |
| 2715 |
} |
2892 |
} |
| 2716 |
</programlisting> |
2893 |
</programlisting> |
| 2717 |
<para>The idea is that, at least for a FreeBSD client, |
2894 |
|
| 2718 |
DHCP/BOOTP option code 128 is the path to the NFS swap file, |
2895 |
<para><literal>swap-path</literal> is the path to a directory |
| 2719 |
and option code 129 is the swap size in kilobytes. Older |
2896 |
where swap files will be located. Each file will be named |
| 2720 |
versions of <command>dhcpd</command> allowed a syntax of |
2897 |
<filename>swap.<replaceable>clientIp</replaceable></filename>.</para> |
|
|
2898 |
|
| 2899 |
<para>Older versions of <command>dhcpd</command> used a syntax of |
| 2721 |
<literal>option option-128 "...</literal>, which is no |
2900 |
<literal>option option-128 "...</literal>, which is no |
| 2722 |
longer supported.</para> |
2901 |
longer supported.</para> |
| 2723 |
<para><filename>/etc/bootptab</filename> would use the |
2902 |
<para><filename>/etc/bootptab</filename> would use the |
|
Lines 2733-2744
Link Here
|
| 2733 |
<step> |
2912 |
<step> |
| 2734 |
<para>On the NFS swap file server, create the swap |
2913 |
<para>On the NFS swap file server, create the swap |
| 2735 |
file(s)</para> |
2914 |
file(s)</para> |
| 2736 |
<screen> |
2915 |
<screen> |
| 2737 |
&prompt.root; <userinput>mkdir <replaceable>/netswapvolume/netswap</replaceable></userinput> |
2916 |
&prompt.root; <userinput>mkdir <replaceable>/netswapvolume/netswap</replaceable></userinput> |
| 2738 |
&prompt.root; <userinput>cd <replaceable>/netswapvolume/netswap</replaceable></userinput> |
2917 |
&prompt.root; <userinput>cd <replaceable>/netswapvolume/netswap</replaceable></userinput> |
| 2739 |
&prompt.root; <userinput>dd if=/dev/zero bs=1024 count=<replaceable>64000</replaceable> of=swap.<replaceable>192.168.4.6</replaceable></userinput> |
2918 |
&prompt.root; <userinput>dd if=/dev/zero bs=1024 count=<replaceable>64000</replaceable> of=swap.<replaceable>192.168.4.6</replaceable></userinput> |
| 2740 |
&prompt.root; <userinput>chmod 0600 swap.<replaceable>192.168.4.6</replaceable></userinput> |
2919 |
&prompt.root; <userinput>chmod 0600 swap.<replaceable>192.168.4.6</replaceable></userinput> |
| 2741 |
</screen> |
2920 |
</screen> |
| 2742 |
<para><replaceable>192.168.4.6</replaceable> is the IP address |
2921 |
<para><replaceable>192.168.4.6</replaceable> is the IP address |
| 2743 |
for the diskless client.</para> |
2922 |
for the diskless client.</para> |
| 2744 |
</step> |
2923 |
</step> |
|
Lines 2747-2759
Link Here
|
| 2747 |
<para>On the NFS swap file server, add the following line to |
2926 |
<para>On the NFS swap file server, add the following line to |
| 2748 |
<filename>/etc/exports</filename>:</para> |
2927 |
<filename>/etc/exports</filename>:</para> |
| 2749 |
<programlisting> |
2928 |
<programlisting> |
| 2750 |
<replaceable>/netswapvolume</replaceable> -maproot=0:10 -alldirs <replaceable>margaux</replaceable> |
2929 |
<replaceable>/netswapvolume</replaceable> -maproot=0:10 -alldirs <replaceable>margaux</replaceable> |
| 2751 |
</programlisting> |
2930 |
</programlisting> |
| 2752 |
<para>Then tell <application>mountd</application> to reread the |
2931 |
<para>Then tell <application>mountd</application> to reread the |
| 2753 |
exports file, as above.</para> |
2932 |
exports file, as above.</para> |
| 2754 |
</step> |
2933 |
</step> |
| 2755 |
</procedure> |
2934 |
</procedure> |
|
|
2935 |
</sect4> |
| 2936 |
|
| 2937 |
<sect4> |
| 2938 |
<title>NFS swap with FreeBSD 5.x</title> |
| 2939 |
|
| 2940 |
<para>The kernel does not support enabling NFS swap at boot |
| 2941 |
time. Swap must be enabled by the startup scripts, by |
| 2942 |
mounting a writeable file system and creating and enabling a |
| 2943 |
swap file. This can be done, for example, in |
| 2944 |
<filename>/etc/rc.local</filename>. Example:</para> |
| 2945 |
|
| 2946 |
<screen> |
| 2947 |
swapfile=/writableVolume/swap/swap.<replaceable>MyIP</replaceable> |
| 2948 |
dd if=/dev/zero of=$swapfile bs=1k count=1 oseek=100000 |
| 2949 |
swapon $swapfile |
| 2950 |
rm -rf $swapfile |
| 2951 |
</screen> |
| 2756 |
|
2952 |
|
|
|
2953 |
</sect4> |
| 2757 |
</sect3> |
2954 |
</sect3> |
| 2758 |
|
2955 |
|
| 2759 |
<sect3> |
2956 |
<sect3> |