This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
toggle_radio [2022/11/27 16:28] – created rs232 | toggle_radio [2023/08/06 21:32] – [Wireless chipset (2.4/5GHz) specific operation] hogwild | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Turning on/off radio elements from script ====== | + | ====== Turning on/ |
===== Full Wireless operation ===== | ===== Full Wireless operation ===== | ||
- | If you want to enable/ | + | If you want to enable/ |
- | **Toggle**\\ | + | \\ |
- | ''/ | + | |
- | **Force off**\\ | + | **Toggle:** |
- | ''/ | + | |
- | **Force | + | \\ ''/ |
- | ''/ | + | |
+ | | ||
+ | |||
+ | **Force | ||
+ | |||
+ | \\ ''/ | ||
+ | |||
+ | | ||
+ | |||
+ | **Force radio on:** | ||
+ | |||
+ | | ||
===== Wireless chipset (2.4/5GHz) specific operation ===== | ===== Wireless chipset (2.4/5GHz) specific operation ===== | ||
- | Modern routers come with 2 or more chipsets, there' | + | Modern routers come with 2 or more chipsets |
- | {{:pasted: | + | Once you've identified the name of the appropriate radio interface (via the [[advanced-wlanvifs|Virtual Wireless]] page): |
- | Once you have the correct name, you can check the status of your wireless interface as follow: | + | \\ |
- | **Verify**\\ | + | {{: |
- | '' | + | |
- | [ $(wl -i $int radio | grep -Eo [0-1]$) -eq 1 ] && echo "radio $int is off" || echo "radio $int is on"'' | + | |
- | **Toggle**\\ | + | Do not blindly use this table. Router interface names may vary. For full chipset operation, refer to the " |
- | '' | + | |
- | [ $(wl -i $int radio | grep -Eo [0-1]$) -eq 1 ] && wl -i $int radio on || wl -i $int radio off'' | + | |
- | **Force off**\\ | + | \\ |
- | '' | + | |
- | wl -i $int radio off'' | + | |
- | **Force on**\\ | + | For example, using "eth1" in my the above example: |
- | '' | + | |
- | wl -i $int radio on'' | + | |
- | ===== Wireless SSID specific operation ===== | + | **Verify interface state** |
- | 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 | + | |
- | {{: | + | |
- | Now let's assume you want to turn off wl1.3 which is associated to SSID " | + | \\ |
- | {{: | + | |
- | Let's perform the following: | + | \\ |
+ | |||
+ | **Toggle interface state** | ||
+ | |||
+ | \\ '' | ||
+ | |||
+ | \\ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | **Force interface off** | ||
+ | |||
+ | | ||
+ | |||
+ | \\ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | **Force interface on** | ||
+ | |||
+ | \\ \\ '' | ||
+ | |||
+ | |||
+ | ===== Wireless SSID-specific operation ===== | ||
+ | |||
+ | In some cases, you don't want to adjust the radio chipset, just restrict access to only one specific SSID. This can be achieved as follows: | ||
+ | |||
+ | - Identify the SSID virtual interface you want to control. | ||
+ | |||
+ | Remember: virtual interfaces are always defined as [ main wireless interface name ] + [.] + [number 0-3] | ||
+ | |||
+ | so e.g. " | ||
+ | |||
+ | For example: | ||
+ | |||
+ | \\ \\ {{: | ||
+ | |||
+ | \\ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | Now let' | ||
+ | |||
+ | \\ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | Now, we can perform the following: | ||
**Toggle**\\ | **Toggle**\\ | ||
- | '' | + | '' |
- | [ $(wl -i $int radio | grep -Eo [0-1]$) -eq 1 ] && wl -i $int radio on || wl -i $int radio off'' | + | |
+ | \\ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | **Force Off** | ||
+ | |||
+ | \\ \\ '' | ||
+ | |||
+ | \\ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | **Force On** | ||
+ | |||
+ | \\ \\ '' | ||
+ | |||
+ | |||
+ | ==== Wireless SSID specific operation ==== | ||
+ | |||
+ | Let's say, as it often happens), a specific SSID you have defined is operational on multiple interfaces/ | ||
**Force Off**\\ | **Force Off**\\ | ||
- | '' | + | '' |
- | wl -i $int radio off'' | + | nvram show | grep ssid | grep $SSID | while read line; do wl -i $(echo $line | cut -d" |
**Force On**\\ | **Force On**\\ | ||
- | '' | + | '' |
- | wl -i $int radio on'' | + | nvram show | grep ssid | grep $SSID | while read line; do wl -i $(echo $line | cut -d" |