Trading Fish The website of Hector Castro

Preseeding Ubuntu Server and Static IP Addresses

Setting up a cluster of computers for any purpose usually requires installing an operating system. The installation process typically consists of several questions and identical answers for each node in the cluster. Automating the submission of answers to these questions is desirable — not only to prevent inconsistencies, but for general convenience.


I spent the last few days working to stand up a proof-of-concept Riak cluster. The first step involved installing Ubuntu Oneiric Ocelot (11.10) on four virtual machines. Luckily, Ubuntu/Debian has a process called preseeding to facilitate automated installations. Surprisingly, it also has limited support for Red Hat’s Kickstart. Playing it safe, I went with preseeding.

There are three methods that can be used for preseeding: initrd, file, and network. I wasn’t interested in re-authoring ISOs or setting up a TFTP server, so I went with a web-accessible preseed file. The pros of this approach are that the configuration file is easily modifiable, yet still accessible. The cons are that it doesn’t become available to the installer until the network is configured.

Assigning a Static IP Problem

Because web-accessible preseed files aren’t available until the network is configured, the step to assign a static IP address gets missed. Below are several approaches I found to assign a static IP address with preseeding.

Boot Parameters

The boot prompt is where you tell the installer how to locate your preseed file. It is also where you can pass a fixed number of preseed directives. In our example of assigning a static IP address, you’d pass things like IP address, hostname, domain, and netmask. Ultimately, I wasn’t too interested in this approach because it required a lot of typing without clipboard access.

Ubuntu Boot Prompt

Re-evaluating Network Configuration

The Ubuntu Help wiki has a suggested hack to trigger re-evaluation of preseeded network configuration settings by executing commands via preseed/run. Unfortunately, I was unable to get this to work successfully. In every combination I tried, it resulted in the installer failing. This related Ubuntu Forums post outlines the suggested steps pretty well.

Overwriting Network Configuration

Eventually this is the solution I used to assign a static IP address. It’s a hack, but in my eyes it was the lesser of three evils. Alongside each node’s preseed configuration file, I created a corresponding shell script. The shell script gets executed before the installer triggers a reboot and overwrites /etc/network/interfaces with a static IP configuration:

echo "auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
" > /etc/network/interfaces

If anyone has a better approach to setting a static IP address via preseeding or Kickstart, let me know!