With Mac OS X and/or Linux (most distributions):
You can use task scheduler cron
to enable/disable network connectivity. There is different ways to do that, at this time we will use utility program calledifconfig
to disable only selected wlan interface. This however is foolproof only if user does not have permissions to bring up network or reboot machine. If restarting is allowed for users you should replace ifconfig
with command than either removes wlan0
from boot scripts or modifies wlan0 configuration files to render interface useless. some keywords: rc
, /etc/hostconfig
, unix init
, linux service
, osx bootup
First you need to know wlan interface name. I will use wlan0
as interface name within this post and you should replace that with your interface name if it's not same. Interface name can be checked with ifconfig
command at terminal (command prompt, console).
Open your crontab file for editing:
crontab -e
Add one line for disabling Wi-Fi adapter wlan0 and another line for enabling it:
30 18 * * * ifconfig wlan0 down
30 5 * * * ifconfig wlan0 up
After saving changes cron runs first line at 18:30 and wlan0 is disabled, second line executes at 5:30 and wlan0 is enabled again.
With Microsoft Windows
you can use scheduled tasks to enable/disable interfaces but first you need to write batch files that really does job for you.
Web is full of netsh
commands to do this, however there is small but: netsh set interface
only works with Windows Server. If you happen to run server os then netsh
is way to go, otherwise continue reading.
First find out network adapter device ID, this can be done from cmd
using Windows Management Interface Console, WMIC:
wmic NIC GET index,name
and output will be somethin similar to:
wmic NIC GET index,name
Index Name
0 WAN Miniport (SSTP)
1 WAN Miniport (IKEv2)
2 WAN Miniport (L2TP)
3 WAN Miniport (PPTP)
4 WAN Miniport (PPPOE)
5 WAN Miniport (IPv6)
6 WAN Miniport (Network Monitor)
7 Intel(R) PRO/1000 MT Desktop-adapter
8 WAN Miniport (IP)
9 Microsoft ISATAP Adapter
10 RAS Async Adapter
11 Teredo Tunneling Pseudo-Interface
Here, I dont care about WAN Miniports or any other pseudo adapters but Intel(R) PRO/1000 MT Desktop-adapter looks like real network device so I will write down index number 7.
After that it is good to test that command really works by running it from command line, if your adapter happens to have some other devid change index=<YourAdapterIndex>
:
### Do not copypaste this code, check index first
wmic path win32_networkadapter where index=7 call disable
Network adapter should be disabled now. Then try to enable it again:
wmic path win32_networkadapter where index=7 call enable
If it works well, then write cmd batch files that can be run through task scheduler:
disable_wlan.cmd
contents:
wmic path win32_networkadapter where index=7 call disable
and enable_wlan.cmd
contents:
wmic path win32_networkadapter where index=7 call enable
11Get one of those AC timers :P – Bob – 2012-05-22T22:58:52.427
all joking aside. a timer plug is the easy option. – Sirex – 2012-05-22T23:26:53.357
"easiest" could mean "simple" (as in just unplug something), or "convenient (but expensive)" (as in get new equipment that has parental controls or at least a WiFi on/off switch). – sawdust – 2012-05-22T23:27:59.650
@Sampo I don't use/have OS X, not do I use Linux much. Can't really help on the software side. – Bob – 2012-05-23T00:02:06.990