192302SluigiIMPORTANT NOTE: 243240Sdillon 392302SluigiAs of Feb. 11, 2002 (and indeed, for quite some time before that), 492302Sluigithe /etc/rc.diskless{1,2} scripts support a slightly different 592302Sluigidiskless boot process than the one documented in the rest of 692302Sluigithis file (which is 3 years old). 792302Sluigi 892302SluigiI am not deleting the information below because it contains some 992302Sluigiuseful background information on diskless operation, but for the 1092302Sluigiactual details you should look at /etc/rc.diskless1, /etc/rc.diskless2, 1192302Sluigiand the /usr/share/examples/diskless/clone_root script which can 1292302Sluigibe useful to set up clients and server for diskless boot. 1392302Sluigi 1492302Sluigi--- $FreeBSD$ --- 1592302Sluigi------------------------------------------------------------------------ 1692302Sluigi 1743240Sdillon BOOTP configuration mechanism 1843240Sdillon 1943240Sdillon Matthew Dillon 2043240Sdillon dillon@backplane.com 2143240Sdillon 2243240Sdillon BOOTP kernels automatically configure the machine's IP address, netmask, 2343240Sdillon optional NFS based swap, and NFS based root mount. The NFS server will 2443240Sdillon typically export a shared read-only /, /usr, and /var to any number of 2543240Sdillon workstations. The shared read-only root is typically either the server's 26130786Smpp own root or, if you are more security conscious, a contrived root. 2743240Sdillon 2843240Sdillon The key issue with starting up a BOOTP kernel is that you typically want 2943240Sdillon to export read-only NFS partitions from the server, yet still be able to 3043240Sdillon customize each workstation ( or not ). 3143240Sdillon 3243808Sdillon /etc/rc.diskless1 is responsible for doing core mounts and for retargeting 3343808Sdillon /conf/ME ( part of the read-only root NFS mount ) to /conf/$IP_OF_CLIENT. 3443808Sdillon /etc/rc.conf.local and /etc/rc.local, along with other machine-specific 3543808Sdillon configuration files, are typically softlinks to /conf/ME/<filename>. 3643240Sdillon 3743240Sdillon In the BOOTP workstation /conf/$IP/rc.conf.local, you must typically 3843240Sdillon turn *OFF* most of the system option defaults in /etc/rc.conf as well 3943240Sdillon as do additional custom configuration of your environment 4043240Sdillon 4143240Sdillon The /usr/src/share/examples/diskless directory contains a typical 4243240Sdillon X session / sshd based workstation configuration. The directories 4343240Sdillon involved are HT.DISKLESS/ and 192.157.86.12/. 4443240Sdillon 4543240Sdillon Essentially, the $IP/ directory ( which rc.diskless looks for in 4643240Sdillon /conf/$IP/ ) contains all the junk. The HT.DISKLESS directory exists 4743240Sdillon to hold common elements of your custom configuration so you do not have 4843240Sdillon to repeat those elements for each workstation. The example /conf 4943240Sdillon structure included here shows how to create a working sshd setup ( so 5043240Sdillon you can sshd into the diskless workstation ), retarget xdm's pid and error 5143240Sdillon files to R+W directories if /usr is mounted read-only, and retarget 5243240Sdillon syslogd and other programs. This example is not designed to run out of 5343240Sdillon the box and some modifications are required. 5443240Sdillon 5543808Sdillon >> NOTE << HT.DISKLESS/ttys contains the typical configuration required 5643808Sdillon to bring X up at boot time. Essentially, it runs xdm in the foreground 5743808Sdillon with the appropriate arguments rather then a getty on ttyv0. You must 5843808Sdillon run xdm on ttyv0 in order to prevent xdm racing with getty on a virtual 5943808Sdillon terminal. Such a race can cause your keyboard to be directed away from 6043808Sdillon the X session, essentially making the session unusable. 6143808Sdillon 6243240Sdillon Typically you should start with a clean slate by tar-copying this example 6343240Sdillon directory to /conf and then hack on it in /conf rather then in 6443240Sdillon /usr/share/examples/diskless. 6543240Sdillon 6643240Sdillon BOOTP CLIENT SETUP 6743240Sdillon 6843240Sdillon Here is a typical kernel configuration. If you have only one ethernet 6943240Sdillon interface you do not need to wire BOOTP to a specific interface name. 7043240Sdillon BOOTP requires NFS and NFS_ROOT, and our boot scripts require MFS. If 7143240Sdillon your /tmp is *not* a softlink to /var/tmp, the scripts also require NULLFS 7243240Sdillon 7343240Sdillon# BootP 7443240Sdillon# 7543240Sdillonoptions BOOTP # Use BOOTP to obtain IP address/hostname 7643240Sdillonoptions BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info 7743240Sdillonoptions "BOOTP_NFSV3" # Use NFS v3 to NFS mount rootoptions 7843240Sdillonoptions BOOTP_COMPAT # Workaround for broken bootp daemons. 7943240Sdillon#options "BOOTP_WIRED_TO=de0" 8043240Sdillon 8143240Sdillonoptions MFS # Memory File System 8243240Sdillonoptions NFS # Network Filesystem 8343240Sdillonoptions NFS_ROOT # Nfs can be root 8443240Sdillonoptions NULLFS # nullfs to map /var/tmp to /tmp 8543240Sdillon 8643240Sdillon BOOTP SERVER SETUP 8743240Sdillon 8843240Sdillon The BOOTP server must be running on the same logical LAN as the the 8943240Sdillon BOOTP client(s). You need to setup two things: 9043240Sdillon 9143240Sdillon (1) You need to NFS-export /, /usr, and /var. 9243240Sdillon 9343240Sdillon (2) You need to run a BOOTP server. DHCPD can do this. 9443240Sdillon 9543240Sdillon 9643240Sdillon NFS Export: 9743240Sdillon 9843240Sdillon Here is an example "/etc/exports" file. 9943240Sdillon 10043240Sdillon/ -ro -maproot=root: -network 192.157.86.0 -mask 255.255.255.192 10143240Sdillon/usr -ro -maproot=root: -network 192.157.86.0 -mask 255.255.255.192 10243240Sdillon/var -ro -maproot=root: -network 192.157.86.0 -mask 255.255.255.192 10343240Sdillon 10443240Sdillon In order to be an NFS server, the server must run portmap, mountd, 10543240Sdillon nfsd, and rpc.statd. The standard NFS server options in /etc/rc.conf 10643240Sdillon will work ( you should put your overrides in /etc/rc.conf.local on the 10743240Sdillon server and not edit the distribution /etc/rc.conf, though ). 10843240Sdillon 10943240Sdillon BOOTP Server: 11043240Sdillon 11143240Sdillon This configuration file "/etc/dhcpd.conf" example is for 11243240Sdillon the '/usr/ports/net/isc-dhcp' dhcpd port. 11343240Sdillon 11443240Sdillon subnet 192.157.86.0 netmask 255.255.255.192 { 11543240Sdillon # range if you want to run the core dhcpd service of 11643240Sdillon # dynamic IP assignment, but it is not used with BOOTP 11743240Sdillon # workstations 11843240Sdillon range 192.157.86.32 192.157.86.62; 11943240Sdillon 12043240Sdillon # misc configuration. 12143240Sdillon # 12243240Sdillon option routers 192.157.86.2; 12343240Sdillon option domain-name-servers 192.157.86.2; 12443240Sdillon 12543240Sdillon server-name "apollo.fubar.com"; 12643240Sdillon option subnet-mask 255.255.255.192; 12743240Sdillon option domain-name-servers 192.157.86.2; 12843240Sdillon option domain-name "fubar.com"; 12943240Sdillon option broadcast-address 192.157.86.63; 13043240Sdillon option routers 192.157.86.2; 13143240Sdillon } 13243240Sdillon 13343240Sdillon host test1 { 13443240Sdillon hardware ethernet 00:a0:c9:d3:38:25; 13543240Sdillon fixed-address 192.157.86.11; 13643240Sdillon option root-path "192.157.86.2:/"; 13743240Sdillon option option-128 "192.157.86.2:/images/swap"; 13843240Sdillon } 13943240Sdillon 14043240Sdillon host test2 { 14143240Sdillon # hardware ethernet 00:e0:29:1d:16:09; 14243240Sdillon hardware ethernet 00:10:5a:a8:94:0e; 14343240Sdillon fixed-address 192.157.86.12; 14443240Sdillon option root-path "192.157.86.2:/"; 14543240Sdillon option option-128 "192.157.86.2:/images/swap"; 14643240Sdillon } 14743240Sdillon 14843240Sdillon SWAP. This example includes options to automatically BOOTP configure 14943240Sdillon NFS swap on each workstation. In order to use this capabilities you 15043240Sdillon need to NFS-export a swap directory READ+WRITE to the workstations. 15143240Sdillon 15243240Sdillon You must then create a swap directory for each workstation you wish to 15343240Sdillon assign swap to. In this example I created a dummy user 'lander' and 15443240Sdillon did an NFS export of /images/swap enforcing a UID of 'lander' for 15543240Sdillon all accesses. 15643240Sdillon 15743240Sdillon apollo:/usr/ports/net# ls -la /images/swap 15843240Sdillon total 491786 15943240Sdillon drwxr-xr-x 2 root wheel 512 Dec 28 07:00 . 16043240Sdillon drwxr-xr-x 8 root wheel 512 Jan 20 10:54 .. 16143240Sdillon -rw-r--r-- 1 lander wheel 33554432 Dec 23 14:35 swap.192.157.86.11 16243240Sdillon -rw-r--r-- 1 lander wheel 335544320 Jan 24 16:55 swap.192.157.86.12 16343240Sdillon -rw-r--r-- 1 lander wheel 134217728 Jan 21 17:19 swap.192.157.86.6 16443240Sdillon 16543240Sdillon A swap file is best created with dd: 16643240Sdillon 16743240Sdillon # create a 32MB swap file for a BOOTP workstation 16843240Sdillon dd if=/dev/zero of=swap.IPADDRESS bs=1m count=32 16943240Sdillon 17043240Sdillon It is generally a good idea to give your workstations some swap space, 17143240Sdillon but not a requirement if they have a lot of memory. 17243240Sdillon 173