Dec 172010
 

My cordless phone are dying. For years now I’ve used a pair of GE cordless phones and a Linksys SPA2100 with the Primus TBB VoIP service. The batteries and LED screens on the phones are pretty well shot at this point, so I need a replacement. But why would I buy another set of analogue phones? That seems totally counter to my position as a VoIP tech.┬áSo here’s the plan: Get trixbox running as a paravirtualized Xen domU and configure a pair of Linksys WIP310’s to act as my house phones (the WIP310 is a wifi SIP phone in a candybar form factor, meaning they are essentially drop in replacements for my old cordless phones).

First, some background on my Xen host. It’s running Debian squeeze, which includes Xen 4.0 and a pv_ops enabled 2.6.32 kernel. I have a 6 drive softRAID6 array with LVM layered on top, which is both my NAS and the store for my domU disk images. Each domU gets a 10 gig LVM volume to use as it’s primary disk (domU’s that need additional storage get a second appropriately sized LVM volume delivered as another disk).

My standard procedure for installing a domU like this is to actually install it in hardware virtualization mode, and then afterward convert the domU to paravirtualized mode. For LiveCD based installers and other ‘appliancy’ distros, this makes life much easier.

Step 1: Get trixbox running as a hardware virtualized domU

First we need to create an LVM volume 10 gigs in size (# lvcreate -L10G -n trixbox Data works for me, replace the volume group as necessary).┬áNext, configure a HVM based config file that we’ll use for the installation. Here’s mine:

[cc lang=”ini”]
# Name of the domU
name = “trixbox”

# HVM options
kernel = “/usr/lib/xen/boot/hvmloader”
device_model = “/usr/lib64/xen/bin/qemu-dm”
builder = ‘hvm’

# Console and other options
serial = ‘pty’
vfb = [ ‘vnc=1,vncdisplay=2’ ]

# Virtual hardware configuration
vcpus = 2
memory = 1024
vif = [ ‘mac=00:16:3e:xx:xx:xx,bridge=eth0’ ]
disk = [
‘phy:/dev/Data/trixbox,xvda,w’,
‘file:/mnt/files/software/trixbox/trixbox-2.8.0.4.iso,hdb:cdrom,r’
]
boot = ‘d'[/cc]

Make sure you change the last three octets of that MAC address.

To do the actual installation, boot the domU (# xm create /etc/xen/trixbox.hvm on the Xen host in my case) and open a VNC client at your Xen host on port 5902 (because the vncdisplay option is set to 2 in the config file). Follow the regular installation instructions for trixbox, which basically amount to hitting enter a few times and typing in the root password. The domU will reboot automatically, but because the boot command is set to ‘d’, it will boot from the ISO again. Just shut down the domU (# xm shutdown trixbox on the Xen host).

Now edit the HVM config file so the hardware configuration stanza looks like this:
[cc lang=”ini” ]
# Virtual hardware configuration
vcpus = 2
memory = 1024
vif = [ ‘mac=00:16:3e:xx:xx:xx,bridge=eth0’ ]
disk = [ ‘phy:/dev/Data/trixbox.nullpointer.ca,xvda,w’ ][/cc]

And boot the domU again.

Step 2: Reconfigure domU to run paravirtualized

We’re going to make the necessary changes to the domU to make it happy when booting as a paravirtualized host now.

Modify /etc/grub.conf and set the Xen kernel as default:
[cc lang=”ini” ]default=1[/cc]
to:
[cc lang=”ini” ]default=0[/cc]

Modify the first stanza from:

[cc lang=”ini” ]
title trixbox (2.6.18-164.11.1.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-164.11.1.el5
module /vmlinuz-2.6.18-164.11.1.el5xen ro root=LABEL=/
module /initrd-2.6.18-164.11.1.el5xen.img[/cc]

to:

[cc lang=”ini” ]title trixbox (2.6.18-164.11.1.el5xen)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.11.1.el5xen ro root=LABEL=/ console=xvc0
initrd /initrd-2.6.18-164.11.1.el5xen.img[/cc]

Rebuild the initrd for the xen kernel (the automatically generated one is missing some xen modules):
[cc lang=”bash”]rm -f /boot/initrd-2.6.18-164.11.1.el5xen.img
mkinitrd –with=xenblk –with=xennet /boot/initrd-2.6.18-164.11.1.el5xen.img 2.6.18-164.11.1.el5xen[/cc]

Disable kudzu otherwise network will go wrong later:
[cc]chkconfig –del kudzu[/cc]

Install Xen version of dahdi:
[cc]yum install -y kmod-dahdi-linux-xen[/cc]

Modify /etc/inittab so you get a local console. Change this section:

[cc]
# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6[/cc]

to:

[cc]
# Run gettys in standard runlevels
co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
#1:2345:respawn:/sbin/mingetty tty1
#2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6[/cc]

Allow root logins at xvc0:
[cc]echo xvc0 >> /etc/securetty[/cc]

Modify /etc/fstab so that it looks like this:
[cc]
/dev/xvda2 / ext3 defaults 1 1
/dev/xvda1 /boot ext3 defaults 1 2 tmpfs
/dev/shm tmpfs defaults 0 0 devpts
/dev/pts devpts gid=5,mode=620 0 0 sysfs
/sys sysfs defaults 0 0 proc
/proc proc defaults 0 0
/dev/xvda3 swap swap defaults 0 0[/cc]

Optionally you may also want to scp the initrd and kernel images from the grub.conf to the Xen host. Booting a CentOS based distro is pretty easy with pygrub, but I like to keep the initrd and kernel images around on the host anyway. Now shut down the host (# shutdown -h now from inside the domU will work just fine). Now we need to create the paravirtualized config file. Here’s mine again:

[cc lang=”ini”]
# Name of the domU
name = “trixbox”

# Paravirtualization options
kernel = ‘/usr/lib/xen/boot/trixbox-2.8.0.4-vmlinuz-2.6.18-164.11.1.el5xen’
ramdisk = ‘/usr/lib/xen/boot/trixbox-2.8.0.4-initrd-2.6.18-164.11.1.el5xen.img’
extra = ‘root=/dev/xvda2 console=hvc0’
vnc = 0
sdl = 0

# Virtual hardware configuration
vcpus = 2
memory = 1024
vif = [ ‘mac=00:16:3e:xx:xx:xx,bridge=eth0’ ]
disk = [ ‘phy:/dev/Data/trixbox,xvda,w’ ][/cc]

As you can see, I was lazy and just boot the domU using the initrd and kernel directly.

Step 3: Booting the paravirtualized trixbox domU At this point it should be a simple matter of # xm create -c /etc/xen/trixbox.pvm (or whatever path is appropriate for you). You’ll be able to watch it boot. When trixbox finishes booting, it lists its IP on the console and you can log into it via HTTP from there. Actually configuring the trixbox installation is a little beyond the scope of this blog entry, though I may do another entry focused on that.

While creating this domU I found some of the CentOS tailored information in this blog post from Roel Broersma.

Sorry, the comment form is closed at this time.