Site Tools


toggle_radio

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
toggle_radio [2023/08/06 20:49] – [Turning on/off radio elements from a script] hogwildtoggle_radio [2023/08/06 21:49] (current) – [Wireless SSID-specific operation] -change "wireless" to "WiFi" hogwild
Line 25: Line 25:
  
  
-===== Wireless chipset (2.4/5GHz) specific operation =====+===== Specific Wireless chipset (2.4/5GHz) operations =====
  
-Modern routers come with or more chipsets, there'usually one 2.4GHz interface and one (or more5GHz inerfaces. In certain case you might want to enable/disable a specific chipset via the command line.+Modern routers come with two or more chipsets/WiFi interfaces. There is usually one 2.4GHz interface and one or more 5GHz interfaces. In certain cases you might want to control a specific chipset via the command line.
  
 Once you've identified the name of the appropriate radio interface (via the [[advanced-wlanvifs|Virtual Wireless]] page): Once you've identified the name of the appropriate radio interface (via the [[advanced-wlanvifs|Virtual Wireless]] page):
Line 33: Line 33:
  \\  \\
  
-{{:pasted:20221127-160308.png}}\\+{{:pasted:20221127-160308.png}}\\  \\
  
-Do not blindly use this table. Your router might be different. For full chipset operation, refer to the "ethX" name reference of the interface. Once you have the correct name, you can check the status of your WiFi interface as follows:+Do not blindly use this table. It is only an example. Router interface names may vary. For full chipset operation, refer to the "ethX" name reference of your interface(s). Once you have the correct names, you can check the status of your WiFi interface as follows:
  
 \\ \\
  
-For example, using "eth1" in my the above example:+For example, using "eth1" in the above example:
  
 **Verify interface state** **Verify interface state**
  
- \\ \\  ''int=eth1''\\ '' [ $(wl -i $int radio | grep -Eo [0-1]$) -eq 1 ] && echo "radio $int is off" || echo "radio $int is on"''+ \\  ''int=eth1''\\ '' [ $(wl -i $int radio | grep -Eo [0-1]$) -eq 1 ] && echo "radio $int is off" || echo "radio $int is on"'' 
 + 
 + \\ 
 + 
 + \\
  
 **Toggle interface state** **Toggle interface state**
  
- \\ \\  ''int=eth1''\\ '' [ $(wl -i $int radio | grep -Eo [0-1]$) -eq 1 ] && wl -i $int radio on || wl -i $int radio off''+\\  ''int=eth1''\\ '' [ $(wl -i $int radio | grep -Eo [0-1]$) -eq 1 ] && wl -i $int radio on || wl -i $int radio off'' 
 + 
 + \\
  
  \\  \\
Line 53: Line 59:
 **Force interface off** **Force interface off**
  
- \\ \\  ''int=eth1''\\ '' wl -i $int radio off''+ \\  ''int=eth1''\\ '' wl -i $int radio off''
  
  \\  \\
  
-**Force interface on**\\  ''int=eth1''\\ '' wl -i $int radio on''+ \\
  
 +**Force interface on**
  
-===== Wireless SSID specific operation =====+ \\ \\  ''int=eth1''\\ '' wl -i $int radio on''
  
-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 [[advanced-wlanvifs|Virtual Wireless]] e.g.\\ 
-{{:pasted:20221127-163344.png}} 
  
-Now let's assume you want to turn off wl1.3 which is associated to SSID "test"\\ +===== WiFi SSID-specific operation =====
-{{:pasted:20221127-162109.png}}+
  
-Let's perform the following:\\+In some cases, you might want to just restrict access to only one specific SSID or change settings specific to only one WiFi interface.
  
-**Toggle**\\+This can be achieved as follows:
  
-''int=wl1.3\\  +First, identify the SSID virtual interface you want to controlThe full list of WiFi interfaces on your router and all its sub-interfaces can be found in the [[advanced-wireless|Virtual Wireless]] menu.
-$(wl -i $int radio grep -Eo [0-1]$) -eq 1 && wl -i $int radio on || wl -i $int radio off''+
  
-**Force Off**\\ +Virtual interfaces are always defined as: ''[ main wireless interface name ] + [.] + [number 0-3]''
-''int=wl1.3\\ +
-wl -i $int radio off''+
  
-**Force On**\\ +For example, on this router, in the Virtual Wireless menu, we can see the  2.4GHz interface named: "wl0.1".
-''int=wl1.3\\ +
-wl -i $int radio on''+
  
-==== Wireless SSID specific operation ====+ \\ \\ {{:pasted:20221127-163344.png}}
  
-Let'say, as it often happens), a specific SSID you have defined is operational on multiple interfaces/sub-interfaces, you can disable the SSID everywhere as follow:\\+ \\ 
 + 
 + \\ 
 + 
 +Now, let'assume you want to control "wl1.3" which is associated to the SSID: "test" 
 + 
 + \\ \\ {{:pasted:20221127-162109.png}} 
 + 
 + \\ 
 + 
 + \\ 
 + 
 +You could perform the following tasks:\\ 
 + 
 +**Toggle interface state**\\ 
 + 
 +''int=wl1.3''\\ '' [ $(wl -i $int radio | grep -Eo [0-1]$-eq 1 ] && wl -i $int radio on || wl -i $int radio off'' 
 + 
 + \\ 
 + 
 + \\ 
 + 
 +**Force Interface Off** 
 + 
 + \\ \\  ''int=wl1.3''\\ '' wl -i $int radio off'' 
 + 
 + \\ 
 + 
 + \\ 
 + 
 +**Force Interface On** 
 + 
 + \\ \\  ''int=wl1.3''\\ '' wl -i $int radio on'' 
 + 
 + \\ 
 + 
 + \\ 
 + 
 + 
 +==== WiFi SSID-specific operation ==== 
 + 
 +Often, a specific defined SSID operates on multiple interfaces/sub-interfaces
 + 
 +You can disable that SSID on all interfaces everywhereas follows:\\ 
 + 
 + \\ 
 + 
 +**Force Off** 
 + 
 + \\ \\  ''SSID=MYCOOLSSID''\\ '' nvram show | grep ssid | grep $SSID | while read line; do wl -i $(echo $line | cut -d"=" -f1 | cut -d_ -f1 ) radio off; done'' 
 + 
 + \\ 
 + 
 + \\ 
 + 
 +**Force On** 
 + 
 + \\ \\  ''SSID=MYCOOLSSID''\\ '' nvram show | grep ssid | grep $SSID | while read line; do wl -i $(echo $line | cut -d"=" -f1 | cut -d_ -f1 ) radio on; done'' 
 + 
 + \\ 
 + 
 + \\ 
 + 
 + \\
  
-**Force Off**\\ 
-''SSID=MYCOOLSSID\\ 
-nvram show | grep ssid | grep $SSID | while read line; do wl -i $(echo $line | cut -d"=" -f1 | cut -d_ -f1 ) radio off; done'' 
  
-**Force On**\\ 
-''SSID=MYCOOLSSID\\ 
-nvram show | grep ssid | grep $SSID | while read line; do wl -i $(echo $line | cut -d"=" -f1 | cut -d_ -f1 ) radio on; done'' 
toggle_radio.1691351364.txt.gz · Last modified: 2023/08/06 20:49 by hogwild