Friday, October 26, 2012

Modding your Synology NAS to support DNS and DHCP to manage your home/office network

Intro


I have been hunting around for a way to manage the growing number of devices on my home network. For the most part, I don't care about the host names and IP addresses of my devices. I'm quite happy for DHCP to manage all of this via my router and get on with life. However, I would like to be able to contact core bits of my home network infrastructure via fully qualified names (eg nas.homenetwork.com) rather than remembering a series of IP addresses. I think that I probably need to set up a local DNS server, but where to run it? To be useful, it would need to be always on. Other than my routers, the only other device that fits the bill is my NAS.

Synology NAS DS1511+


There are many things to like about the Synology NAS (I have a model DS1511+). I'm not going to go on about DSM or any of the other packages here however it's effectively just a linux box, which got me thinking that someone must have attempted to set up just this sort of thing already. Which of course, they had.

Once you log into the NAS's admin console (I have DSM4.1 installed), you can turn on SSH access by checking the option Control Panel->Terminal->Enable SSH Service. Once logged using admin credentials, you can see what's running under the hood:

DiskStation> uname -a
Linux DiskStation 3.2.11 #2647 SMP Wed Sep 26 03:17:57 CST 2012 x86_64 GNU/Linux synology_x86_1511+


According to this Synology forum reference, the DS1511+ has the following hardware:

Intel Atom D525 Dualcore (2C/4T) 1.8GHz x86 Processor

I've monitored the NAS under all sorts of workloads in it barely gets taxed so I'm not too concerned about adding a few extra daemon processes.

There is also a Synology site on how to mod your NAS which is a recommended read before proceeding. The key points are that:
  • you need to get the ipkg utility installed
  • modding may invalidate your warranty
  • back up your data first

Bootstrapping the NAS

Bootstrapping was pretty straightforward and involves running a shell script which installs a few packages that are eventually required to get ipkg up and running:

DiskStation> sh syno-i686-bootstrap_1.2-7_i686.xsh
Optware Bootstrap for syno-i686.
Extracting archive... please wait
bootstrap/
bootstrap/bootstrap.sh
bootstrap/ipkg-opt.ipk
bootstrap/ipkg.sh
bootstrap/optware-bootstrap.ipk
bootstrap/wget.ipk
1216+1 records in
1216+1 records out
Creating temporary ipkg repository...
Installing optware-bootstrap package...
Unpacking optware-bootstrap.ipk...Done.
Configuring optware-bootstrap.ipk...Modifying /etc/rc.local
Done.
Installing ipkg...
Unpacking ipkg-opt.ipk...Done.
Configuring ipkg-opt.ipk...WARNING: can't open config file: /usr/syno/ssl/openssl.cnf
Done.
Removing temporary ipkg repository...
Installing wget...
Installing wget (1.12-2) to root...
Configuring wget
Successfully terminated.
Creating /opt/etc/ipkg/cross-feed.conf...
Setup complete.

Installing BIND on the NAS

[Edit]: I've moved the BIND configuration steps into a new post here since I encountered further issues. Note that you should just check out the DHCP link below if you don't specifically need BIND as it covers dnsmasq which, as I've discovered, is just simpler and will probably do what you want.

Installing DHCP server on the NAS

[Edit]: I've moved the DHCP configuration steps into a new post here since I encountered further issues.

Wednesday, October 24, 2012

NFS mounting Synology NAS shares on (fresh) Ubuntu 12.10

An accidental 'make install' in an incorrectly configured dev environment blatted part of my Ubuntu installation. I thought removing and adding the affected packages and then later an upgrade from 12.04 to 12.10 might fix this but ended up having to do a fresh install. Annoying, but it let me rejig a few things on my dual boot (Win7/Ubuntu) PC in the process.

This is a minor note but I was trying to mount some shares on my Synology NAS via NFS but the mount command kept failing, telling me that it was due to a 'wrong fs type, bad option, bad superblock' or possibly one of a variety of other reasons. Somewhat surprisingly, it turns out that the desktop version of Ubuntu 12.10 is missing the NFS packages required to facilitate this. To correct this:

sudo apt-get install nfs-common

Then you can run something like the following to see your files on the NAS:

sudo mount yournashost.home.net:/volume1/music /mnt/music

Don't forget to update /etc/fstab if you want these mounts to be brought up each time the system boots. Tab separated.

yournashost.home.net:/volume1/music /mnt/music nfs rw 0 0