OpenWrt Forum Archive

Topic: Turning off WiFi

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

Hello!

I just got a La Fonera Wifi router and would like to use it now. I'd now like to turn off the WiFi on my WRT54GS running OpenWRT, so that it works best (no interference). But I'd still like to use the WRT54GS as my DSL router.

Some questions:

1) Do I actually need to do that? smile
2) If so, how do I do that? I'd like that it doesn't transmit any data at all anymore.

Thanks a lot,
Alexander

(Last edited by ASkwar on 27 Nov 2006, 18:49)

Easiest is to just turn off the radio:

# nvram set wl0_radio=0
# nvram commit
# wifi

Reverse the procedure by reentering these commands, substituting wl0_radio=1.

When I type in "wifi" after turning it off, the power light goes crazy.  Why is this?

Cyberian75 wrote:

When I type in "wifi" after turning it off, the power light goes crazy.  Why is this?

It's normal.

wifi up

instead wifi alone, isn't it ?

Is there another way to turn WI-FI on/off?  I want to schedule it using Cron.

nvram commit isn't necassery (and deprecated) if you use Cron

#Turn off Wifi
killall wifi
nvram set wl0_radio=0
wifi up
#Wait 5 seconds
sleep 5
#Turn on Wifi
killall wifi
nvram set wl0_radio=1
wifi up

Thanks, but turning wifi off seems to make the power light go crazy.

Indeed. I don't know why power light blink but wifi is really off and all other functions works ...
Wait for an expert ^^

I would do it this way for disabling the radio:
ifdown wifi; killall nas >/dev/null 2>&1; sleep 1; nvram set wl0_radio=0; wifi
and for enabling it again:
nvram set wl0_radio=1; wifi; ifup wifi; [ -f /etc/init.d/S41wpa ] && /etc/init.d/S41wpa

I think that it is a cleaner way but maybe i am wrong.

BTW: wifi is a simple wrapper that reads the the nvram values and sends them to the driver (no command line parameters necessary).

I don't know why, but when I turn wifi off via CLI, the power light goes crazy.

(Last edited by Cyberian75 on 7 May 2007, 21:38)

The power light thing is just cosmetic.

you can disable the flashing power light by using /proc/diag/led I think?  Not sure the exact path...

Good topic, that's what I was looking for.. 8-) Thanks!

Concerning the flashing power LED, see: http://wiki.openwrt.org/wrtLEDCodes
On my WRT54GS v1.1 running Whiterussian 0.9,

echo 1 > /proc/diag/led/power

worked fine (that is, the power LED is always on now).

Also, this FAQ entry may be interesting: What does /sbin/wifi do?

(Last edited by wrtpilot on 15 May 2007, 15:03)

I've written a simple script for this...

#!/bin/sh
#
# Turns WI-FI on/off.  Used with crond.

case "$1" in
    on)
        if [ $(nvram get wl0_radio) = 0 ]; then
        {
            nvram set wl0_radio=1
            nvram set wl0_akm="psk psk2"
            sleep 1
            wifi
            ifup wifi
            /etc/init.d/S41wpa
        }
        fi
    ;;
    off)
        if [ $(nvram get wl0_radio) = 1 ]; then
        {
            ifdown wifi
            killall nas >/dev/null 2>&1
            sleep 1
            nvram set wl0_radio=0
            nvram set wl0_akm="none"
            sleep 1
            wifi
            echo 1 > /proc/diag/led/power
        }
        fi
    ;;
    *)
        echo $"Usage: $0 {on|off}"
        exit 1
    ;;
esac

(Last edited by Cyberian75 on 12 Jun 2007, 19:42)

btw, you doesn't need to commit change to nvram each time. This will reduce lifetime of chip.
nvram commit is only needed to keep state of wifi status even with a reboot.

Ok, I modified it accordingly.

The discussion might have continued from here.