script for enabling and disabling gateway at a specific time

Forums Network Management ZeroShell script for enabling and disabling gateway at a specific time

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #42652

    Here is my problem,

    I have written a script to enable a gateway at a specific time and then disable it at a another specific time of the date.

    In the cron tab , i created a new cron job and then chosen the specific time to run , in the script file i wrote :

    cd ~/kerbynet.cgi/scripts
    ./nb_changegw “06” “gateway_s190” “yes” “1” “” “” “8”

    Still in the log , i get erros,
    iptables command not found
    ip command not found

    I guess it is the path that i am missing, as it seems inside the script of the nb_changegw the iptables command and the ip command can’t be executed and give command not found, any suggestions or is it another way to do this job.

    Thanking you in advance.


    Use the firewall rules to enable a time-based rule in the FORWARD chain.
    Note that if you are using the CaptivePortal feature you should use DROP rules. So you should DROP the traffic in the hours when the traffic is not allowed, NOT the contrary!!

    This is because there is an invisibile last rule called CapPor that send everything trough the captive portal, but if you ALLOW something before the users don’t pass trough captiveportal since rules are hierarchical (first matched -> exit).


    am not using portal captive, still in the firewall chain if i use a rule to enbable or disable the forward chain, I guess when disabling it , the browsing will stop when the request pas through this gateway ,

    As i can understand from your reply, i have to go to the startup/cron tab and create a firewall rule to disable the forward chain through this gateway (IP address) ?? Right ??

    and in case of disabling forward chain through this ip or gateway won’t my users get a timeout page from time to time in their browsers ??


    Sorry for the misunderstanding 🙂

    I got your point, in the firewall rule , i create a rule for the IP range of my gateway and at a specific time i drop the forward chain and so the Gateway will be fault by itself so the browsing will stop and the same for enabling it .

    did I get your point ??


    You should go in the “Firewall” section, choose the “FORWARD” chain (if not already) and add a firewall rule.

    Since you are not using captiveportal, you can put the rule you prefer,


    ALLOW allowed hours
    DROP any


    DROP not allowed hours
    (ALLOW any)

    The second must to be choosed in case of captiveportal.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.