× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Betreff: RN104 iptables support

wouterds
Aspirant

RN104 iptables support

Hi,


I recently bought a Netgear ReadyNAS RN104.
Machine is working great.

I have recently installed OpenVPN and I want to be able to route all my traffic through the VPN and for that I need iptables with nat support.
As it appears, the option is by default not available on the latest version of ReadyNASOS (6.1.9 at the moment of writing).

~Wouter # iptables -t nat -A POSTROUTING -o tun+ -j MASQUERADE
iptables v1.4.14: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.


So I did some research and apparently I have to compile the modules myself.
I am familiar with Linux but I'm not an expert.

After a couple of hours of fiddling around I finally succeeded in compiling the modules on my VPS.
However, I'm now stuck on how to enable them on the nas.

I downloaded then, made the symlinks in /lib/modules/`uname -r`, but I when I run modprobe I get for most of the modules errors.

/lib/modules/3.0.101.RN_ARM.1 # modprobe ip_tables
------------------------------------------------------------
/lib/modules/3.0.101.RN_ARM.1 # modprobe iptable_filter
------------------------------------------------------------
/lib/modules/3.0.101.RN_ARM.1 # modprobe iptable_nat
modprobe: can't load module nf_defrag_ipv4 (nf_defrag_ipv4.ko): Invalid argument
------------------------------------------------------------
/lib/modules/3.0.101.RN_ARM.1 # modprobe nf_defrag_ipv4
modprobe: can't load module nf_defrag_ipv4 (nf_defrag_ipv4.ko): Invalid argument
------------------------------------------------------------
/lib/modules/3.0.101.RN_ARM.1 # modprobe ipt_MASQUERADE
modprobe: can't load module nf_defrag_ipv4 (nf_defrag_ipv4.ko): Invalid argument
...
...
etc..
...


Any help is much appreciated.


Cheers,
Wouter
Message 1 of 2
thomasmebes
Tutor

Betreff: RN104 iptables support

Liebe Leser,

ich habe ein ReadyNAS RN 102.

Dem Thema habe ich mich hier angenommen da auch ich gerne ein vollwertiges iptables einsetzen möchte.

Die Anleitung für das CrossCompile System basiert auf ein frisch installiert Debian 8 (Jessie) - 64 Bit.

Viel Spass mit der Anleitung! Ganz unten sind noch Download-Links!



#Arbeitsverzeichnis erstellen und hineinspringen
mkdir -p /usr/src/netgear
cd /usr/src/netgear

#Pakete zum übersetzen des Quellcodes installieren (libc6-i386 benötigen wir nur bei einer nicht 32-Bit-Umgebung)
apt-get install make libncurses5-dev gcc u-boot-tools libc6-i386

#Crosscompile Umgebung downloaden, entpacken und Archiv-Datei löschen
wget "http://heanet.dl.sourceforge.net/project/dsgpl/DSM%205.0%20Tool%20Chains/Marvell%20armada%20370%20Li...
tar -zxf gcc464_glibc215_hard_armada-GPL.tgz
rm gcc464_glibc215_hard_armada-GPL.tgz

#Umgebungsvariable temporär für die Crosscompile Umgebung setzen
export PATH=$PATH:/usr/src/netgear/arm-marvell-linux-gnueabi/bin/


#Sourcen-Verzeichnis anlegen und hinein wechseln
mkdir -p /usr/src/netgear/ReadyNASOS_V6.2.5_WW_src
cd /usr/src/netgear/ReadyNASOS_V6.2.5_WW_src

#ReadyNasOS Sourcen 6.2.5 downloaden
wget http://www.readynas.com/download/GPL/readynasos/6.2.5/ReadyNASOS_V6.2.5_WW_src.zip

#Aus den Sourcen entpacken wir nur das Kernelverzeichnis und löschen danach das Archiv
unzip ReadyNASOS_V6.2.5_WW_src.zip 'linux-3.0.101-0.46/*'
rm ReadyNASOS_V6.2.5_WW_src.zip

#In dieses Verzeichnis installieren wir nachher unsere Module, wir legen es nun an
mkdir -p /usr/src/netgear/kernelModules

#In das Kernel-Source Verzeichnis wechseln
cd /usr/src/netgear/ReadyNASOS_V6.2.5_WW_src/linux-3.0.101-0.46

#Die originale Kernel Konfiguration von Netgear nehmen und die iptables Module aktivieren welche man benötigt
http://www.readynas.com/download/GPL/readynasos/6.2.5/readynas_armada370_defconfig
#oder meine (readynas_rn103_kernel_config_iptables_nat) nehmen, das ist auch die Originale, nur hier sind alle iptables Module bereits aktiviert
https://drive.google.com/uc?id=0B6PbXf80b4b7U05mRW41WTlLbUU&export=download

#Diese Datei packt ihr dann nach (die vorhandene kann überschrieben werden)
/usr/src/netgear/ReadyNASOS_V6.2.5_WW_src/linux-3.0.101-0.46/.config

#Konfiguration einlesen
make oldconfig ARCH=arm

#ggf Module anpassen
make menuconfig ARCH=arm

#Kernel übersetzen
make ARCH=arm

#uImage erstellen
#Den Kernel findet ihr danach hier: /usr/src/netgear/ReadyNASOS_V6.2.5_WW_src/linux-3.0.101-0.46/arch/arm/boot/uImage
make uImage ARCH=arm

#Module compilieren
make modules ARCH=arm

#Module installieren nach /usr/src/netgear/kernelModules
#Und die Module findet ihr danach hier: /usr/src/netgear/kernelModules/lib/modules
make modules_install INSTALL_MOD_PATH=/usr/src/netgear/kernelModules ARCH=arm


#Das Verzeichnis "/lib/modules/3.0.101.RN_ARM.4" auf eurem NAS (bei mir RN102) verschiebt ihr am besten, damit ihr noch ein Backup habt
mv /lib/modules/3.0.101.RN_ARM.4 /lib/modules/3.0.101.RN_ARM.4_BACKUP

#dann holt ihr euch das Verzeichnis "/usr/src/netgear/kernelModules/lib/modules/3.0.101.RN_ARM.4" von eurer CrossCompile Umgebung und schiebt es auf
#das NAS "/lib/modules/3.0.101.RN_ARM.4"

#Zudem müsst ihr euch das uImage ("/usr/src/netgear/ReadyNASOS_V6.2.5_WW_src/linux-3.0.101-0.46/arch/arm/boot/uImage") holen von der CrossCompile Umgebung
#und auf dem NAS nach /tmp/ kopieren


#Nun müsst ihr das uImage auf den Flashspeicher schreiben
#Dazu benötigt ihr noch das Debian-Paket mtd-utils
apt-get install mtd-utils
#Nun flashen wir und löschen dafür das alte
flash_erase /dev/mtd2 0 0
nandwrite -p /dev/mtd2 /tmp/uImage

#Nun starten wir das System neu und hoffen, dass alles gut ging!

Viel Spass damit!

Thomas

pps. Ich hatte einiges Arbeit damit, deshalb verschont mich bitte mit Kommentaren "das hätte man viel besser machen können".
Da kann ich nur sagen "dann machts besser!". Wobei ich nett gemeinte Tipps gerne annehme! 🙂

Und ein kleines Dankeschön für den, dem es half wäre auch super.


Downloads:
Zudem habe ich das was ich kompiliert (Module und uImage) habe auch hochgeladen, ihr könnt es hier downloaden:
https://drive.google.com/folderview?id=0B6PbXf80b4b7WjdQZzFOOS10Tmc&usp=sharing

Falls wer keine Lust, Ahnung oder Zeit hat sich diese CrossCompile Umgebung selbst zu erstellen, kann gerne meine VMware Maschine nutzen:
https://drive.google.com/folderview?id=0B6PbXf80b4b7U0l3TzRRRUxfd00&usp=sharing


Bzw. hier nochmal alles einzeln durchzuklicken:
https://drive.google.com/folderview?id=0B6PbXf80b4b7TjdTQkl2TWs1a2c

Message 2 of 2
Top Contributors
Discussion stats
  • 1 reply
  • 3185 views
  • 0 kudos
  • 2 in conversation
Announcements