iPXE with Serial Console

My SmartOS based home server is already configured to use the serial console, in case I need to physically plug into it, but there was a missing piece. iPXE, the boot loader I use to boot the smartos image, can use the serial console, but this is not the default. I couldn’t find an existing binary that was configured with serial, so I built it myself.

Its pretty easy to git clone their repo, un-comment a line, and build the binary, but I wanted an automatic way to do so. I’ve seen Travis-CI around and one of its features is being able to build artifacts and post them to your repo as a release. I created a git repo, ipxe_serial, for this project.

Once you have your GitHub account linked with Travis, you’ll enable it for a repo, though you’ll probably want to change the settings to only build if the config file exists, .travis.yml. Travis has a cli client that you’ll need as it makes setting up the GitHub Releases integration easy. Install the client and authorize it to use your GitHub account, then from within your repo directory, use travis setup releases and follow the prompts. It writes to your travis config file and creates a GitHub token for your repo and encrypts the token before putting it in the config file.

Afterwards, I think its a good idea to have the following added:

deploy:
  skip_cleanup: true
  ...
  on:
    tags: true

From reading the docs, this looks like a good thing to have. With that, I can then tag a commit and Travis will run my build script and create a release on my repo.

Advertisements

Linksys E4200 and DD-WRT

To furthur support my home server project, I needed my network environment to support pxe booting. I first tried running dnsmasq on my raspberry pi, but it didn’t seem to respond to any DHCP requests, only my Linksys router would. I’ve always been curious about running DD-WRT, and now had a real reason to do so.

Following the steps in the wiki entry for my E4200 were pretty simple and I had it up and working quickly. The next step was getting it to serveĀ up the boot image via tftp, but as it turns out, the version of dnsmasq shipped in DD-WRT has tftp disabled. Also its config syntax doesn’t follow the usual form found in the man page, maybe due to the version. I didn’t really dig too deep as I found installing OptWare brings more software options, like a tftp server, avahi, and zabbix.

TFTP Server

I wont go over how to install OptWare as thats documented well elsewhere, but I will mention that I followed the newer version, OptWare the Right Way 2. With that installed, I first experimented with installing atftp, but quickly found out that it wouldn’t work for my needs as it has a pretty small file size limit of files it serves up. I then switched to tftp-hpa and configured it to serve up from a directory off of the small usb thumb drive I plugged into the router.

The router mounted the partition named opt to the correct location, but mounts the data directory to a generic location based off of partition number in /tmp/mnt. Disappointing but not horrible as that wouldn’t be changing. I now had a tftp server(fyi it used xinetd), I needed to configure dnsmasq to provide the right information. Following information from another guide, I decided to use iPXE as my bootloader of choice. It supports a menu system and if I get around to recompiling, will support output to a serial console.

I used these options to tell dnsmasq to:

  • Serve up the iPXE bootloader to plain PXE boot requests
  • Serve up the boot menu to iPXE bootloaders
dhcp-match=ipxe,175
dhcp-boot=net:#ipxe,undionly.kpxe,,192.168.1.1
dhcp-boot=menu.ipxe,,192.168.1.1

Note the use of net and # instead of the usual tag and ! directives

I now had a functioning PXE boot environment on my main network, yay! Later on I’ll post how I got vlans working and the zabbix agent that comes with OptWare(fyi the zabbix agent built into my version of DD-WRT wasn’t great as I didn’t know how I could configure it).