Installing FreeBSD on a Soekris net5501 using PXE and dnsmasq


I’m the proud owner of a new Soekris net5501. This is a low power SBC (Single Board Computer) that I intend to use as a:

  • router,
  • firewall,
  • name server,
  • wireless access point,
  • VPN end-point,
  • PBX,
  • SMTP server,
  • IMAP server,
  • NTP server,
  • file server (both NFS and SMB),
  • UPS monitor,
  • print server,
  • database server, and
  • source control server

for my home network. My preferred operating system is FreeBSD and I’m installing the most recent stable release – 7.2.

Installation on a Soekris box is a bit different to installing on a normal PC since it has no video card (it’s headless), and mine doesn’t have a CDROM or DVD drive. There are several ways of doing the installation. One is via a Compact Flash card, another is putting a disk drive into another PC, installing the OS, and then moving the disk to the Soekris box. The way I’m going to do it is by network booting using PXE. There are number of guides to doing this around if you search for “PXE install FreeBSD”. I’m doing it a bit differently since I’m going to use dnsmasq for the BOOTP and TFTP server. The reason I’m doing it this way is that I already have a FreeBSD server running dnsmasq and it’s capable of doing the job without having to install ISC DHCP3 server or a dedicated TFTP server.

Basically, I follow the instructions from this guide with the following differences.

  • I didn’t bother building pxeboot in Step 5. Instead, I changed baud rate in my terminal emulator (picocom) to 9600 at the point where pxeboot is running. You get a few garbage characters but it doesn’t really matter.
  • Since I’m using dnsmasq from the BOOTP and TFTP server, I replaced Steps 1, 2, & 3 with adding:
    enable-tftp
    tftp-root=/mnt/pxeroot
    dhcp-boot=pxeboot
    dhcp-option=17,203.2.73.2:/mnt/pxeroot

    to the bottom of dnsmasq.conf. Note that you should replace “/mnt/pxeroot” with the name of the directory where you’ve installed pxeboot and the FreeBSD install image (“/usr/local/freebsd7″ in the guide above).
  • I used 19200 baud instead of 115200. That’s the default baud rate of the Soekris boot loader. For the amount of time spent on the console, it’s not really worth worrying about the higher speed.
  • Finally, I had something go wrong when it was booting the FreeBSD kernel. It may have been the same problem noted in Step 7 of the guide, I don’t know. Anyway, my solution was to replace the standard FreeBSD kernel with a custom one. I’m building a custom one for the Soekris box anyway, so I just used that. Its config file can be found here. I had to disable the IPFIREWALL options for the installation because it defaults to “deny all” which prevented me using NFS to do the installation!

Anyway, it’s all working beautifully now. I hope this helps somebody else who’s trying to do that same thing. It will also help me remember how to do it for next time!

Update: October 19, 2010 for FreeBSD 8.1: My kernel config file for FreeBSD 8.1 is here.

, , , , ,

  1. #1 by CyberCyril on May 4, 2010 - 1:32 AM

    Thanks for sharing.
    The FreeBSD Kernel config file link is dead : too bad.

    Now fixed: thanks Cyril. – Graham

  2. #2 by Jed Clear on October 19, 2010 - 10:37 AM

    Instead of leaving IPFIREWALL out of your kernel initially, you have a couple of options. You can set firewall_type=”open” in /etc/rc.conf. Or you could compile “option IPFIREWALL_DEFAULT_TO_ACCEPT” into the kernel the first time around, then install a new kernel after you build your rules.

    There is also a sysctl to turn it off ipfw, which is used by “/etc/rc.d/ipfw restart” (at least with 8.1R there is, not sure when it was introduced).

    You’re right, there are a number of ways of doing it. Thanks, Jed – Graham

(will not be published)