Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 1995 17:39:15 -0700
From:      Steve Passe <smp@rick.systemsix.com>
To:        doc@freebsd.org
Message-ID:  <199503200039.RAA01896@rick.systemsix.com>

next in thread | raw e-mail | index | archive | help
Hello,

	Here is my outline for a cookbook approach to setting up DISKLESS
nodes under FreeBSD 2.x.  Please send comments, suggestions, etc.  I am most
interested in technical issues, not grammer.  In particular, the following
is still bothering me:

I use these lines in my config file:
options		DISKLESS
config		kernel	root on wd0 swap on wd0 and vn0 dumps on wd0

What should they be in 2.0???

The above works, but obviously isn't right.  Using the directions outlined
below I have succesfully brought up two different machines as DISKLESS
nodes with 950210-SNAP, a 386/SMC & a 486/NE2000.

I would also like any hints as to security considerations for my approach.

Steve Passe
smp@clem.systemsix.com


-----------------------------------------------------------------------------
#############################################################################
This document describes the method I used to set up a FreeBSD 2.x system as
a DISKLESS client server and the setup of those DISKLESS clients.  It builds
on documents by Todd Pfaff and Martin Renters.

#############################################################################
######################### [ site specific values ] ##########################


<ETHERNET_ADDR> = address of your ethernet card in hex: nn.nn.nn.nn.nn.nn
<DOMAIN_ADDR> = domain portion of address space, eg. 192.168.666
<DOMAIN_NETMASK> = network mask for your domain
<DNS_ADDR> = address of DNS service
<GW_ADDR> = address of   gateway
<HOST_ADDR> = hostddress
<CLIENT_ADDR> = client's address
<DOMAIN_NAME> = name of your domain
<HOST_NAME> = name of file/swap server
<CLIENT_NAME> = name of DISKLESS node


#############################################################################
############################ [ one time setup ] #############################

# [ create a tree of common files used by all DISKLESS nodes: ]
# mkdir /usr/rootfs
# chmod 755 /usr/rootfs
# mkdir /usr/rootfs/common
# chmod 755 /usr/rootfs/common
# cd /
# find bin lkm sbin stand | cpio -pvdm /usr/rootfs/common

# [ build a common DISKLESS kernel: ]
# cd /usr/src/sys/i386/conf
# [ create DISKLESS: ]
--------------------------------- cut --------------------------------------
# DISKLESS -- DISKLESS machine with NFS disks
#
#	DISKLESS,v 1.00
#

machine		"i386"
cpu		"I386_CPU"
cpu		"I486_CPU"
cpu		"I586_CPU"
ident		DISKLESS
maxusers	10

options		MATH_EMULATE		#Support for x87 emulation
options		INET			#InterNETworking
options		FFS			#Berkeley Fast Filesystem
options		NFS			#Network Filesystem
options		MSDOSFS			#MSDOS Filesystem
#options		"CD9660"		#ISO 9660 Filesystem
options		PROCFS			#Process filesystem
options		"COMPAT_43"		#Compatible with BSD 4.3
options		"SCSI_DELAY=1"		#Be pessimistic about Joe SCSI device
options		BOUNCE_BUFFERS		#include support for DMA bounce buffers
options		UCONSOLE		#Allow users to grab the console

# does this do anything in 2.x???
options		DISKLESS

# what should this really be???
##config		kernel	root on wd0 swap on wd0 and wd1 and sd0 and sd1 and vn0 dumps on wd0
config		kernel	root on wd0 swap on wd0 and vn0 dumps on wd0

controller	isa0
controller	pci0

controller	fdc0	at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
disk		fd0	at fdc0 drive 0
disk		fd1	at fdc0 drive 1
#tape		ft0	at fdc0 drive 2

device		sc0	at isa? port "IO_KBD" tty irq 1 vector scintr
device		npx0	at isa? port "IO_NPX" irq 13 vector npxintr

device		sio0	at isa? port "IO_COM1" tty irq 4 vector siointr
device		sio1	at isa? port "IO_COM2" tty irq 3 vector siointr
#device		sio2	at isa? port "IO_COM3" tty irq 5 vector siointr
#device		sio3	at isa? port "IO_COM4" tty irq 9 vector siointr

device		lpt0	at isa? port? tty irq 7 vector lptintr
#device		lpt1	at isa? port? tty
#device		lpt2	at isa? port? tty

# network card drivers:
#device de0
#device ed0 at isa? port 0x280 net irq  5 iomem 0xd8000 vector edintr
device ed0 at isa? port 0x280 net irq 10 iomem 0xc8000 vector edintr
device ed1 at isa? port 0x300 net irq  5 iomem 0xd8000 vector edintr
#device ie0 at isa? port 0x360 net irq  7 iomem 0xd0000 vector ieintr
#device ep0 at isa? port 0x300 net irq 10 vector epintr
#device lnc0 at isa? port 0x280 net irq 10 drq 0 vector lncintr
#device le0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector le_intr
#device ze0 at isa? port 0x300 net irq 5 iomem 0xd8000 vector zeintr

pseudo-device	loop
pseudo-device	ether
pseudo-device	log
#pseudo-device	sl	1
#pseudo-device	ppp	1
pseudo-device	pty	32
pseudo-device	speaker
pseudo-device	gzip		# Exec gzipped a.out's
pseudo-device	vn
--------------------------------- end --------------------------------------

# config DISKLESS
# cd /usr/src/sys/compile/DISKLESS
# make depend
# make
# cp kernel /usr/rootfs/common

# [ create a home for DISKLESS SWAP partitions: ]
# mkdir /usr/swapfs
# chmod 700 /usr/swapfs

# [ create a home for tftpd configuration files: ]
# mkdir /tftpboot
# chmod 755 /tftpboot

# [ create /etc/bootptab: ]
--------------------------------- cut --------------------------------------
# /etc/bootptab: database for bootp server (/etc/bootpd)
# Last update: gwr, Sun Dec 12 19:00:00 EDT 1993
# Blank lines and lines beginning with '#' are ignored.
#
# Legend:	(see bootptab.5)
#	first field -- hostname (not indented)
#	bf -- bootfile
#	bs -- bootfile size in 512-octet blocks
#	cs -- cookie servers
#	df -- dump file name
#	dn -- domain name
#	ds -- domain name servers
#	ef -- extension file
#	gw -- gateways
#	ha -- hardware address
#	hd -- home directory for bootfiles
#	hn -- host name set for client
#	ht -- hardware type
#	im -- impress servers
#	ip -- host IP address
#	lg -- log servers
#	lp -- LPR servers
#	ns -- IEN-116 name servers
#	ra -- reply address
#	rl -- resource location protocol servers
#	rp -- root path
#	sa -- boot server address
#	sm -- subnet mask
#	sw -- swap server
#	tc -- template host (points to similar host entry)
#	td -- TFTP directory
#	to -- time offset (seconds)
#	ts -- time servers
#	vm -- vendor magic number
#	Tn -- generic option tag n
#
# Be careful about including backslashes where they're needed.  Weird (bad)
# things can happen when a backslash is omitted where one is intended.
# Also, note that generic option data must be either a string or a
# sequence of bytes where each byte is a two-digit hex value.

# First, we define a global entry which specifies the stuff every host uses.

# If you leave "td" empty, run bootpd with the "-c /tftpboot" switch
# so path names (boot files) will be interpreted relative to the same
# directory as tftpd will use when opening files.
.default1:\
	:dn="<DOMAIN_NAME>":\
	:hn:\
	:ht=ether:\
	:sm=<DOMAIN_NETMASK>:\
	:ds=<DNS_ADDR>:\
	:gw=<GW_ADDR>:\
	:td=/tftpboot:\
	:vm=rfc1048:\
	:to=auto:
--------------------------------- end --------------------------------------

# [ edit /etc/inetd.conf: ]
--------------------------------- cut --------------------------------------
<< #tftp	dgram	udp	wait	nobody	/usr/libexec/tftpd	tftpd

>> tftp	dgram	udp	wait	nobody	/usr/libexec/tftpd	tftpd -l /tftpboot
>> bootps	dgram	udp	wait	root	/usr/libexec/bootpd	bootpd
--------------------------------- end --------------------------------------

# [ tell inetd to reread /etc/inetd.conf, ie, enable tftpd & bootpd: ]
# ps -ax | grep inetd
# kill -HUP <INETD_PID>


#############################################################################
#################### [ setup for each DISKLESS node: ] ######################

# [ create /tftpboot/cfg.<DOMAIN_ADDR>.<CLIENT_ADDR>: ]
--------------------------------- cut --------------------------------------
rootfs <DOMAIN_ADDR>.<HOST_ADDR>:/usr/rootfs/<CLIENT_NAME>
swapfs <DOMAIN_ADDR>.<HOST_ADDR>:/usr/swapfs
swapsize 20000
hostname <CLIENT_NAME>.<DOMAIN_NAME>
--------------------------------- end --------------------------------------
# chmod 644 /tftpboot/cfg.<DOMAIN_ADDR>.<CLIENT_ADDR>

# [ add entry for CLIENT_NAME to /etc/bootptab: ]
--------------------------------- cut --------------------------------------
<CLIENT_NAME>:\
	:tc=.default1:\
	:ha=<ETHERNET_ADDR>:\
	:ip=<DOMAIN_ADDR>.<CLIENT_ADDR>:
--------------------------------- end --------------------------------------

# [ create/edit /etc/exports to allow DISKLESS node to NFS mount HOST: ]
--------------------------------- cut --------------------------------------
/usr	-maproot=0:0 -alldirs <CLIENT_NAME>
--------------------------------- end --------------------------------------
# [ tell mountd to reread /etc/exports: ]
# ps -ax | grep mountd
# kill -HUP <MOUNTD_PID>

# [ create a SWAP file: ]
# touch /usr/swapfs/swap.<DOMAIN_ADDR>.<CLIENT_ADDR>
# chmod 600 swap.<DOMAIN_ADDR>.<CLIENT_ADDR>

# [ create a home for this DISKLESS node: ]
# mkdir /usr/rootfs/<CLIENT_NAME>
# chmod 755 /usr/rootfs/<CLIENT_NAME>

# [ create needed directories: ]
# cd /usr/rootfs/<CLIENT_NAME>
# mkdir mnt proc tmp usr
# chown bin:bin tmp
# chmod 1777 tmp
# chmod 555 proc

# [ make a link to the common kernel OR create a unique version ]
# ln /usr/rootfs/common/kernel kernel

# [ link to the common files: ]
# cd /usr/rootfs/common
# find bin lkm sbin stand | cpio -pvdlm /usr/rootfs/<CLIENT_NAME>

# [ cleanup /usr/rootfs/<CLIENT_NAME>stand/etc: ]
# cd /usr/rootfs/<CLIENT_NAME>/stand/etc
# rm hosts defaultrouter myname
# cp ../../../common/stand/etc/hosts .
# cp ../../../common/stand/etc/defaultrouter .
# cp ../../../common/stand/etc/myname .        
# [ edit hosts defaultrouter myname as needed ]

# [ create a tree of unique files used by this DISKLESS node: ]
# cd /
# cp COPYRIGHT .cshrc .profile /usr/rootfs/<CLIENT_NAME>
# find dev etc root var | cpio -pvdm /usr/rootfs/<CLIENT_NAME>

# [ cleanup /usr/rootfs/<CLIENT_NAME>/etc: ]
# cd /usr/rootfs/<CLIENT_NAME>/etc
# rm exports fstab

# [ create fstab: ]
--------------------------------- cut --------------------------------------
<HOST_NAME>:/usr/rootfs/<CLIENT_NAME>	/	nfs rw 0 0
<HOST_NAME>:/usr			/usr	nfs rw 0 0
--------------------------------- end --------------------------------------

# [ patch rc: ]
--------------------------------- cut --------------------------------------
diff -r1.1 rc
66c66,67
< mount -a -t nonfs
---
> ##mount -a -t nonfs
> mount -a
230c231
< mount -a -t nfs >/dev/null 2>&1 &	# XXX shouldn't need background
---
> ##mount -a -t nfs >/dev/null 2>&1 &	# XXX shouldn't need background
--------------------------------- end --------------------------------------

# [ patch netstart: ]
--------------------------------- cut --------------------------------------
diff -r1.1 netstart
8c8
< timedflags=NO
---
> timedflags=
14c14
< nfs_client=NO
---
> nfs_client=YES
30a31,32
> else
> 	hostname=`hostname -s`
41c43
< 	ifn=`expr $i : '/etc/hostname\.\(.*\)'`
---
> 	ifn=`expr $i : '/etc/hostname\.\(.*[0-9]$\)'`
--------------------------------- end --------------------------------------

# [ build a boot disk: ]
# [ NOTE: I had to rebuild netboot.com with SMC support turned off to get
	  a netboot.com that would boot from a NE2000 board. ]

( on a DOS box create a bootable floppy disk, place in FreeBSD 2.x drive )

# mount_msdos /dev/fd0a /mnt
# cp /usr/mdec/netboot.com /mnt
# umount /mnt

#############################################################################

Place the above disk in the DISKLESS box's drive and hit RESET.  If all goes
well you should see FreeBSD 2.x boot!

#############################################################################

#############################################################################
###################### [ sharing X11R6 config files ] #######################

The following will allow you to run X11R6 on nodes with different video cards
and a common NFS mounted /usr/X11R6 tree:


# [ create /usr/X11R6/lib/X11/xinit/<CLIENT_NAME>.<DOMAIN_NAME>: ]
--------------------------------- cut --------------------------------------
/usr/X11R6/bin/XF86_<SERVER_OF_INTEREST>
--------------------------------- end --------------------------------------

# [ patch /usr/X11R6/bin/startx: ]
--------------------------------- cut --------------------------------------
diff -r1.1 startx
19a20,21
> hostclientrc=/usr/X11R6/lib/X11/xinit/xinitrc.`hostname`
> hostserverrc=/usr/X11R6/lib/X11/xinit/xserverrc.`hostname`
31a34,35
> else if [ -f $hostclientrc ]; then
>     clientargs=$hostclientrc
35a40
> fi
41a47,48
> else if [ -f $hostserverrc ]; then
>     serverargs=$hostserverrc
43a51
> fi
--------------------------------- end --------------------------------------

# cp /usr/X11R6/lib/X11/XF86Config \
      /usr/X11R6/lib/X11/XF86Config.<CLIENT_NAME>.<DOMAIN_NAME>
# [ edit XF86Config.<CLIENT_NAME>.<DOMAIN_NAME> as appropriate ]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503200039.RAA01896>