Saturday, April 9, 2011

Server upgrade: day 2

After deleting a few packages that had been installed from the ubuntu stream and were causing major issues, the upgrade somewhat took care of itself. TFTPD-HPA isn't incredibly happy at the moment, but I'll sort that out next time I feel the need to PXE boot anything (there may be a tutorial on exactly how I got BartPE to PXE boot, which would be just a mix of all the information that is already floating around on the internets).

I've already got a working config for the WIDE DHCPv6, so migrating to the ISC version wasn't going to be too difficult - fortunately I found a sweet tutorial which made life easier. Once I'd got my new config set up, all that needed to be changed was /etc/init.d/dhcp with a couple of extra lines

                echo -n "Starting DHCPv6 server: "
                start-stop-daemon --start --pidfile $DHCPD6PID \
                        --exec /usr/sbin/dhcpd -- -q -6 -cf /etc/dhcp/dhcpd6.conf $INTERFACES
                sleep 2

                if [ -f "$DHCPD6PID" ] && ps h `cat "$DHCPD6PID"` >/dev/null; then
                        echo "dhcpd6."
                        echo "dhcpd6 failed to start - check syslog for diagnostics."

It hasn't crashed yet, and I'm hoping that it will be a bit more resilient than the WIDE package. I'll let you know how my testing goes with all my different operating systems here!

Friday, April 8, 2011

Nagios, DHCPv6, and migrating Debian servers

Migrating debian

I convinced myself I'd keep this updated after I started work, but this was assuming that I'd still have time to play with my server alongside having a real job and trying to maintain some sort of social life. I did however end up a little bit tipsy last Thursday, which prompted me to start migrating my server from it's original 8GB home to the 250GB drive that has been there for the last two years under the name of /usr/bigdisk for obvious reasons.

My first hurdle was underestimating how long it takes to copy 8GB over IDE on an old pentium 4 (on a side note, describing a pentium 4 as old still makes me feel like a bit of a dinosaur given i vividly remember my first 586) so after having unscrewed my case and plugged in the CD-ROM without electrocuting myself, and booting up backtrack (version 2, because 4 is on a dvd, and 3 was a bit shit), I started what I thought was a sensible cp /mnt/sda1 /mnt/sdc2

Fast forward an hour and a half, and ignoring the part where I converted the original partition to ext2 (by deleting the journal) and shrunk it which took about half an hour by itself (and is already adequately documented everywhere else on the internet) and created the new partition (total of 10 seconds work), I got to the stage where I installed grub (after a chroot to /mnt/sdc2 because bt2 only has LILO) and was ready for a reboot, only to find that half of my stuff wouldn't work because EVERYTHING was 755 to root.

This was about the time I decided it was good to go to bed, since I had to get up for work in less than five hours. The next day I did the procedure all over again, except with the help of the -a switch to the cp command (keeps permissions and timestamps the same - don't leave home without it), made sure to set up fstab, set the partitions back to ext3, and set up grub to use the correct partitions. Finally, everything booted, and I was good to go.

Why did I migrate? The drive was only 95% full, and I thought maybe that was why my wide-dhcpv6-server was crashing... but this wasn't the case in the end.

I'd not had any problems with wide-dhcpv6-server until recently, so I figured a nearly-full hard drive was why it seemed to crash for no reason every second day. This wasn't the case however, and my research showed that the WIDE DHCPv6 project stopped about three years ago. It turns out that the official ISC DHCP server incorporates both now (although they need to run in separate instances), but to install this, I needed to upgrade to squeeze, so once all 2.4GB of packages come down, I'll let you know how this goes for me.

We use this at work to keep an eye on the network, and after writing a plugin to report on light levels on SFP's I decided it made sense to install it at home. This helped me track the DHCPv6 problem, but also made it easier to see the moment anything went wrong. It's only a simple setup at the moment, with periodic pings to google through my IPv4 and IPv6 gateways, and checks on the HTTP and DHCP servers, but already I feel like I have a way closer eye on the health of my server.