Fun with PXE

No Comments

I just recently had surgery, and while I've been convalescing, I've had a little time to pursue some pet projects (that don't require much physical effort.) One of these was to find a way to share my scanner over the network so that my wife and I could both scan onto our personal laptops. I have a spare laptop that has no hard drive, and I really wanted to do this on Linux because this kind of set up is pretty easy to do with SANE, but unfortunately, my scanner is a firewire UMAX Astra 6400 which is not yet supported by SANE.

I didn't discover that my scanner was not compatible until after I'd set up the PXE environment. I knew I should check, but I didn't because I still wanted the excuse to work on it. I'm sure it'll be useful in some other way, Besides, it's cool!

There was a lot of conflicting information on the net about how to do this, but in the end, it turned out to be pretty simple. The setup requires three things: boot information to be provided by the DHCP server, boot files to be served by a TFTP server, and a Linux root shared via NFS.

I'm using Arch Linux these days, so to create my Linux installation I followed the Diskless network boot NFS root instructions. The actual building of a Linux installation was surprisingly easy:

pacman -Sy --root /tftpboot/archlinux/ --dbpath /tftpboot/archlinux/var/lib/pacman base

Then all I had to do was adjust /tftpboot/archlinux/etc/mkinitcpio.conf to enable nfs and network in the kernel for network booting and build it. I copied the resulting installation over to my network attached storage (a Kurobox)

I shared the tftpboot/archlinux directory via nfs on the Kurobox, and also set up the boot files to be served by tftpd using information found in this article: Setting up a server for PXE network booting.

For DHCP, I'm using a Linksys WRT54G running OpenWRT Kamikaze, which by default uses dnsmasq for dhcpd. All I had to do was add the following to /etc/dnsmasq.conf and restart the service:

dhcp-boot=pxelinux.0,kurobox,192.168.1.100

Finally, I booted up the old laptop and started it booting over the network. And it just worked! It downloaded the kernel, booted up and mounted the root off the kurobox and dropped into a login prompt. Perfect! Now I just have to figure out if I can do something useful with this. :)

Be the first to write a comment!