Posted by: Karl H. Beckers | April 28, 2008

D-Link DNS-323 as print and scan server (part 1)

Even if I feel like doing too many things at the same time that has never stopped me playing around with a new gadget. This time I’ve added the D-Link DNS-323 NAS device to my home office so I can have automatic, reliable backups soon. The device itself is really cool, with some nice services (e. g. an iTunes server) and a USB port for hooking up external devices. Adding a printer there turns the box into a print server. The most important feature to me for picking this product from the range of comparable products, though, was its openness. There is no need to install any proprietary software on the client, and it runs a Linux kernel, which makes it really open for software extension.

The print server was absolutely a feature I wanted to use. So I hooked up my Samsung ML 2010 printer to the USB port of the NAS device, changed my printer definition on my gutsy clients to the samba queue “lp” on the IP address of the DNS-323, and lo and behold: Printing worked out of the box. (This is making a long story short because printing did not work from my laptop due to an average of 60% packet on the powerline home link between the WLAN access point and the gigabit network hosting the DNS-323. But that was fixed by adding two separate power outlets.) I read that the 1.4 version of the firmware fixes an issue with the disks not spinning down when using the print server alongside with UTF8 issues and installed that.

What of the scanner now? Leave that attached to the home PC? Of course not! But as there’s no scanner service running on the box as it comes off the shelf, this started my quest for how to extend the services on the DNS-323.

Definetely the most important resource I found is the DNS-323 wiki. It has loads of information, howtos, forums, etc. Basically, for extending the device there are three options documented on that site:

  1. Use a fun_plug script to start up services after the box itself has started,
  2. Install Linux into a chroot’ed environment,
  3. Flash the device to run Linux natively.

Variant 3 definetely looked like it would be beyond my hardware modding skills or ambitions (you first need a serial port). Variant 2 still looked too complicated for my taste. So, I started with the fun_plug. On the wiki there are links to a ready-to-use fun_flug framework, called ffp. First I installed version 0.5 beta and it looked quit good. However, I soon found that it didn’t have nearly as much additional software pre-compiled for the box’s ARM processor as I was hoping for. There is, however, the optware project originally targeted at Linksys routers which has a considerable number of software packages ready and helpful instructions for adding further software. Optware recommends using the stable version 0.4 of ffp. That is because that uses libraries provided by the firmware in a number of instances where 0.5 brings its own libraries. That in turn saves some disk access, and as I decided only to use ffp for providing a mechanism to start services, that’s fine for me.

After bootstrapping the optware framework (again see the DNS-323 wiki), I installed the sane-backends package, configured saned.conf to allow network access from my local network, started the daemon, configured sane on my clients to query the DNS-323 … and could scan. At first, the sane client would always ask me to select from two scanners. That was because my epson scanner is served by two variant epson drivers for sane. To solve that, I edited sane’s dll.conf on the DNS-323 and made sure of the two lines “epson” and “epson2″ only one was active by commenting the other with a “#”.

Then I needed a way to start the sane service automatically, so here’s what I added to the fun_plug.d/start directory:

1. A link to /opt/etc/init.d/S01sane-backends for adding the sane-port definition to /etc/services on each reboot. Make sure that script is executable: ln -s /opt/etc/init.d/S01sane-backends /mnt/HD_a2/fun_plug.d/start/04sane-backends.sh

2. A script to start xinetd (which can be installed from the optware repository) 05xinetd.sh:

#!/bin/sh

OW_SBINDIR=/opt/sbin

xinetd_start() {
if [ -x "${OW_SBINDIR}/xinetd" ]; then
echo “Starting inetd… “
${OW_SBINDIR}/xinetd
else
echo “ERROR: inetd not found or not executable”
fi
}

xinetd_stop() {
killall xinetd
}

xinetd_status() {
if [ -n "$(pidof xinetd)" ]; then
echo “running”
else
echo “stopped”
fi
}

case “$1″ in
stop)
xinetd_stop
;;
restart)
xinetd_stop
sleep 1
xinetd_start
;;
status)
xinetd_status
;;
start|”)
xinetd_start
;;
*)
echo “Usage: $0 start|stop|restart|status”
;;
esac

That’s that. Are we done? Not quite, because now that I can scan and print without using my home PC, I want to be able to make photocopies without PC, too.
But that’s a topic for my next post.

Responses

This blog is pretty interesting, will add a bookmark, thanks.

Nice tutorial, you should add this to the DNS-323 wiki for others to enjoy.

Leave a response

Your response:

Categories