Search This Blog

Friday, 26 September 2014

Add a static route to QNAP NAS

Can't be done via the GUI so you need to use some CLI foo.  You can set a route temporarily via the shell but in order for it to remain persistent you need to edit the startup script.

1 - Connect via ssh to your device
2 - Mount the QNAP Configuration

The name of the actual device to mount depends on your model number. In general for x86-based systems this should be /dev/sdx6. For Marvell ARM based models it should be /dev/mtdblock5 or /dev/mtdblock4.
[~] # mount -t ext2 /dev/sdx6 /tmp/config

2 - Create or adapt

A shell script called “” will be executed by your QNAP storage system on every startup. It might be possible that file currently does not exist so just go ahead and create it with your favorite text editor, or the whatever is installed.
route add -net <subnet> netmask <mask> gw <gw_ip_addr>
3 - Make sure that is executable
In order to be executable during startup, we will have to set the executable flag for “”:
[~] # ls -al /tmp/config/
-rw-r--r--    1 admin    administ       60 May 11 17:43 /tmp/config/*
[~] #
[~] # chmod +x /tmp/config/
[~] #
[~] # ls -al /tmp/config/
-rwxr-xr-x    1 admin    administ       60 May 11 17:43 /tmp/config/*
[~] #
4 - Unmount the config
[~]# Unmount /tmp/config