What's new

How to block a device at the CLI

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

yoggit

Occasional Visitor
Hi guys,

I've been trawling everywhere, but unable to find a way to block a device via the CLI, that is then reflected in the GUI.

I'm trying to regulate my kid's XBox time... After detecting the XBox MAC address on the network, a timer will kick in and once expired I want to block the XBox as though I'd blocked it via the GUI. That way, when he is allowed extra time, I can unblock it (remotely) via the GUI.

I can see that when a device is blocked in the GUI, an iptables entry is created:

Chain FORWARD (policy DROP)
target prot opt source destination
DROP all -- anywhere anywhere MAC B0:BE:76:65:96:C6

and the MAC is appended to an NVRAM variable:

nvram get MULTIFILTER_MAC
admin@RT-AC86U:/jffs/scripts# nvram get MULTIFILTER_MAC
60:6D:C7:5D:D1:24>C0:33:5E:D3:17:54>B0:BE:76:65:96:C6


...but in the GUI it doesn't show as blocked.

Hmm... Seems I can go to the GUI and block (even though it already is) and then unblock, and it seems to behave.

Is there an easier way to block, via the CLI as per the GUI??


Cheers,
Jon
 
If you do ‘nvram show > tempfile’ then block it in the GUI, then ‘nvram show > tempfile2’ and ‘diff tempfile tempfile2’ it may show some other changes?


Sent from my iPhone using Tapatalk
 
Is there an easier way to block, via the CLI as per the GUI??
This may still be relevant

i.e. 5 NVRAM variables are used for Parental Control time periods

Code:
nvram set multifilter_all="1"
nvram set multifilter_macfilter_daytime="T<001720<T<111720<T<221720<T<331720<T<441720<T<551720<T<661720"
nvram set multifilter_devicename="BAD-Device"
nvram set multifilter_enable="1"
nvram set multifilter_mac="BA:DD:BA:DD:BA:DD"
nvram commit
or for a total BLOCK
Code:
nvram set multifilter_all="1"
nvram set multifilter_macfilter_daytime="<"
nvram set multifilter_devicename="BAD-Device"
nvram set multifilter_enable="2"
nvram set multifilter_mac="BA:DD:BA:DD:BA:DD"
nvram commit

The crucial point is that you must issue the 'nvram commit' command after manual manipulation of the NVRAM variables to effect the command line changes in the GUI.
 
This may still be relevant

i.e. 5 NVRAM variables are used for Parental Control time periods

Code:
nvram set multifilter_all="1"
nvram set multifilter_macfilter_daytime="T<001720<T<111720<T<221720<T<331720<T<441720<T<551720<T<661720"
nvram set multifilter_devicename="BAD-Device"
nvram set multifilter_enable="1"
nvram set multifilter_mac="BA:DD:BA:DD:BA:DD"
nvram commit
or for a total BLOCK
Code:
nvram set multifilter_all="1"
nvram set multifilter_macfilter_daytime="<"
nvram set multifilter_devicename="BAD-Device"
nvram set multifilter_enable="2"
nvram set multifilter_mac="BA:DD:BA:DD:BA:DD"
nvram commit

The crucial point is that you must issue the 'nvram commit' command after manual manipulation of the NVRAM variables to effect the command line changes in the GUI.


Awesome! I'll give it a go :)

Thanks for your help. I plan on extending my scripts to limit my kids to X number of hour per day per device access to the Internet... ie. 2 hours of XBox per day!

Cheers
 
Hi,

Sorry to be late to the party. @yoggit: I was trying to the same for my kids (i.e. limiting the number of hours for a particular device), so am actually curious how your script works. Would you mind sharing that script? Specifically I'm interested in the part how you detect/calculate the number of hours that has been spent.

Cheers! Sacha
 

Similar threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top