Site Tools


toggle_radio

This is an old revision of the document!


Turning on/off radio elements from script

Full Wireless operation

If you want to enable/disable WiFi from the command line you can use the system command:

Toggle
/sbin/radio toggle

Force off
/sbin/radio off

Force on
/sbin/radio on

Wireless chipset (2.4/5GHz) specific operation

Modern routers come with 2 or more chipsets, there's usually 1x 2.4GHz and 1x (or more) 5GHz chipset. In some certain case you might want to enable/disable a specifi chipset from the command line. Once you have identified the name of your radio interface (the Virtual Wireless page is a good starting point)

Once you have the correct name, you can check the status of your wireless interface as follow:

Verify
int=eth1
[ $(wl -i $int radio | grep -Eo [0-1]$) -eq 1 ] && echo “radio $int is off” || echo “radio $int is on”

Toggle
int=eth1
[ $(wl -i $int radio | grep -Eo [0-1]$) -eq 1 ] && wl -i $int radio on || wl -i $int radio off

Force off
int=eth1
wl -i $int radio off

Force on
int=eth1
wl -i $int radio on

Wireless SSID specific operation

There might be cases where you don't want to affect the full radio chipset but rather restrict access to a specific SSID. This is achieved as follow: - Identify the SSID virtual interface you want to affect. Remember virtual interfaces are always defined as [ main wireless interface name ] + [.] + [a number 0-3] so e.g. “wl0.1”. The full list of wireless interfaces available on your router and the all their sub-interfaces once again can be found under Virtual Wireless e.g.

Now let's assume you want to turn off wl1.3 which is associated to SSID “test”

Let's perform the following:

Toggle

int=wl1.3
[ $(wl -i $int radio | grep -Eo [0-1]$) -eq 1 ] && wl -i $int radio on || wl -i $int radio off

Force Off
int=wl1.3
wl -i $int radio off

Force On
int=wl1.3
wl -i $int radio on

toggle_radio.1669566526.txt.gz · Last modified: 2022/11/27 16:28 by rs232