How to reset counter (firewall ) with crontab

hello, how to reset counter in firewall with crontab

i would like reset every hour


echo '0 * * * * /usr/sbin/iptables -Z' >> /etc/crontabs/root
echo '0 * * * * /usr/sbin/ip6tables -Z' >> /etc/crontabs/root

thanks so much :wink: i will try

he dosent work

Capture d’écran 2021-06-17 à 18.04.50

iirc if it was empty before your mod you will need to:

/etc/init.d/cron restart
1 Like

ok in startup so ?

uhm, not sure what that means, but I guess you wait until the top of the hour, or change that first parameter to ...

yes i would like the iptables et all in firewall restart to zero

like if restart firewall

i have restart cron in menu luci gui to cron restart

Did you enter those lines via LuCI? In this case you need to remove the echo ' and the ' >> /etc/crontabs/root part.

In LuCI you just need to paste:

0 * * * * /usr/sbin/iptables -Z
0 * * * * /usr/sbin/ip6tables -Z

Then wait for the next full hour.

1 Like

yes i have enter with echo i will try withouth echo thanks

ok very well is work for reset counter

so i have a last question i have put in firewall.user a different rules

how to restart too the firewall.rules


maybe like these 0 * * * * /etc/init.d/firewall.user -Z

service firewall restart

1 Like

every each hour ? in crontab ?

if i game in party my connexion will lost or not ?

0 * * * * /service/firewall restart -Z ? :ok_hand: :+1:

thanks for all the last command is good

why do you need to restart the firewall rules every hour?

Connection will be dropped.

I am not sure where did that come from. If you want to restart the firewall in crontab, you'll need to use /etc/init.d/firewall restart .

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.