I want to avoid a flash write/rewrite cycle. I also want the rule to only persist until the next reboot (or when I un-do the rule).
Is it possible to create a fw4 rule (or the equivalent nft rule) to say block a client device on your network from accessing the internet?
Consider a script will let me manually run this - cause all traffic from that device to immediately stop, including existing connections - then wait 30mins - and un-do the block. This will be very useful to say - block a teenager from gaming for 30mins 'on demand' vs. needing to reconfigure a firewall rule each time.
I know I can do this using uci.x rules and committing a firewall change - but this will persist the settings.
There is a way to create and apply rules without writing them to flash, but since you want to immediately break all established connections, you'd better use the nft command-line tool. This will also allow you to apply the rule(s) without restarting/reloading the firewall service.
I suspected nft was the right solution - and wow - you got this exactly right. Thank you. I've tagged your answer as the solution.
I'm wondering how different it would be to instead of blocking all traffic - slap a rate limit on it? Say not enough to reasonably stream youtube, or even browse the web at any speed - but enough to push messages from the machine?
nft appears to have better rate limiting capabilities than iptables - but this stuff is still magic for me.