screen capture of the DSM control panel UI

Synology DSM 5.0

screen capture of the DSM control panel UI

Synology has upgraded the software of its Diskstation line of servers to version 5.0. This version brought mostly features for power-users and a lot of incremental improvements, in particular for file-sharing performance, which are very welcome. The most visible change is the new, more polished UI. It is interesting to see how far they got in emulating a window manager within a browser. The sad part is that the new UI looks like a clone of Windows 95, and is as intuitive.

Sadly, I mostly noticed the difference in terms of what broke: my squid installation first, but that is not critical. More annoying, the printing sub-system, which was providing both Airprint and Google-print broke. Of course this happened on the one week when I needed printing to work, and ironically, the one time I did not install the beta of the new software. The forums contained the usual recommendations so that the NAS would find my printer again: unplug, restart, replug, Windows 95 indeed. The one feature that motivated me to upgrade was a system to handle unified cloud storage (Google Drive, Dropbox) synchronisation – it took me quite some time to realise this is done by the way of an app one has to install.

The new release comes with new version of the mobile phone apps. Promising features, like the ability for DS audio to stream music to my Chromecast, but again broken by lack of testing, my Chromecast did not recognise the authentification keys of the app – the trick, I figured out, is to disable https, when you log into the NAS from the app.

All in all, a pretty disappointing release, I wish Synology had spent more time to test this version before releasing it to the public. If you don’t need the performance improvements now, I would recommend you wait until the various quirks are fixed before upgrading.

flattr this!

Unison logo

Building Unison 2.32 for Synology DS211

Unison Logo

I wanted to build the unison file synchroniser for my Synology DS211 NAS. This is always complicated by the fact that unison is written in Ocaml. Here are the steps I followed, largely inspired by this post on compiling unison for a DS212+ and this post (in german) on installing unison 2.32 on a Bufallo NAS. All the instructions assume you run as root. First you will need to install ipkg, beware that the built-in wget does not work properly with ipkg, so you need to manually install a newer version of wget and then make sure that /opt/bin/ is early in your path so that ipkg can use it.

cd /volume1/tmp
ipkg install ocaml make gcc textutils
rm /opt/arm-none-linux-gnueabi/lib/libpthread.so.0
ln -s /lib/libpthread.so.0 /opt/arm-none-linux-gnueabi/lib/
wget http://www.seas.upenn.edu/~bcpierce/unison//download/releases/unison-2.32.52/unison-2.32.52.tar.gz
cd unison-2.32.52
vi update.mli
Remplace the line «module NameMap : Map.S with type key = Name.t»
with «module NameMap : MyMap.S with type key = Name.t»

make clean
make mkProjectInfo
make NATIVE=false UISTYLE=text CFLAGS=”-cclib -L/lib”
cp ./unison /opt/bin/
unison -version

The last command should return unison version 2.32.52 confirming that the binary works properly. To ensure that remote calls find the proper binary, add the following line to your unison configuration: servercmd = /opt/bin/unison.

flattr this!

Pac File

🔧

So I run my own squid proxy service on my Synology NAS. While it easy to associate a given proxy setting with an wifi network for both iOS and Android devices, Mac OS X has this semi-working notion of network location, which would make a lot of sense it the location was determined by the wifi network or the physical location. But it does not. So how to configure the laptop to talk to my proxy when at home and not if somewhere else?

The solution I found is to write a custom PAC file which basically uses my proxy if its name can be resolved. The file is standard fare, with just one added line to check that the proxy can be resolved. One important thing is to not configure the pac file as a local file: this will not work, as Safari will be unable to load it from the sandbox, the simplest way I found is to serve it from the local web-server on the machine, i.e. http://127.0.0.1/home.pac.

function FindProxyForURL(url, host) {
  url = url.toLowerCase();
  host = host.toLowerCase();
  /* Don't proxy local hostnames */
  if (isPlainHostName(host)) {
    return 'DIRECT';
  }
  var hostIP = dnsResolve(host);
  /* Don't proxy non-routable addresses (RFC 3330) */
  if (isInNet(hostIP, '0.0.0.0', '255.0.0.0') ||
      isInNet(hostIP, '10.0.0.0', '255.0.0.0') ||
      isInNet(hostIP, '127.0.0.0', '255.0.0.0') ||
      isInNet(hostIP, '169.254.0.0', '255.255.0.0') ||
      isInNet(hostIP, '172.16.0.0', '255.240.0.0') ||
      isInNet(hostIP, '192.0.2.0', '255.255.255.0') ||
      isInNet(hostIP, '192.88.99.0', '255.255.255.0') ||
      isInNet(hostIP, '192.168.0.0', '255.255.0.0') ||
      isInNet(hostIP, '198.18.0.0', '255.254.0.0') ||
      isInNet(hostIP, '224.0.0.0', '240.0.0.0') ||
      isInNet(hostIP, '240.0.0.0', '240.0.0.0')) {
    return 'DIRECT';
  }
  if (isResolvable('tekai.local')) {
    return 'PROXY tekai.local:3128';
  }
  return 'DIRECT';
}

flattr this!

Unison on Synology DS211

Unison Logo

I finally replaced my NAS with a newer model, a DS 211, which has the same form-factor, but a faster ARM processor. CPU performance was one reason for replacing it (it would basically get maxed out at around 6 MB/sec) the other was that support was discontinued, and among the newer firmware features I wanted was support for Time Machine in Lion. Most of the stuff worked out of the box, and file transfers are way faster. I reinstalled the ipkg package manager following the instructions you can find on the official wikis. The catch came when I wanted to install the unison file synchroniser which always complicated because it is not written in C, but in Ocaml, which always complicates matters.

  • There is no ipkg for unison in the standard package list.
  • Installing gcc and friends a compiling from the source does not work, because there is no native compiler for ARM processors.
  • Compiling the code but disabling native code generation did not work either, I was getting some random syntax errors.
  • I finally found a package in the unstable tree of NSLU2 Linux, this one installs fine.
  • I had to enable ssh access for the regular user account I use for synchronisation, by default, user-account cannot remote login, simply editing /etc/passwd did the trick.

Now unison works, but when doing a big sync, I’m back to ~6MB/sec, but this time, the bottleneck seems to be sshd which uses around 60% of the CPU, I will have to try other ciphers.

flattr this!

Web caching on my NAS

Squid cache logo

I have been running the Squid proxy software on my Synology DS 207 for over a month now, and I was curious to see how much traffic would end up being cached. My iPhone, my personal laptop and my Playstation 3 are all configured to use for regular HTTP traffic. So I downloaded the access log files and ran some Python on it.

The first thing to observe is that the amount of cache hits is relatively low: around 8% of the request were serviced from the cache. When counted in bytes, the efficiency of the cache is even worse: around 1% of the bytes were served out of the cache. This was to be expected, the largest download occur only once, so caching them makes no sense. Clearly whatever saving I get from the proxy is in terms of latency, in particular for the iPhone which has little internal cache. While the NAS has a latency advantage, it is not so big nowadays, ping times from my laptop to the NAS is around 2.5 ms, while the Apple software server (the first in the list below) is around 25ms, given the fact that the NAS serves out of its disk, I’m not sure the latency improvement of the cache is that great, I have to find a way to measure that…

The next question is what gets cached, besides a few places I go to regularly (like my blog), most of the cached servers are serving static content. So the proxy is its job properly: caching frequent, static content.

Hostname Hits
swcdn.apple.com 5363
r.mzstatic.com 2996
images.apple.com 629
a4.mzstatic.com 555
a2.mzstatic.com 554
pics.ricardostatic.ch 541
illiweb.com 535
a5.mzstatic.com 532
a3.mzstatic.com 508
a1.mzstatic.com 494
fastcache.gawkerassets.com 458
clients1.google.ch 429
www.fr.ricardo.ch 427
upload.wikimedia.org 422
i4.ytimg.com 389
static.arstechnica.net 380

So what mimes mostly get cached, unsurprisingly, this is mostly images and text data.
The fact that many sites still are not configured to return the MIME type is worrying but well…

Mime Hits
image/png 8898
image/jpeg 6976
text/plain 5599
image/gif 4801
text/html 2650
application/x-javascript 2019
text/css 1495
- 763
text/x-cross-domain-policy 518
application/javascript 505
text/javascript 496
image/x-icon 335
application/x-shockwave-flash 313
application/xml 259
application/x-x509-ca-cert 150
text/xml 137
application/vnd.google.safebrowsing-chunk 126
application/pdf 109
application/ocsp-response 27
application/octet-stream 19

flattr this!

Screen Capture for configuration Airprint on Synology NAS

Airprint for Brother Printer with Synology NAS

Screen Capture for configuration Airprint on Synology NAS

Airprint is a interesting protocol, that lets any iOS device connect to a printer to use it. Sadly, Mac OS X 10.6 does not contain an Airprint server so you cannot let your computer share the printer for the iOS device. If you have a Synology NAS, there is a way around this problem:

  • Make sure you have a recent version of the Synology software (this works with DSM 3.1 – 1613)
  • Connect the printer to the NAS using a USB cable
  • Log into the web interface of the NAS
  • Open the Control Panel
  • Open the External Devices item, you printer should be present in the lower pane.
  • Click on the USB Printer Manager menu
  • Check the Enable Airprint item, and select the driver model matching yours the best. In my case I have a Brother HL-4040CN printer, but that model is not present in the list, but selecting the HL-5040 works fine.

flattr this!

Installing Unison on Synology 207 NAS

Synology DS 207

Unison is a nice tool to synchronize file-system. It has the advantage of running on many different platforms, use an ssh connection and be good at one thing (file synchronization). I’m using it to synchronize my data between my laptop and a Unix server that acts as a back-up. I wanted to use it also to have a mirror of all my data on my NAS, in particular my music that is then served on my home network from the NAS. Until now I used so rsync scripts to do the trick, but rsync is quite stupid with permissions and cannot detect file moves. The main advantage of rsync is that it is already installed on any Linux machine, including my NAS.

Here are the steps to follow to install unison on a Synology DS 207 NAS:

  1. Enable ssh access
  2. Download the ipkg bootstrap script ds101-bootstrap_1.0-4_powerpc.xsh (the DS 101 and the DS 207 have the same processor, so this is OK).
  3. Copy the file to the NAS, for instance in the path /volume1/tmp.
  4. Ssh into your NAS as user root (ssh root@xxx.local).
  5. Go to the directory (cd /volume1/tmp)
  6. Execute the installation script: ds101-bootstrap_1.0-4_powerpc.xsh
  7. If there is an error about a missing dependency for wget-ssl, don’t sweat it, it still works.
  8. To check that it works, try to update the package list ipkg update
  9. Download the package definition for unison: unison_22757-1_powerpc.ipk. You can do this directly from the NAS or from your computer, and then copy the file to the /volume1/tmp directory.
  10. Install the unison package: ipkg /volume1/tmp/unison_22757-1_powerpc.ipk.

flattr this!

Installing Net-Snmp on the Synology DS 207

I wanted to have an SNMP dæmon running on my NAS. This way all the boxes on my network can be queried using SNMP. This is quite simple, assuming you have ipkg installed.

  1. Install net-snmp: ipkg install net-snmp
  2. Edit the configuration file in /opt/etc/snmpd.conf, you can just use vi or call the snmpconf program. There a three fields you should edit:
    1. Comment ou the entry that defines write access # rwcommunity SNMPv1_RW you probably don’t need this feature and this is a security risk
    2. Edit the syslocation to add the physical location of the NAS.
    3. Edit the syscontact line to add the contact person for the device, probably yourself.
    4. Add a line define the types of services provided by the box, something like sysservices 76, this corresponds to the following service levels: Internet, End-to-end, Application.
  3. Restart the snmp dæmon: /opt/etc/init.d/S70net-snmp

I also updated the hostinfo script, I cleaned up the formatting and some of the code (I would still not call it pretty), and added code to extract storage information. This information is provided by the NAS, but also my printer.

flattr this!

Synology DS 207 – new firmware

DS 207 -NAS Web screen capture

This week-end, I finally took the time to upgrade the firmware of my Synology DS-207 NAS to version DSM 2.0-0722. The upgrade was a little bit complicated: you first have to download the patch to Mac, prevent the Mac from expanding it, then upload the patch to the NAS by the way of a web-interface which does not work with Safari. The advantage when you don’t upgrade often is that you feel the difference: the whole web interface is way more polished and responsive thanks to some AJAX code, many services that kind of work are now stable (typically the iTunes music sharing service), and things that had to be hacked in are now installed by default (SSH access, NFS server). The Linux kernel is now Linux 2.6.15 #722 Fri Sep 19 20:30:34 CST 2008 ppc unknown. Finally the web interface is now better structured, and many components have their own interface. For instance the “Audio Station” can be used to see the various songs stored on the NAS, they can also be listened to using a flash player. Clearly Synology realized they can capitalize on their open-source foundation to build up the feature set of their product. They also seem to have shifted their focus from small businesses to private owners. The only thing I was missing was a SNMP interface, but I suspect I should be able to install NetSNMP one way or another.

flattr this!

The return of PowerPC

Synology DS 207 - 2×SATA NAS

As reader of this blog might have notice, I have been using macintoshes for some time. One of the element in the history of those computers has been the rise and fall of PowerPC processors, since their introduction in the 6100/7100/8100 line, until their replacement last year by the very i8086 familly it was supposed to dethrone.

While the PowerPC is not used in desktop or even laptops, the familly is still around. I have recently bought a NAS, Sinology’s Disk station 207 with two 300GB SATA hard-drives. This device basically acts as a SMB server with a Gigabit Ethernet interface. Inside the box sits an MPC8241 running embedded Linux. Basically, this a PPC 603e core, which was in many Macintoshes. The NAS box has many features, I have only tried out a few. AMUG has a more complete review. It must be noted that my box came with 128MB of RAM.

For the heck of it, I updated my network map. The interesting bit is, while it is quite complex for a home network, there aren’t many computers in it, just many network enabled devices.

Home Network Plan with Attached Storage

Many people chimed in to remind me that PPC processors are used in quite a few places, in particular gaming consoles. All of the next generation gaming consoles are PPC based: XBOX 360, Playstation 3 and Wii all use PPC chips.

flattr this!