How to “kick off” running connection

Hi, please, I have a question:

can I cut and kick off already connected client from commandline? I can use the firewall rules and time restriction for new connection. But I need to quit runnig connection - like whatsup call and similiar
And I need to do it with cron (children on YouTube, whatsup during the night and etc... :frowning: )

Can you help me please?

Thank you a lot

you can use iptables for it, and drop (or reject) all traffic to the YT, tiktok etc domains.

Thank you frollic, can you give me an example or link to instructions? I am not so handy in network and firewall

Read here

you should probably make block entries for:

www.youtube.com
m.youtube.com
youtube.com
youtu.be
ytimg.com
googlevideo.com
youtube-ui.l.google.com
ytstatic.l.google.com
youtubei.googleapis.com

That's what I'm blocking in my pihole, and it works.

Thank you, but i need probably something else - i need close all connection from the client - not only FB or YT. I have rules in firewall and they work well for the new connections - but they cannot termnate already running connections

Something like “disconnect” button in luci - but in cron

That's what the examples in the link do ... ?

Sorry, i understood it was only for some websites. I will look at it again

Well yes, you said you wanted it for certain sites, not completely....?

1 Like

So i said it wrong (my english is very bad) - i need close all connections - the simplest is kick the client off the Wi-Fi on concrete time. He is not able to connect again (time restrictions in firewall work well)

then do what vgaetera suggested

but you do realize a phone will swap to the mobile network, and continue ?

... and your english's just fine :wink:

1 Like

Ok, thank You for your advices - they are very useful for the next time. And yes - i know about mobile network, but our children do not have allowed it yet - they are to young :slight_smile:

I will try the vgaetera advice

Thank you a lot

Thank you a lot vgaetera - i will try it tonight

1 Like

Do I need to run the script (reorder rules) just once or every time the restrictions should begin? I'm asking because the script seems to have no lasting effect. Existing connections continue just fine until I run the script again. Then they immediately end - probably because of firewall restart.