Switching WLAN off by cron

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Author Message
JMC
DD-WRT Novice


Joined: 06 Nov 2006
Posts: 42
Location: Aachen, Cologne, Germany

PostPosted: Thu Jan 13, 2011 16:58    Post subject: Switching WLAN off by cron Reply with quote
Hi,

I searched alot and found some other threads (all years old) but none of it works...

I'm searching a way to switch WLAN / Radio off by cron (or by time in general) on my fonera with Build 14986.

The reason: I'm using this fonera as a "gateway" to my Guest-WLAN on my Fritzbox to get some VMs to the internet without having them in my LAN. But there is no need to have Wlan on all the time - since the WLAN on the Fritz is off for ~10 hours a day...

any way to do this? There is no /usr/sbin/wl on my fon...

Greets
Peter
Sponsor
prdufresne
DD-WRT User


Joined: 19 Dec 2010
Posts: 62

PostPosted: Thu Jan 13, 2011 19:04    Post subject: Reply with quote
Try the following two scripts:

This has some scripting that will help you ID your WLAN interface and shows you how to enable/disable it.

http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Reset_Wireless_Radio

This one shows you how to enable/disable the WIFI using the button on the front.

http://www.dd-wrt.com/wiki/index.php/LED_Scripts#Wifi_Toggle_D-Link_DIR-300


Note that the second script uses ifconfig rather than wl, so it should work for you.

_________________
Running dd-wrt on Linksys E2000, WRT54G2 v1, WRT54G v2.2, and testing SD/MMC on a WRT54G v5
JMC
DD-WRT Novice


Joined: 06 Nov 2006
Posts: 42
Location: Aachen, Cologne, Germany

PostPosted: Thu Jan 13, 2011 19:20    Post subject: Reply with quote
Thanks, but the first script is using "wl" as well... So no luck with this

The second script looks interesting - but wlan is activated back again after some seconds...

So still searching...
prdufresne
DD-WRT User


Joined: 19 Dec 2010
Posts: 62

PostPosted: Thu Jan 13, 2011 19:23    Post subject: Reply with quote
I was suggesting sources for script segments. I don't think you'll find a pre-writtem script that does what you need.

You could modify the firt script (using the button) with the instructions from the second that uses ifconfig rather than wl.

_________________
Running dd-wrt on Linksys E2000, WRT54G2 v1, WRT54G v2.2, and testing SD/MMC on a WRT54G v5
JMC
DD-WRT Novice


Joined: 06 Nov 2006
Posts: 42
Location: Aachen, Cologne, Germany

PostPosted: Thu Jan 13, 2011 19:27    Post subject: Reply with quote
Yes i know what you mean, i allready did this ;)

But the interface is coming back up again even with ath0_net_mode=disabled and gpio disable 2 for the fonera 2100 and ifdown...
fyi2000
DD-WRT Guru


Joined: 04 Apr 2010
Posts: 642

PostPosted: Thu Jan 13, 2011 20:09    Post subject: Reply with quote
For La Fonera:
Code:
*/30 * * * * root if [ -n "`ifconfig ath0 | grep UP`" ]; then if [ -z `wl_atheros assoclist` ]; then if [ -e /tmp/wlan_idle ]; then ifconfig ath0 down; iwconfig ath0 txpower off; gpio disable 2; rm /tmp/wlan_idle; else echo 1 > /tmp/wlan_idle; fi; elif [ -e /tmp/wlan_idle ]; then rm /tmp/wlan_idle; fi; elif [ -e /tmp/wlan_idle ]; then rm /tmp/wlan_idle; fi

DD-WRT Forum :: View topic - wl command "not found"
JMC
DD-WRT Novice


Joined: 06 Nov 2006
Posts: 42
Location: Aachen, Cologne, Germany

PostPosted: Thu Jan 13, 2011 20:26    Post subject: Reply with quote
Hmm - looks very interessting but it's the same problem... radio turns back on some seconds after the script finishes...

Code:
64 bytes from 192.168.179.21: seq=3950 ttl=64 time=2.469 ms
64 bytes from 192.168.179.21: seq=3951 ttl=64 time=2.091 ms
64 bytes from 192.168.179.21: seq=3952 ttl=64 time=2.611 ms
64 bytes from 192.168.179.21: seq=4017 ttl=64 time=16.450 ms
64 bytes from 192.168.179.21: seq=4018 ttl=64 time=3.845 ms
64 bytes from 192.168.179.21: seq=4019 ttl=64 time=3.296 ms


Same effect without gpio disable 2...

Maybe it's cause the fonera is running in bridged mode?
prdufresne
DD-WRT User


Joined: 19 Dec 2010
Posts: 62

PostPosted: Thu Jan 13, 2011 20:29    Post subject: Reply with quote
What happens if you telnet into the router and manually disable the interface with the ifconfig command?

Does it stay disabled?

Sorry I can't duplicate your conditions with my router...

_________________
Running dd-wrt on Linksys E2000, WRT54G2 v1, WRT54G v2.2, and testing SD/MMC on a WRT54G v5
JMC
DD-WRT Novice


Joined: 06 Nov 2006
Posts: 42
Location: Aachen, Cologne, Germany

PostPosted: Thu Jan 13, 2011 20:33    Post subject: Reply with quote
All commands were issued using dropbear... it won't stay disabled, webif or telnet/ssh...

It turns back on Sad
fyi2000
DD-WRT Guru


Joined: 04 Apr 2010
Posts: 642

PostPosted: Fri Jan 14, 2011 6:37    Post subject: Reply with quote
JMC wrote:
Yes i know what you mean, i allready did this ;)

But the interface is coming back up again even with ath0_net_mode=disabled and gpio disable 2 for the fonera 2100 and ifdown...

"ath0_net_mode=disabled" takes effect on nvram commit and reboot. GPIO only controls LED.
Code:
ifconfig ath0 down

JMC wrote:
It turns back on

The script I provided is a cron job.
Check the wireless scheduler.
JMC
DD-WRT Novice


Joined: 06 Nov 2006
Posts: 42
Location: Aachen, Cologne, Germany

PostPosted: Fri Jan 14, 2011 9:34    Post subject: Reply with quote
I know it's a cron - but:
- using it as a cronjob the wlan interface turns back on after some seconds
- using only the script it turns back on after some seconds
- using the script through the webgui it turns back on after some seconds

There is no wireless scheduler available on the webgui - otherwise i wouldn't ask Wink
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum