Showing posts with label NAS. Show all posts
Showing posts with label NAS. Show all posts

Sunday, June 30, 2013

Backing up Win 7 Home Premium via iSCSI + Synology NAS

This post describes how to use iSCSI on Win 7 Home Premium to work around the restriction of backing up to a networked device.

Like many of you, I didn't fork out for Win 7 Enterprise for my home set-up. One thing the Enterprise edition allows which the Home Premium edition does not is backing up to a network drive. Kind of irritating, when you consider that a lot of folks will have networked storage either in a NAS or USB attached storage to consumer networking devices like wireless routers and cable modems.

Until recently, I'd been backing up my Win 7 Home edition to a USB drive, then using the Synology Data Replicator 3 tool to shunt the backup data from the USB drive to the NAS. This is an irritating multi-step process and takes longer than it should.

To work around it (sorry, not going to go through the specifics but they can easily be searched for):
  • set up an iSCSI target on your NAS
  • use Windows 'iSCSI Initiator' tool to connect to the target
  • use Windows Computer Management->Disk Management console to locate the new storage, format it and present it on your Win 7 machine wherever you'd like it (note that Windows backup will only let you back up to what it considers an external drive, so you may need to mount as a drive letter or folder other than on C:\). Despite the drive existing on the network, Windows sees it as a local hard disk.
  • reconfigure your backup to point to the new backup location created in the above steps
  • run your backup.
Now the external drive I was previously using for backups can go on to other duties.

Monday, January 28, 2013

Upgrading Synology NAS DHCP server package (dnsmasq) 1.0-2256 to 1.0-2267

The DHCP server has probably caused me the most grief (through high levels of ignorance) on my NAS. Again, I thought I'd document the process should anything go wrong. I'm going from 1.0-2256 to 1.0-2267, which adds PXE support which comes in DSM 4.2.

Post upgrade report shows no issues so far.


Upgrading Synology DSM 4.1-2661 to 4.1-2668

Last time I upgraded the DSM version on the NAS a few things seemed to break so I thought I'd document what I found. The upgrade I'm attempting is DSM 4.1-2661 to 4.1-2668. It also looks like DSM 4.2 is just around the corner. Needless to say, I have everything on my NAS backed up.

Post upgrade I can happily report no immediate issues found.

Sunday, November 04, 2012

DNS configuration for your home network

Installing BIND on the NAS

 
I found some documentation on how to set up BIND (DNS) on a Synology NAS running Linux but as I ran into some problems I thought I'd document them here on the offchance someone finds it a useful reference. [Edit]: Other (simpler and in many ways better) ways of doing this exist.
 
My starting point was here, but quickly found that the more comprehensive documentation here was also useful. BIND configuration notwithstanding, the installation of the BIND package on the Synology NAS (DSM 4.1) was not without issues.
 
You start by installing the BIND package:

DiskStation> ipkg install bind
Installing bind (9.6.1.3-4) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/bind_9.6.1.3-4_i686.ipk
Installing openssl (0.9.8v-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/openssl_0.9.8v-2_i686.ipk
Installing psmisc (22.17-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/psmisc_22.17-1_i686.ipk
Installing ncurses (5.7-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/ncurses_5.7-1_i686.ipk
Configuring bind
Running post-install
You must now create your named.conf file
When it is installed in /opt/etc/named/named.conf, execute
/opt/etc/init.d/S09named start
to start service
You will probably also want to create rndc.conf by running
rndc-confgen. Of course, you may want to set your name server
in the GUI to 127.0.0.1 or your local ip-address
Configuring ncurses
update-alternatives: Linking //opt/bin/clear to /opt/bin/ncurses-clear
Configuring openssl
Configuring psmisc
update-alternatives: Linking //opt/bin/killall to /opt/bin/psmisc-killall
update-alternatives: Linking //opt/bin/pidof to /opt/bin/psmisc-killall
Successfully terminated.

I created /opt/etc/named/named.conf and related files per my desired set-up and tried to start the daemon:

DiskStation> /opt/etc/init.d/S09named start
Starting DNS Services: /opt/bin/pidof: error while loading shared libraries: libssp.so.0: cannot open shared object file: No such file or directory
started

The forums will tell you that you need gcc installed to have access to this library, so go do it. Before you do it, however, make sure root's PATH environment variable has /opt/bin and /opt/sbin at the START (that is, edit and source ~/.profile):

PATH=/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin

Otherwise you will encounter errors like the ones below:

DiskStation> /opt/bin/ipkg install gcc
Installing gcc (4.2.1-5) to root...
Downloading
http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/gcc_4.2.1-5_i686.ipk
file_move: ERROR: failed to rename /opt/ipkg-Ys4oOA/gcc_4.2.1-5_i686.ipk to /opt/ipkg-Ys4oOA/gcc_4.2.1-5_i686.ipk: No such file or directory
Nothing to be done
An error ocurred, return value: -1.
Collected errors:
Failed to download gcc. Perhaps you need to run 'ipkg update'?

It appears that there are at least two wget binaries installed on the system and the Synology version doesn't work with ipkg.
/usr/syno/bin/wget (GNU Wget 1.10.1)
/opt/bin/wget (GNU Wget 1.12)

DiskStation> ipkg install gcc
Installing gcc (4.2.1-5) to root...
Downloading
http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/gcc_4.2.1-5_i686.ipk
Installing binutils (2.19.1-1) to root...
Downloading
http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/binutils_2.19.1-1_i686.ipk
Installing libc-dev (2.3.6-5) to root...
Downloading
http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/libc-dev_2.3.6-5_i686.ipk
Installing libnsl (2.3.6-4) to root...
Downloading
http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/libnsl_2.3.6-4_i686.ipk
Configuring binutils
update-alternatives: Linking //opt/bin/strings to /opt/bin/binutils-strings
Configuring gcc
Configuring libc-dev
Configuring libnsl
Successfully terminated.

Now let's start the daemon again:
DiskStation> /opt/etc/init.d/S09named start
Starting DNS Services: started

Well this is a lie.
DiskStation> ps | grep named
12730 root      2540 S    grep named

Check /var/log/messages to see what happened:
[...]
Nov  1 15:55:25 named[8642]: dns_master_load: root.servers:40: unexpected end of file
Nov  1 15:55:25 named[8642]: dns_master_load: root.servers:40: unexpected end of input
Nov  1 15:55:25 named[8642]: could not configure root hints from 'root.servers': unexpected end of input
Nov  1 15:55:25 named[8642]: loading configuration: unexpected end of input
Nov  1 15:55:25 named[8642]: exiting (due to fatal error)

Ok, my fault for incorrectly editing the config files (a couple of issues look related to a possible  bug using 'open' (o) command in vi which incorrectly splits the last character of the line onto a new line) so clean this up and see what else was missed by looking at /var/log/messages again:
[...]
Nov  1 16:21:02 named[12572]: none:0: open: /opt/etc/named/rndc.key: file not found
Nov  1 16:21:02 named[12572]: /opt/etc/named/named.conf:19: couldn't install keys for command channel 127.0.0.1#953: file not found
Nov  1 16:21:02 named[12572]: /opt/etc/named/named.conf:19: couldn't add command channel 127.0.0.1#953: file not found
Nov  1 16:21:02 named[12572]: logging channel 'dns_log' file '/opt/var/log/dns.log': file not found
Nov  1 16:21:02 named[12572]: isc_log_open '/opt/var/log/dns.log' failed: file not found

Silly mistakes corrected, but it is at least now running with some other issues:
DiskStation> ps | grep named
12572 root      7324 S    /opt/sbin/named -c /opt/etc/named/named.conf
12730 root      2540 S    grep named

Thank goodness for that. Now let's check if the config works.

dns> nslookup
> server 192.168.1.2
Default server: 192.168.1.2
Address: 192.168.1.2#53
> dns.mydomain.net
[...]
Name:   dns.mydomain.net
Address: 192.168.1.2
> bogus.mydomain.net
[...]
** server can't find bogus.mydomain.net: NXDOMAIN
> router.mydomain.net
[...]
Name:   router.mydomain.net
Address: 192.168.1.1
> r6300.mydomain.net
[...]
r6300.mydomain.net        canonical name = router.mydomain.net.
Name:   router.mydomain.net
Address: 192.168.1.1
> www.google.com
[...]
Non-authoritative answer:
Name:   www.google.com
Address: 74.125.237.82
Name:   www.google.com
Address: 74.125.237.83
Name:   www.google.com
Address: 74.125.237.84
Name:   www.google.com
Address: 74.125.237.80
Name:   www.google.com
Address: 74.125.237.81
> 192.168.1.2
[...]
2.1.168.192.in-addr.arpa        name = dns.mydomain.net.
Cool. All the locally configured hosts are there, non-existent local hosts are not found and hosts on the internet are also found. A reverse lookup also appears to have worked. Same results on the NAS (127.0.0.1) and a Win-7 host (connecting to 192.168.0.2).
 

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