I need to create a script that disables port forwarding at a specific time. i know it is possible to use crontab to schedule the execution of tasks and scripts, i just don't know how to create the script that disables to a specific port forwarding
I added the time options in the extra arguments field and it seems to work.
root@magiatiko /tmp > iptables-save | grep time
-A zone_wan_prerouting -p tcp -m tcp --dport 5656 -m time --timestart 08:00:00 --timestop 10:00:00 --weekdays Mon --datestop 2038-01-19T03:14:07 -m comment --comment "!fw3: time" -j DNAT --to-destination 10.0.2.3:5656
config redirect
list proto 'tcp'
option src_dport '5656'
option extra '-m time --timestart 08:00:00 --timestop 10:00:00 --weekdays Mon'
option dest_ip '10.0.2.3'
option reflection '0'
option src 'wan'
option name 'time'
option dest 'lan'
option target 'DNAT'
1 Like
Hi @vgaetera.
I couldn't get the traffic rule to work. As an alternative I thought of creating a scheduled task through crontab that disables and enables a specific port forwarding
You should post the firewall config, so we can identify the cause of the problem:
uci show firewall; iptables-save -c
1 Like
Thank you very much. It worked perfectly, amazing. You are incredible!!!!!
1 Like
If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
1 Like
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.