IP-Forwarding for Synology®-NAS

Scope / Short description

Synology® has a standard setting for its linux kernel, that deactivates IP-Forwarding. This is a good idea for most NAS systems, but if you have a NAS with more than one Ethernet ports and you want to run it as a multihomed host, IP-Forwarding has to be activated.

By now there is no way to do so directly via the configuration website of DSM. That leaves only the three ways via the linux console to activate the IP_Forwarding:

All three methods have the disadvantage that they are not persistent on the Synology-NAS-Systems. The first two methods are lost on reboot. The third one holds until the next system update, because "http://www.huckfeldt.eu/etc/sysctl.conf" may be overwritten by the config-scripts.

My solution is to install a package that switches IP-Forwarding on at system startup. Now IP-Forwarding may be started and stopped as you like via DSMs package manager. At system startup IP-Forwarding will be started by default. If you don't want this you have to deinstall the package. Using this mechanism I did not have to write a configuration dialogue ;-)).

System requirements

Usage

Portability

Downloads

Source-Paket

IPForward_Source.tgz

Binary package for all processors

IPForward-armadaxp-1.0.00.spk
IPForward-noarch-1.0.00.spk

My Start-Stop-Script


#!/bin/sh

if [ -z "$SYNOPKG_PKGNAME" ]; then
	# prior DSM 3.2, start script will be run without environment variable
	#  at boot time, thus we need a workaround to gather name and version info
	PACKAGE_NAME="IPForward"
	PACKAGE_VER=`get_key_value "http://www.huckfeldt.eu/var/packages/${PACKAGE_NAME}/INFO" "version"`
else
	PACKAGE_NAME=$SYNOPKG_PKGNAME
	PACKAGE_VER=$SYNOPKG_PKGVER
fi
PACKAGE_DIR="http://www.huckfeldt.eu/var/packages/${PACKAGE_NAME}"
PRIVATE_LOCATION="${PACKAGE_DIR}/target"

case $1 in
	start)
		echo 1 >/proc/sys/net/ipv4/ip_forward
		exit 0
	;;
	stop)
		echo 0 >/proc/sys/net/ipv4/ip_forward
		exit 0
	;;
	status)
		if [ `cat /proc/sys/net/ipv4/ip_forward` = "1" ]; then
			exit 0
		else
			exit 1
		fi
	;;
esac

exit 0
		

Copyright

Copyright ©2017 Sönke Huckfeldt

This software is free software, distributed under the terms of the GNU General Public License, version 3 or (at your choice) newer. This means that if you want to use this software or parts of the sourcecode in a program that you release or distribute to anyone, the program must be free software and have a GPL-compatible license. If you would like advice on making your license GPL-compatible, contact licensing@gnu.org.

This software is provided in the hope that it may be useful, but without any warranty, see GNU General Public License for further details.

You should have received a copy of the GNU General Public License together with this software. If not please download from http://www.gnu.org/licenses/.

The part of the software created by me is free of third party rights. All used libraries are free software, but the respective licence terms apply. Please notice all details and information on this topic in this file.

/*****************************************************************************
 * IP-Forwarder                                                              *
 *                                                                           *
 *  Copyright ©2017 by Sönke Huckfeldt webmaster (at) huckfeldt.eu           *
 *                                                                           *
 *  Licensed under GNU General Public License 3.0 or later.                  *
 *  Some rights reserved. See this README and COPYING.                       *
 *                                                                           *
 * License http://www.gnu.org/licenses/                                      *
 *****************************************************************************/

Disclaimer

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.