Here is a recipe to boot OpenBSD (4.1) from an OpenBSD (4.1) box. This can be used to boot any machine that has no disks and supports pxeboot. The advantage is you save a little money on not buying hard-disks, but on the other hand, the "server" that serves everything must be always on.
This could be a good solution in a clustered environment.
Well, if you decide you would like to play, follow these instructions.
Install an OpenBSD system. This will be your boot-server. Just select generic settings that you prefer.
Here is the IP-scheme I have used:
server: 192.168.1.254
client: 192.168.1.253
netmask: 255.255.255.0 (or /24)
broadcast: 192.168.1.255
gateway: 192.168.1.1When the install is done, modify these files on the boot server to look like this.
First, configure an IP-address.
# cat /etc/hostname.pcn0
inet 192.168.1.254 255.255.255.0 192.168.1.255
# cat /etc/mygate
192.168.1.1
# cat /etc/resolv.conf
lookup file bind
nameserver 192.168.1.1Then make sure some daemons are started at boot time on the boot server.
# cat /etc/rc.conf.local
# For the PXEBOOT and the OS, DHCP is used.
dhcpd_flags=""
# After PXEBOOT, the kernel uses rarp to discover its IP-address.
rarpd_flags="-a"
# Then bootparamd to figure out options for mounting things.
bootparamd_flags=""
portmap="YES"
# And NFS to serve directories like /root, /usr and swap.
nfs_server="YES"
nfsd_flags="-tun 4"For rarp, add an entry like this to represent the client "diskless". The first column, the mac-address will need to be changed to the mac-address of the client you would like to boot. You can find out a MAC-address of your client by typing ifconfig on it, but you then need some sort of an os. Try a livecd from whatever distribution you like.
# cat /etc/ethers
00:0c:29:ad:c8:32 disklessAlso add this machine to the hosts file. I gave my client the 192.168.1.253 IP-address, change it to anything you like. This IP-address is the address the kernel will boot with.
# cat /etc/hosts
192.168.1.253 disklessTell the clients kernel where to get the root directory and swap from.
# cat /etc/bootparams
diskless root=192.168.1.254:/export/diskless/root swap=192.168.1.254:/export/diskless/swapConfigure DHCP. This is used by PXEBOOT, and by the running Operating System, but not by the kernels IP address. It is logical and wise to use the same IP address here and in /etc/ethers, /etc/hosts, but it's not required.
# cat /etc/dhcpd.conf
shared-network LOCAL-NET {
option domain-name "my.domain";
option domain-name-servers 192.168.1.1;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
filename "pxeboot";
}
}
host diskless {
hardware ethernet 00:0c:29:ad:c8:32;
fixed-address 192.168.1.253;
}Make sure tftp is started in inetd.conf. (I enables only the default, not the ipv6 version.)
# cat /etc/inetd.conf | grep tftp
tftp dgram udp wait root /usr/libexec/tftpd tftpd -s
/tftpboot
#tftp dgram udp6 wait root /usr/libexec/tftpd tftpd -s
/tftpbootThe /tftpboot directory must contain the pxeboot code and an openbsd kernel called bsd. (By the way, replacing that bsd by bsd.rd makes this an install-server!) You can get these file form any openbsd mirror in the pub/OpenBSD/4.1/i386/ directory.
# ls /tftpboot
bsd
pxebootNow export a few filesystems in /etc/exports.
# cat /etc/exports
/export/diskless -maproot=root -alldirs disklessAnd create the 128 megabytes swap space like this:
# mkdir -p /export/diskless/root
# dd if=/dev/zero bs=1m count=128 of=/export/diskless/swapNow you will have to unpack some sets (the minimal base41.tgz and etc41.tgz) into the diskless root and create a few devices. The sets can be downloaded from one of the openbsd mirrors. The devices, like /dev/console also need to be created.
Be aware about the -p option in the tar extract, it preservers permissions and that is required.
# cd /export/diskless/root
# tar -xvzpf base41.tgz
# tar -xvzpf etc41.tgz
# cd dev
# ./MAKEDEV all
# cd ../Also edit the /export/diskless/root/etc/fstab.
192.168.1.254:/export/diskless/root / nfs rw 0 0
192.168.1.254:/export/diskless/swap none swap sw,nfsmntpt=/swapAt the end of this all, reboot the server to start everything.
# rebootWhen the server is booted, boot up the client and see the magic! Here is an overview of what happens:
Now check if it boots, there is still a few things to do. Lets set a hostname in /export/diskless/root/myname and set the password.
# echo "diskless" > /export/diskless/root/etc/myname
# chroot /export/diskless/root
# passwd root
Changing local password for root.
New password:
Retype new password:
# exitNow you are done! have fun with it!
I have installed this setup in a virtual host on my intel mac, you can download a packed-up version of the images and the configuration to peek around. The root password installed on these images is "OpenBSD"
The Vmware Fusion boot-server. (229 Mb packed)
The Vmware Fusion client. (27 Kb packed)
| About | Consultancy | Articles | Contact |
|
|
|
|
|
| References | Red Hat Certified Architect | By Robert de Bock | Robert de Bock |
| Curriculum Vitae | By Fred Clausen | +31 6 14 39 58 72 | |
| By Nelson Manning | robert@meinit.nl |
Comments
Hello thank you for this
Hello thank you for this recipe, I have to do something but with windows 2003 server and openbsd as diskless clients, I have to configure the w2003 as dchp an as tfp to provide the openbsd kernel to the clients, It is possible that a diskless client acts as a web server? I mean it fetch an load the kernel and starts a web server? it is possible? I would like to configure two openbsd diskless web servers, it is possible?
I appreciate so much any information you can provide me,
Best Regards,
Omar.
Hi, That should be possible.
Hi,
That should be possible. On the server that serves the disks to the diskless clients, simply go to /export/diskless/root and change all configuration to make the webserver start. (see http://www.openbsd.org/cgi-bin/man.cgi?query=rc.conf.local&sektion=8 )
Regards, Robert de Bock.
As you said that Tte
As you said that Tte /tftpboot directory must contain the pxeboot code and an openbsd kernel called bsd....i think that it is the key point to creat a Tte /tftpboot.
alex
Casinos Online
Hi there, and thank you for
Hi there, and thank you for writing this recipe. My situation, however, is complicated by the fact that (1) I am running 4.2-stable, and want to use the same source tree for the "client" machine as well, and (2) the "server" is running on a PowerPC machine, and the client is a small-form-factor i386 desktop. How do I recompile the 4.2-stable source on the PowerPC server for the i386 platform and repackage it for the i386 client machine?
Hi, you may want to follow
Hi,
you may want to follow the thread about different architectures on http://undeadly.org/cgi?action=article&sid=20071025171849.
It basically explains what to do.
Stefan