1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[NEED HELP] Firewall-iptables Script from /jffs/?

Discussion in 'Tomato Firmware' started by bigsilly, Oct 5, 2007.

  1. bigsilly

    bigsilly LI Guru Member

    [HOW-TO]run Firewall-iptables Script from /jffs/ [SOLVED]

    Hi, I'm a new member in here and need help with my problem.

    Need :
    1) Port Forward from TCP&UDP : 6113-6164 to
    - Done by Command line in Tomato SSH

    2) Want to save this Script in JFFS Folder and Load it automatically
    ** This is my problem, I can't do this. PLEASE HELP ME to Solve this Problem**

    I tried :
    1) Enable JFFS2 in administration->JFFS2
    2) Create firewall.sh in /jffs/firewall/firewall.sh
    3) #nvram set rc_firewall=/jffs/firewall/firewall.sh

    When I check in SSH using "#iptables -L FORWARD" or "#iptables -t nat -L" there is nothing in there

    iptables scripts is work fine but I don't know how to put it in /jffs/ and don't know how to call it

    Please help me. I try many search and try to config it since 2 days ago but still not work T_T.

    I also attathed my firewall.sh config to you.
    View attachment FIREWALL.txt

    And My reference is this website

    P.S. I have to do this way because in web gui firewall script doesn't support more than 8kb
    and in port forwarding page cannot add more than 50 rules.
    P.S. Sorry for my stupid English.
  2. mstombs

    mstombs Network Guru Member

    You should put a shebang at the top of the file

    to tell the OS its a bash script

    and then mark the file as executable with

    chmod +x /jffs/firewall/firewall.sh
    I've never used the direct assignment to the nvram variable but you can just put the full path + filename to your file in the existing web screen, and it should work.

    One other problem you may get if you create the file from windows is the line endings can be wrong for unix. If you use notepad2 or notepad++ in association with winscp to edit files on /jffs you don't have this problem.
  3. bigsilly

    bigsilly LI Guru Member

    Thanks for Reply & It WORKS!!! THANKS

    I doing by
    1) make new firewall.sh in notepad2 as you suggested. added #!bin/sh in first line
    2) put chmod +x /jffs/firewall/firewall.sh in init-script page in web gui
    3) put /jffs/firewall/firewall.sh in script-firewall page in web gui

    HERE is My Scripts -> View attachment firewall.sh.zip

    Thanks you for your suggestion, Very BIG THANKS :biggrin:
  4. mstombs

    mstombs Network Guru Member

    Glad it works - I have no idea what your script does!

    You shouldn't need step 2 - the flash file system will remember the file properties - only needs to be done once when the file is created, in fact it may not do anything if init runs before the jffs is mounted.

Share This Page