OpenWrt Forum Archive

Topic: Turn wireless radio off?

The content of this topic has been archived on 2 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I want to turn wireless off completely on my Fonera (with Kamikaze 7.09) at night, with a cron job.
I've already tried with "iwconfig ath0 txpower off" but this does not seem to work ...

What would be the correct way to do it?
Thank you in advance.

wifi down

I usually use

wl radio off

Thank you, "wifi [down|up]" did the trick!
I already tried "wl radio off" since that was the way to go for OpenWrt, but in Kamikaze "wl" simply does not exist.

The correct way is to use UCI:

Disable wireless

uci set wireless.wifi0.disabled=1
uci commit wireless && wifi

Enable wireless

uci set wireless.wifi0.disabled=0
uci commit wireless && wifi

The disabled option can have the values 1=disable wireless and 0=enable wireless.

I'm using something similar for a WiFi toogle hotplug script using a button on the router to turn wireless on/off (http://openwrt.ertl-net.net/broadcom/sc … ifiToggle/). This script only works with 2.4 Kernels at the moment.

(Last edited by forum2006 on 28 Oct 2007, 10:24)

wiciu wrote:

Thank you, "wifi [down|up]" did the trick!
I already tried "wl radio off" since that was the way to go for OpenWrt, but in Kamikaze "wl" simply does not exist.

use 'ipkg install wl' ... it's there. smile

forum, your method (verbatim) doesn't work on my WRT54G ... wifi0 is for Atheros, no? ... it's wl0 here.  Other than that, it works.  And I suppose wl won't work on Atheros ... but 'wifi down' seems like the quickest solution.  Unless you want to always have no wireless, in that case I suppse committing it to uci would be better.

(Last edited by qwillio on 28 Oct 2007, 10:51)

I know 'wl radio off' disabled wireless and turned off the radio. Does 'wifi down' or the uci commands above turn off the radio for sure or do they just stop allowing wireless connections? Specifically, I want to insure the radio is not transmitting, and I'm low on space so I don't want to install wl if I don't have to.

I'm paranoid with my newborn 10 feet from the wireless radio. wink

jt

johnnytaco wrote:

I'm paranoid with my newborn 10 feet from the wireless radio. wink

I hope you've radio shielded your baby then, because your baby's getting a lot more microwave radiation coming from other sources you cannot control like cell phone towers, etc.

Thanks for that very helpful reply. </sarcasm>

After some research, here's how to turn the radio off easily without installing any other packages:

wlc radio 0
echo 0 > /proc/diag/led/wlan

Or here's a script I wrote called wlradio that I run with a cron job to turn the radio on/off (start/stop):

#!/bin/sh /etc/rc.common
START=50

start() {
        wlc radio 1
        echo "Radio on"
}

stop() {
        wlc radio 0
        echo 0 > /proc/diag/led/wlan
        echo "Radio off"
}

jt

forum2006 wrote:

The correct way is to use UCI:

Yes. But this way you are writing to flash every time the radio is turned on/off.
If you're not interested in keeping settings after a reboot, other methods work well enough.

I think, may you can try this code:

Turn off wlan:

stopservice nas
wl -i eth1 radio off


Turn on wlan:

stopservice nas
wl -i eth1 radio on
startservice nas

This Code was tested by my DD-WRT, it's work fine!

(Last edited by AppleWolf on 25 Feb 2009, 17:01)

AppleWolf wrote:

This Code was tested by my DD-WRT, it's work fine!

But OpenWrt is NOT DD-WRT...

Thanks for your research JT!
It's been very helpful

Mike

Other method is to use just "wifi down" to shutdown all wifi interfaces and then "wifi" to restart wifi interfaces that are enabled in your wireless config file.

So it is as simple as:
wifi off && sleep 10 && wifi

(Last edited by valentt on 18 Mar 2014, 23:16)

The discussion might have continued from here.