Enable / disable wlan

I want my wlan to be disabled at certain times and enabled again at some time.

cron is the tool doing the schedule.

what is the command for disabling and eabling wlan in openwrt?

I managed to disable it with ifconfig wlan0 down but I could not get it up with ifconfig wlan0 up.

Any hint is welcome - many thanks in advance

what does it display when you use “ifconfig wlan0 up”?

try this:

wifi up

wifi down

You’d better change uci settings as well. Also doing a full network restart will fix problems if there is something wrong with network settings.

To turn wifi up:

uci set wireless.@wifi-iface[0].disabled=0; uci commit wireless

/etc/init.d/network restart

Tor turn wifi down:

uci set wireless.@wifi-iface[0].disabled=1; uci commit wireless

/etc/init.d/network restart

Thanks for the hints.

  1. ifconfig wlan0 up –> no message (prompt is just back, no error message either)

  2. I made a test with a cronjob: wifi down, five minutes later: wifi up.

Result: wifi did disappear at the given time and was visible even within the five minutes it was supposed to be off. And it did not propperly come up again after five minutes when “wifi up” was executed. I had to reset the router

Additional problem: how can I access the router when wifi is not working? Port 83 on wan side is for html only, right? Who can I enable/allow ssh on wan?

I had to reset the router using the button.

  1. what do you mean by uci? I just know the linux interface you can reach by ssh. (By the way: how can I get help for commands? There are no man pages. What dialect of linux is it running?)

Thanks, best regards

Forget point 3. about uci…

I better go through openwrt docu :wink:

Just to let you know: it works now with the simples soltution: cronjob with “wifi down” and “wifi up”.

I did first some tests in order to learn how cron is activated and works in this linux.

then a little script like

wifi down
date >> /tmp/cron.log
echo " turn WiFi off" >> /tmp/cron.log

Now my crontab looks like this:

#Monday
0 6 * * 1 ./TurnWifiOn
30 22 * * 1 ./TurnWifiOff
…etc.

 

In oder to learn more about uci I shuld use your commands for disabling / enabling in the script… but as it works now… I 'll let you know when I have more results.

thanks anyway for your help :slight_smile:

good to know. Thanks.