Raspberry Pi as PXE, TFTP, DHCP and NFS server
Rapsberry Pi
The Raspberry Pi is a very cheap small board with a 700 MHz Arm11 SoC. The B-model has a network interface and can thus be used as a small Linux server.
Currently my Raspberry Pi runs as the PXE and DHCP server in my our network. Several diskless systems boot from it, I use it to do PXE installs of Debian on both physical machines as KVM virtual machines. All the systems in our home get their IP addresses from the DHCP server that runs on the Raspberry Pi.
The Raspberry Pi with a SD card boots fast, is completely quiet and consumes no more than 5 Watts.
Raspbian distribution
My Rapsberry Pi uses the Raspbian distribution. I used debootstrap to get a root filesystem on a NFS share. First I set up the system using a NFS root file system and when everything was working OK migrated the root filesystem to the SD card.
See Boot Raspberry Pi with rootfs on NFS.
Rapsberry Pi as PXE server
The Raspberry Pi is not the most powerful computer in the world, but is very capable to serve as the central PXE server in the home network.
I boot several diskless machines from the Raspberry Pi and use the Raspberry Pi also as the server for network installations of Debian via PXE. See for example the diskless Debian Squeeze KVM guests page.
I installed gpxelinux on the Raspberry Pi.
Raspberry Pi as TFTP server
In order to do PXE installs, the Raspberry Pi needs to be able to function as a TFTP server. As the Raspberry Pi runs Debian, I installed tftpd-hpa on it.
Don't forget that in Debian the configuration file of tftpd-hpa is in the /etc/default/ directory.
Raspberry Pi as DHCP server
In our home network the Raspberry Pi is also the central DHCP-server. All the systems get their IP address from the Raspberry.
I use the isc-dhcpd DHCP server, which can easily be installed with apt-get install.
Rapsberry Pi as NFS server
The SD card in my Raspberry Pi contains the root filesystems for several systems. The Raspberry provide these filesystems over NFS.
Because of the configuration of the stock kernel from the Raspbian distribution the default Debian nfs-kernel-server will not work. So one has to either use a custom kernel or use a NFS daemon that doesn't require a custom kernel.
I opted for the easy way and choose to install UNFS. This is a user-space NFS-server. In theory the kernel NFS-server should be faster, but so far I didn't have any performance problems so far.
SD card
I placed a 8 Gb SD card in the Raspberry.
This is the partion scheme of the card:
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 10 115829 57910 c W95 FAT32 (LBA)
/dev/mmcblk0p2 115830 1140479 512325 83 Linux
/dev/mmcblk0p3 1140480 15523649 7191585 83 Linux
The first partition is a very small FAT partition from which the board boots. I copied the contents of the VAT-partiion of a 'normal' Raspberry Pi boot image into it.
The second partion is about 485 MB, from which about 348 MB is in use for the root filesystem of the Raspberry it self, the Raspbian distribution.
The third partion is an ext4 partition (without journal) that contains the NFS shares.
Careful with the SD card
SD cards are flash memory systems and will wear out if there are many write-operations done on them. When you build your own system on a SD card, be careful to block write operations. Make sure that logging is either turned of completely or is done in memory (in tmpfs).
Debian systems require some tinkering before the can run from a readony filesystem.
When a FreeBSD system boots diskless it will automatically mount its root filesystem readonly. which is great. Use the /conf directory for small writable parts. The contents of the /conf directory will be mounted in memory (mfs) after booting.
Green computing
The result of this, is that only the Raspberry Pi has to be powered up in order to let those diskless systems boot. The diskless systems get their IP addresses from the Raspberry, get their kernel and initramfs over tftp from the Raspberry and mount their root filesystem over NFS from the Raspberry Pi.
As the Raspberry Pi only requires 5 Watts this is a very low power solution.
Made with ♥ by a human - Proud member of the 250kb.club.
Most recent pages
All tags
Sitemap
RSS
RSS of Gophersite