Home Rackspace Private Cloud / OpenStack Lab: Part 2

In the first part of this series I introduced the kit that makes up my home lab.  There’s nothing unusual or special in the kit list, but it certainly is affordable and makes entry into an OpenStack world very accessible.

This post explains some more basics of my networking: DHCP, DNS, Proxy and TFTP.

Rather than to settle for the DHCP and DNS services provided by my broadband provider’s ADSL router, given that I want to be able to do more than simply turn on a laptop or tablet and surf the ‘net, configuring a separate DHCP and DNS service up is important and offers most flexibility on your network. This becomes important later on when setting up Rackspace Private Cloud using Chef: it’s requirement to have consistent FQDN for it’s nodes is one you don’t want to leave to chance and expect things to work as expected.

DHCP and DNS: Dnsmasq

To provide DHCP and DNS on my network, I utilise Dnsmasq on my QNAP TS-210 NAS (nas.home.mydomain.co.uk /  Installation on my QNAP is as simple as enabling the Optware plugin which allows me to simply install Dnsmasq using the following

ipkg update
ipkg install dnsmasq

Configuration of Dnsmasq is then done in /opt/etc/dnsmasq.conf (/opt is where the QNAP places optional packages)

The uncommented sections of the file (i.e non-defaults):

# Use an alternative resolv.conf
# I use this to point a real external DNS service (i.e. don't point to itself!)

# Ensure the areas that Dnsmasq wants to read/write to/from is set correctly

# for queries of hosts with short names, add on the domain name

# my domain name to ensure FQDN queries all work as expected

# DHCP Setup
# First the dynamic range for those that join my network

# Some static entries (i.e. the servers openstack1-5)

# A laptop that has a LAN and Wifi adapter - give it the same IP regardless

# Some options for setting the gateway (which is my ADSL router IP)
# Some clients don't understand some DHCP options, so present both ways

# Ensure this is writeable by Dnsmasq

# When we're PXE Booting, where's the TFTP service (and filename to boot when found)
# And finally, this is the authoritative DHCP server on network

The above basically tweaks a default Dnsmasq set up to work on my network.  I have a small DHCP range for any device I don’t care too much about (tablets, laptops, phones, Blu-Ray, TV, etc). I then have a static block that match my servers — when they boot up they will always get that IP.  And I have a line that allows me to control the same IP on a laptop whether I connect via the LAN or WiFi.  This allows me to do some basic IPtable filtering on hosts based on IP – trusting that IP for example if need be.

For DNS, Dnsmasq relies on /etc/hosts – and reads this on startup.  My hosts file on my Qnap is as follows: localhost localhost NAS NAS NAS2 NAS2 openstack1.home.mydomain.co.uk openstack1 openstack2.home.mydomain.co.uk openstack2 openstack3.home.mydomain.co.uk openstack3 openstack4.home.mydomain.co.uk openstack4 openstack5.home.mydomain.co.uk openstack5

For the vast majority of any device on my network, I don’t care enough to provide any entries.  For the devices that I rely on for services and OpenStack, I put in here.  The result is a very basic Dnsmasq setup that provides an important, fundamental job on my network.

You will also note a line pointing to my second NAS device denoted by the dhcp-boot line.  This instructs any machine when they’re PXE Booting to go look at that IP for the boot image.

TFTP from Dnsmsaq + Kickstart

Now we have the basic services running on the network, we can take advantage of another feature of Dnsmasq: TFTP services.  This allows me to PXE/Network boot my servers with Ubuntu 12.04 and by running some post commands once Ubuntu has been laid down sets up my environment ready for a Rackspace Private Cloud installation.

Due to proximity of my network services and my servers, and a WiFi link being involved I opted to run TFTP on another QNAP NAS (my QNAP TS-121 nas2.home.mydomain.co.uk / which is connected to the same Gigabit switch as my servers.  Dnsmasq was installed the same way on this second QNAP (by way of the Optware plugin and installation of dnsmasq package using ipkg command).   The contents of /opt/etc/dnsmasq.conf on this second NAS is as follows (everything else is hashed out defaults, as before)

# Ensure the areas that Dnsmasq wants to read/write to/from is set correctly

# Enable TFTP service

# Where to put the pxeboot images (our Ubuntu netboot image)

We now have a TFTP service but it’s no good without any images to boot from.  As I’m interested in running RPC on Ubuntu 12.04, I head over to grab an Ubuntu 12.04 ISO and copy the /images/netboot/pxeboot directory to /share/HDA_DATA/Public.  If you don’t have an Ubuntu 12.04 ISO handy, you can grab this directory and files from here http://archive.ubuntu.com/ubuntu/dists/precise-updates/main/installer-amd64/current/images/netboot/

You will end up with a directory called /share/HDA_DATA/Public/pxeboot with the following files in:

pxelinux.0 -> ubuntu-installer/amd64/pxelinux.0 
pxelinux.cfg -> ubuntu-installer/amd64/pxelinux.cfg/

Booting this as it stands now will give you a graphical installer allowing you to install Ubuntu interactively.  This is fine, but we prefer to automate all the things. To do this we edit the ubuntu-installer/amd64/boot-screens/txt.cfg file to give a choice in the menu to do an install of Ubuntu applicable.  Mine is as follows:

default ks
 label ks
 menu label ^Kickstart Install
 menu default
 kernel ubuntu-installer/amd64/linux
 append vga=788 initrd=ubuntu-installer/amd64/initrd.gz
 http_proxy= ks=
 -- quiet
 label install
 menu label ^Install
 kernel ubuntu-installer/amd64/linux
 append vga=788 initrd=ubuntu-installer/amd64/initrd.gz -- quiet

Be careful with that first append line under the Kickstart Install stanza – it’s a single line, line-wrapped for this blog.

With this in place I now get a couple of options when I PXE boot a server (Pressing F12 during the N40L boot process), with one being the option to do a Kickstart Install. This Kickstart Install option specifies a few things on the boot “append” line.  Particularly the http_proxy option and the ks option.  The http_proxy option is fairly obvious – we’re passing the the address and port of a proxy server to use as part of the installation.  I’m specifying the proxy server running on my second NAS2 at address where Squid has been setup to cache large objects so it can cache deb packages. The ks option specifies a kickstart configuration file to run as part of the installation, automating the options of the installation from choosing packages to formatting disk options, etc. This kickstart file is available on an anonymous FTP address running on the same NAS2 device and looks like the following

lang en_GB
langsupport en_GB
keyboard gb
timezone Etc/UTC
url --url http://gb.archive.ubuntu.com/ubuntu/ --proxy
rootpw --disabled
user openstack --fullname "openstack" --password openstack
authconfig --enableshadow --enablemd5
clearpart --all --initlabel
zerombr yes
part /boot --fstype=ext2 --size=64
part swap --size=1024
part / --fstype=ext4 --size=1 --grow
bootloader --location=mbr
firewall --disabled
apt-get update
apt-get upgrade -y
# setup locales
locale-gen en_GB.UTF-8
update-locale LANG="en_GB.UTF-8"
echo 'LANG=en_GB.UTF-8' >> /etc/environment
echo 'LC_ALL=en_GB.UTF-8' >> /etc/environment
# Set up root keys (all use same root key - NOT FOR PROD!)
wget -O /tmp/root-ssh-key.tar.gz
cd /target
tar zxf /tmp/root-ssh-key.tar.gz
# Pull down installer for later use
wget -O /root/install-openstack.sh
chmod 0700 /root/install-openstack.sh
# Convenient script to power off all my machines
wget -O /root/all-off.sh
chmod 0700 /root/all-off.sh

A few things – this is clearly intended for a lab, feel free to edit and improve! The result should be something that is convenient to you through automation. I set a user up called openstack – this is a requirement of Ubuntu to have a user other than just root set up. I also just pull down some scripts and items useful for my setup, one of which is a tarballed /root/.ssh/ directory. This has keys and .ssh/authorized_keys already pre-setup and the reason is for when we get to do an install of Rackspace Private Cloud which uses Chef that relies on an ability to ssh amongst the machines.

At this point, after PXE booting the 5 servers in my home lab setup, I have Ubuntu 12.04 installed and root keys ready to have Rackspace Private Cloud installed. On my ADSL setup, kicking the 5 machines takes about 15 minutes which is an acceptable time to kick my lab, allowing me to try various runs of installations – speed and automation are important for any lab.

In the next post I’ll cover off the steps to get an HA Rackspace Private Cloud installed using the Rackspace Chef cookbooks.


5 thoughts on “Home Rackspace Private Cloud / OpenStack Lab: Part 2

  1. […] the next blog post I’ll cover QNAP Dnsmasq Configuration providing DHCP, DNS and TFTP for my network allowing me […]

  2. […] the first two posts I covered the basics: what hardware is involved and the basic network services which forms […]

  3. […] after following the first three posts, we now have a Rackspace Private Cloud by OpenStack running with 2 Controllers (HA) and 3 […]

  4. […] first four of these posts covered setup and installation of my home lab, including the networking, PXE booting […]

  5. […] Lab Part 2: Network services (DHCP, DNS, TFTP + Kickstart Ubuntu) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: