Setting up Alt-f Firmware on Dlink DNS-320L NAS

As a 2024 update, note that you shouldn’t have a D-Link NAS in place any more unless you do actually put alternate firmware on, due to remote vulnerabilities that will never be fixed… https://www.howtogeek.com/disconnect-your-d-link-nas-from-the-internet

Summary

  • These are cheap 2-bay NASs
  • I have DNS-320L (3 of them)
  • Firmware is rubbish
  • Alt-F is an open source replacement
  • Alt-F is minimalistic, but does what is needed, has a plug-in system and is efficient

Non persistant File system

On Alt-F, by contrary, any change will be lost in the next reboot. The exception is a set of well defined files, the “Settings”, that are saved in flash memory and loaded on the next reboot (or on demand), and that overrides the defaults.
To override this, there is a set of files in /Alt-F that will be pulled on boot to overlay on the existing file system. eg to change loadsave_settings

aufs.sh -n
mkdir -p /Alt-F/usr/sbin
cp /usr/sbin/loadsave_settings /Alt-F/usr/sbin/loadsave_settings


edit /Alt-F/usr/sbin/loadsave_settings and fix the error

aufs.sh -r

You then need to go into the web panel and save your changes (the save to flash memory option under system settings)

THIS WOULD NOT WORK FOR ME FOR /etc/httpd.conf specifically for some reason. it kept getting overwritten (but not completely?) so I’m guessing Alt-F was updating it on reboot after the file overlay. The above worked for me for modifying smb.conf though (you can also do this though the web panel and SWAT – although I didn’t try this)

I ended up modifying the bootscript file. You can tell it where this is in the web panel (services/user). Edit in the web panel directly I suggest. On reboot, after 30 secs or so my httpd config was implemented.

My bootscript file is in /mnt/sda2/bootscript.sh (the same place that has the /Alt-f files )

#!/bin/sh

# Script to execute as the root user at boot time.
# You can loose your data or make the system inaccessible
# if using the wrong commands. You have been warned!

exec >> /var/log/user.log 2>&1

case "$1" in
    start)
 echo "Starting $0"
 ;;
    stop)
 echo "Stopping $0"
 ;;
esac

grep -qxF "A:192.168.2.0/255.255.255.0" /etc/httpd.conf || echo "A:192.168.2.0/255.255.255.0" >> /etc/httpd.conf

Notes

  • By default, the web admin panel and samba are not available across subnets, (in the web you’ll just get a “403 Forbidden” error). You have to use the overlay file system changes or modify the /etc/httpd.conf and /etc/samba/smb.conf files with the bootscript.
  • By default you need to create a user, and then you can log in with SSH with this user. The web password is admin (to begin with) so change it obviously. When in SSH you can su to root, with the password admin.. then change it with passwd straight away.

http.conf default file

$ cat /etc/httpd.conf

A:127.0.0.1	#!# Allow local loopback connections
D:*		#!# Deny from other IP connections
A:192.168.1.0/255.255.255.0 #!# Allow local net
#port=80 #!# keep commented!

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment