Jan 1, 2018 - Website Theme Updated

New year, new look!

I've tweaked the theme for the site a bit and much prefer it to the original jekyll-clean theme on which it is based. Hopefully it's an improvement, drop me a message if you disagree...

There's still a few bits I'm unhappy with. In particular the dark-on-light code blocks probably want replacing with a proper Solarized Dark theming but I've not had time to do that yet. Once it's polished up and I'm happy with it I'll publish the theme for anyone else who's interested to take a look at and re-use.

Mar 13, 2017 - Togán Labs

This website has been pretty neglected for a while now. Life gets pretty busy and there's often not time to write blog posts. Plus, most of the interesting stuff I've done hasn't been public/open source work and so there's not really been much to say about it.

That's likely to be changing now though. I've just started a new job as Co-Founder and Principal Engineer at Togán Labs. We're a tiny startup company made up of open source professionals with a focus on Embedded Linux and in particular OpenEmbedded/Yocto Project. There will be many more details on our website so I won't go on about it too much here.

The real upside for me is that the open source projects I've been working on as a hobbyist are now a part of my main job :) So hopefully that will lead to more involvement in the Yocto Project and other related projects. We've already put out a Linux BSP for the Arduino Yún and should be expanding this to include support for the Arduino Tian in the coming months. I've also got plans for further work on the Raspberry Pi BSP layer and I'm exploring the feasibility of maintaining a 4.4.y series kernel for Raspberry Pi platforms now that the official repository has moved on to the 4.9.y series.

So, with some luck, there will be a few more posts on this blog over the next few months than there have been in the last few months!

Dec 20, 2015 - My st patches

I've been using st, the simple terminal emulator from suckless.org for a long time now. I'm using the Solarized patches provided on the st web page to get the Solarized Dark colorscheme that I like to use. I've also got a couple of extra config tweaks to make st look good to me:

  • Use "FreeMono" from GNU FreeFont
  • Give 20% more space between lines of text to improve legibility
  • Use the advanced list of word delimiters

Patches against st-0.6 to setup this configuration are now available here.

Mar 1, 2015 - Xen and pfSense

The Plan

I've rented a server from Hetzner which will be used as an off-site virtual network containing the following virtualised systems:

  • A Windows Server 2012 R2 instance as a Domain Controller.
  • An Ubuntu Server 14.04 instance for public facing services.
  • An Ubuntu Server 14.04 instance for private services.
  • A pfSense 2.2 instance to protect everything.

With this server was allocated a single IPv4 address and a full /64 IPv6 subnet. I don't want to pay for additional IP addresses so I decided that the pfSense instance would use the public IPv4 address.

On the virtualisation host, two networks would be set up:

  • A 'front' network, bridged with the physical adaptor and directly accessible to the internet.
    • The virtualisation host would have an IPv6 address on this network.
    • The pfSense instance would be connected to this network and would have the public IPv4 address and an IPv6 address.
  • A 'back' network, not bridged to any physical adaptor. Access from this network to and from the wider internet would be via the pfSense router only. This network would use a private IPv4 subnet (eg.
    • The virtualisation host would have an IPv4 and an IPv6 address on this network.
    • All VMs would also have an IPv4 and an IPv6 address on this network.

Choosing Xen for virtualisation

I considered VMWare ESXi, Citrix XenServer and direct use of Xen as options for the virtualisation host. I ruled out ESXi as the Realtek ethernet controller on the server rented from Hetzner is not supported on recent versions of ESXi which would complicate installation and upgrades on this server.

I tried installing XenServer using QEMU but the host failed to boot after the installation had completed. The installation process was adapted from instructions for installing Windows using QEMU on a Hetzner server (available here). I considered trying to debug the boot issue but decided to first explore direct use of Xen.

The installation of Xen was remarkably simple: I installed Ubuntu Server 14.04 using Hetzner's Robot interface and logged into the newly installed system via ssh. From here, it was simply a case of running the following commands as root:

apt-get update && apt-get upgrade
apt-get install xen-hypervisor-amd64

Grub is configured to boot Xen by default when it is installed and so a reboot dropped me into the same Ubuntu Server instance now running as dom0 under the Xen hypervisor. To confirm that Xen worked, the list of running domains was shown by running:

xl list

However, the dom0 instance was using all 16GB of available RAM. Xen does seem to support dynamically reducing this as VMs are created (which I didn't try) but research suggested it was much better to allocate a minimal amount of memory to dom0 and leave the rest unallocated for use by VMs. This was accomplished by changing the Grub configuration to pass additional options to Xen. The file /etc/default/grub was edited and the following line was added to allocate 1GB of RAM to dom0:


Another reboot was performed after this command and the system was ready to go!

Network configuration

I'm going to gloss over the network configuration as I don't have clear notes on how it was achieved and it involved a bit of trial and error. In the end I had the following entry for the 'front' bridge in /etc/network/interfaces:

auto br0
iface br0 inet6 static
  bridge_ports eth0
  address <ipv6 address>
  netmask 80
  gateway <ipv6 gateway>

With a netmask of 80 the server could be reached over the internet but it was also possible to create a different subnet within the /64 I had been allocated for use on the 'back' network.

The 'back' bridge was configured using libvirt and after configuration the file /var/lib/libvirt/network/default.xml contained:

  <bridge name="vnet0" />
  <ip address="<private ipv4 address>" netmask="" />
  <ip family="ipv6" address="<ipv6 address>" prefix="80" />

Bits 64-79 of the IPv6 address for vnet0 were different to those for br0 so that the two networks were on different subnets.

pfSense Installation

I used LVM to manage disk space on the virtualisation host. The disk for each VM would be an LV on the host system allowing the use of LVM features like snapshots. A further post will probably explain my backup strategy which makes use of LVM snapshots and zbackup.

The directory /home/store was created for storing ISO images and the pfSense installation CD was downloaded to this location. A 4GB LV was created in the volume group vg0 and was named 'pf'. The following virt-builder command was used to begin installation of pfSense in a new VM with two vCPUs and 512MB of RAM:

virt-install \
    --name pf \
    --ram 512 \
    --vcpus=2 \
    --os-variant freebsd8 \
    --hvm \
    --network=bridge:br0 \
    --network=bridge:vnet0 \
    --vnc \
    --cdrom /home/store/pfSense-LiveCD-2.2-RELEASE-amd64.iso \
    --disk /dev/vg0/pf \
    --virt-type xen

As X11 and a vnc viewer were not installed on the virtualisation host, some other way of connecting to the running VNC server was needed. On my desktop I ran:

vncviewer -via <ipv6 address of br0 on virtualisation host> localhost:0

This gave my a VNC connection which I could use to carry out the pfSense installation from the install CD.

Networking issues

Once pfSense was installed and initial configuration had been performed, I created a second VM and installed Windows Server 2012 R2 for use as my domain controller. This VM connected to the network correctly and could ping remote hosts on the internet with traffic passing through the pfSense router however it was not possible to run Windows Update. When checking for updates, the error condition 80027EFE kept appearing, indicating an inability to connect.

After a few hours of debugging and googling I hadn't really found anything useful. I had been assuming that the error was related to the use of Windows Server 2012 R2 on Xen. When I branched out and started looking into networking issues with pfSense 2.2 on Xen things started to fall into place. A few forum and blog posts reported networking issues and suggested fixes, such as https://forum.pfsense.org/index.php?topic=85797.0. It seems that there is a bug somewhere which is causing the TX checksum to be calculated incorrectly on pfsense 2.2/FreeBSD 10.1 when the checksum calculation is offloaded to the networking hardware and the 'xn' paravirtualised network driver is in use. The simplest comprehensive solution to this problem was to disable hardware checksum offloading everywhere that could affect this pfSense instance, both on the pfSense instance itself and on the virtualisation host.

Within pfSense, disabling hardware checksum offloading was simple. Navigating to 'System->Advanced' and looking at the 'Networking' tab, there is a checkbox which can be ticked to disable hardware checksum offloading. Ticking this checkbox was not sufficient to fix the networking issues I was seeing.

On the virtualisation host, ethtool was used to change the configuration for each networking interface, both physical and virtual. For each of 'eth0' (the physical adaptor), 'br0', 'vnet0-nic', 'vnet0', 'vif1.0', 'vif1.0-emu', 'vif1.1' and 'vif1.1-emu', the following command was executed:

ethtool --offload <if name> tx off

The 'vifx.y' interface names will need to be changed to match those assigned to the pfSense instance if this is performed on a different virtualisation host. Also, it may be overkill to do this for all the interfaces and network bridges I listed and you may get away with changing this setting for a more limited list of interfaces. However, after running these commands my networking issues were solved: I could successfully run Windows Update on my Domain Controller.


Using a pfSense instance on top of the Xen hypervisor seems to work pretty well once the networking issues were resolved. There was definitely a lot I had to learn as I hadn't used Xen much before but this setup was achievable within a week with a couple of hours each day spent researching, configuring and debugging this setup. I now have an offsite virtual network running within which I can deploy both public-facing and private services.


I've not really addressed security issues in this post so if you decide to follow a similar setup then ensure that you've secured the virtualisation host and the pfSense instance as these are openly facing the internet.

Feb 16, 2015 - Website Refresh

It's time for a fresh start.

My previous website was built with poole which was an excellent static site generator for simple use. However I now want to just pick up a working theme and have support out of the box for some useful plugins. Therefore I'm now giving jekyll a try with the jekyll-clean theme and will see how this goes...

I seem to be continually overhauling my home network setup but I've been doing it in a bit of an unfocussed way for a while. I'm going to try to focus this a little more by defining some actual goals and trying to move towards them step-by-step rather than just trashing everything when I get bored or excited by some new shiny. I'm also going to try to blog about various bits of hardware and software, stories of what worked and what didn't work and generally being opinionated about tech.

If I follow through on most of the tech plans I have I'll end up with a very overengineered home network. Hopefully this will give me an opportunity to try out some cool technologies and learn a few things which will be useful at work. If I manage to write a few useful blog posts along the way then I'll consider that a bonus!