How I did it: diskless netboot with Debian Etch

How-To to make a diskless Debian Etch workstation

This how-to is based on the following Ubuntu how-to:

https://help.ubuntu.com/community/DisklessUbuntuHowto

When I tried using the above how-to with Debian Etch, there were a number of things which didn’t work, and there were a number of things which weren’t explained. In any case, this is how I figured out how to do it.

This how-to assumes the client and server are already set up with Debian Etch, with the client set up on a single root partition. In this example, 192.168.1.4 is the server, while 192.168.1.1 is the router. You’ll want to change these numbers for your own server and router.

——————————————–

0. Install server packages

Install the following packages on the server:

Code:

apt-get install dhcp3-server

apt-get install tftp-hpa

apt-get install syslinux

apt-get install nfs-kernel-server

apt-get install initramfs-tools

apt-get install pxe

apt-get install atftpd

I’m not sure if pxe and atftpd need to be installed; they weren’t in the Ubuntu How-To this is based on. I installed them in the process of trying to get stuff to work.

——————————————–

1. Set up tftp boot

Create the /tftpboot and start populating it with something like:

Code:

mkdir -p /tftpboot/pxelinux.cfg

cp /usr/lib/syslinux/pxelinux.0 /tftpboot/

cp /boot/vmlinuz-2.6.15-1-486 /tftpboot/

Replace vmlinuz-2.6.16-1-486 with the kernel you’re using.

Configure the tftp service to provide access to /tftpboot by editing /etc/inetd.conf. Make sure the line starting with « tftp » ends with « /tftpboot ». It should look something like:

Code:

tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tft pd /tftpboot

Restart the tftp service with:

Code:

/etc/init.d/inetd restart

Create a net-bootable initrd image with:

Code:

cd /etc/initramfs-tools/

cp initramfs.conf initramfs.conf.originalbackup

vi initramfs.conf

mkinitramfs -o initrd.img.netboot

mv initrd.img.netboot /tftpboot/

When editing initramfs.conf, you want to change the BOOT line from « BOOT=local » to « BOOT=nfs ». After creating this image, you may change the BOOT line back to local.

Create a PXE config file /tftpboot/pxelinux.cfg/default. If you know the workstation’s MAC address, name the file 01-aa-bb-cc-dd-ee-ff where aabbccddeeff is the MAC address. (You’ll need to name the files like this or by IP address in hex if you’re setting up more than one diskless workstation.) Here’s an example:

Code:

LABEL linux

KERNEL vmlinuz-2.6.15-1-486

APPEND root=/dev/nfs initrd=initrd.img.netboot nfsroot=192.168.1.4:/mnt/hda5/yuki ip=dhcp rw

You’ll want to put your server’s IP address in and your desired location of the workstation’s OS.

——————————————–

2. Set up DHCP

First, deactivate any DHCP service on your router or other server. Then configure DHCP service on your server with:

Code:

vi /etc/dhcp3/dhcpd.conf

/etc/init.d/dhcp3-server restart

Make sure to include this line at the top:

Code:

next-server 192.168.1.4;

Without this line, the client will hang on trying to load the pxe config file.

You’ll need to insert lines to the file to configure assigned addresses. This entry will set up dynamic addresses:

Code:

default-lease-time 600;

max-lease-time 7200;

option domain-name « xephon »;

option domain-name-servers 192.168.1.1, 192.0.0.1, 194.2.0.50;

option routers 192.168.1.1;

subnet 192.168.1.0 netmask 255.255.255.0 {

range 192.168.1.50 192.168.1.99;

filename « /tftpboot/pxelinux.0 »;

}

This entry will set up a static address. You’ll need to know the MAC address–for example, by booting up a liveCD and running « ifconfig -a » as root.

Code:

host yuki {

hardware ethernet 00:14:2a:ef:ea:07;

fixed-address yuki.xephon;

filename « /tftpboot/pxelinux.0 »;

}

Note that this assumes the address of yuki.xephon is defined in /etc/hosts. You can replace it with a numerical IP address.

——————————————–

3. Set up nfs

Create the nfs share on the server with:

Code:

mkdir /mnt/hda5/yuki

vi /etc/exports

exportfs -rv

When editing /etc/exports, you want to create this entry:

Code:

/mnt/hda5/yuki yuki.xephon(rw,async,no_root_squash)

Note that this assumes the address of yuki.xephon is defined in /etc/hosts. You can replace this with a numerical IP address. You can also replace it with « * » if you don’t mind any machine on the LAN to have access.

Copy over the files by running the following ON THE CLIENT:

Code:

mkdir /mnt/yuki

mount -tnfs -onolock 192.168.1.4:/mnt/hda5/yuki /mnt/yuki

cp -axv /. /mnt/yuki/.

cp -axv /dev/. /mnt/yuki/dev/.

Now, back on the server, modify the files to make them suitable for diskless netbooting. Edit /mnt/hda5/yuki/etc/network/interfaces and comment out any lines which automatically bring up eth0 (like « auto eth0 » or « allow-hotplug eth0 »). Just leave a line like « iface eth0 inet dhcp ». The network interface eth0 will have already been brought up by net-booting, and we don’t want to reset it.

Edit /mnt/hda5/yuki/etc/fstab to look something like this:

Code:

###/dev/hda1 / ext3 noatime,errors=remount-ro 0 1

###/dev/hda5 /mnt/hda5 ext3 noatime 0 2

###/dev/hda6 none swap sw 0 0

/dev/nfs / nfs defaults 0 0

none /tmp tmpfs defaults 0 0

none /var/run tmpfs defaults 0 0

none /var/lock tmpfs defaults 0 0

none /var/tmp tmpfs defaults 0 0

none /media tmpfs defaults 0 0

Comment out any local partitions including swap.

——————————————–

4. Configure BIOS

On the client workstation, boot up and enter setup to turn on PXE LAN boot. If you don’t have this option, then you may have to set up a boot floppy or something (look elsewhere for help figuring this out). Then reboot, and see if everything works!

——————————————–

Setting up more workstations

If you want to set up more than one workstation, you’ll need to know the MAC addresses of them all. You can find it out by logging on as root and running « ifconfig -a » (on Debian systems). Then:

1. Create a new PXE config file /tftpboot/pxelinux.cfg/01-aa-bb-cc-dd-ee-ff where aabbccddeeff is the MAC address (use lowercase).

2. Create a new entry in /etc/dhcp3/dhcpd.conf for the new MAC address. Don’t forget to restart the DHCP server with « /etc/init.d/dhcp3-server restart »

3. Create the new nfs shared directory and populate it. Create a new entry in /etc/exports as appropriate. Don’t forget to resync the exports with « exportfs -rv »

4. Configure the BIOS on the client for LAN boot.

For creating the new workstation’s directory, you can copy from an existing one and just edit /mnt/hda5/newworkstation/etc/hostname to change the hostname.

viaHow I did it: diskless netboot with Debian Etch.

Retour en haut