FreeBSD on Xen

I’ve been itching to toy with spamd for ages, so I’d really hoped to get it running on my new machine. spamd relies on OpenBSD’s pf firewall, so it really won’t run on anything that’s not BSD, which means that I either need a dedicated BSD machine (not practical), or I need to get a BSD flavor up and running as a Xen virtual guest.

The new server came today — in an enormous box that I could barely lift. UPS left the box in the drizzling outdoors, but thought to cover 1/3 of the cardboard with a plastic bag. (Frankly, after several futile attempts to lift the thing, I’m just glad the UPS deliveryman didn’t smash it when trying to handle it. The cardboard was just a little damp, but the machine was well-packaged and dry as a bone.)

It’s an older dual-Xeon setup, before processors supported hardware virtualization, which limits me to operating systems that support paravirtualization. That’s a pretty limited list (most Xen development is on Linux), but fortunately, FreeBSD is one of them. Until recently, it wasn’t easy.

I’m using CentOS 5.3 for the Dom0 (host), but worried that FreeBSD in DomU was going to be really hard, especially since I’m a Linux guy, not a BSD guy. I found the AdrianChadd Xen Images page, and am now sitting inside the console on a very minimalistic FreeBSD setup. Essentially you pull down his image and tweak the Xen config; I pulled out the swap file since I didn’t feel like creating one (this is for testing, not production!), and pointed his reference to a real disk to just use the file:/ reference. It defaults to bridged networking. Then I fired off an xm create pointing to the config file he uses (with my slight modifications), and pygrub had me select the FreeBSD OS. In astonishingly little time (1 second tops?), I was inside FreeBSD. It probably helps that it’s a minimal install and that the whole disk image fits inside RAM right now.

I’m not claiming victory quite yet. I was able to bring up the “xn0” network interface and see the LAN, but then ran into trouble upon finding that there’s no such thing as /etc/resolv.conf. This is where my incredible lack of knowledge about BSD becomes apparent. There’s also the issue that it’s an older FreeBSD release and that it’s in a 512MB disk image, but the latter should be easy to remedy. I’m not sure if the upgrade will be easy; I’ve seen people mention that they had trouble with FreeBSD 7. But for a minimalistic mailserver, maybe it’s good enough.

The freebsd-xen mailing list suggests that it’s hardly a finished product, but that active development is taking place. So we’ll see how I fare getting a mailserver setup.

Leave a Reply

Your email address will not be published. Required fields are marked *