6

For debugging purposes, is it possible to disable the 2.4Ghz for wireless connections on Linux (Linux Mint 13 LTS, Cinnamon). I.e. to enforce the network driver to establish connections using the 5Ghz band only? Ideally, I'm looking for some command/parameter which does not require to recompile the kernel. Network card: Intel Corporation Centrino Ultimate-N 6300

I tried setting:

sudo iwconfig wlan0 channel 40

where channel 40 is in the desired 5Ghz range, but this only works once. As soon as the connection is terminated or when I roam from one access point to the other, my network connection falls back to the 2.4 Ghz range.

Example:

  1. Sep  9 18:19:39 wpa_supplicant[1230]: Trying to authenticate with     
     00:1a:1e:88:3b:b1 (SSID='<hidden>' freq=5180 MHz)
     ---Connection is established correctly.
    
  2. Sep  9 18:19:45 NetworkManager[908]: <info> (wlan0): roamed from
       BSSID 00:1A:1E:8A:5B:41 (<hidden>) to 00:1A:1E:88:3B:B1 (<hidden>)
    Sep  9 18:20:16 wpa_supplicant[1230]: Trying to authenticate with
       00:1a:1e:88:3b:a1 (SSID='<hidden>' freq=2412 MHz)
    ---New connection is being established using the wrong frequency.
    
terdon
  • 242,166
  • The obvious answer is to go to the router and turn the 2.4G radio off. It's easy to do on mine.

    It looks like someone actually made a tool to do what you want here though: http://www.mit.edu/people/kolya/wifiassocd/

    You might get lucky. That's all I have.

    – krowe Sep 19 '13 at 00:25

1 Answers1

4

I believe you can do this through the Kernel module directly. Most of the Kernel modules can take parameters that you can either pass in when the driver's loaded or they can be loaded via a configuration file during boot up.

Example (2.6 Kernels)

I have a Fedora 14 system with the following wireless drivers.

$ lsmod |grep iw
iwlagn                209751  0 
iwlcore               195714  1 iwlagn
mac80211              229095  2 iwlagn,iwlcore
cfg80211              134981  3 iwlagn,iwlcore,mac80211

The module we're interested in is the mac80211 one, here's more info about it:

$ modinfo mac80211
filename:       /lib/modules/2.6.35.14-106.fc14.x86_64/kernel/net/mac80211/mac80211.ko
license:        GPL
description:    IEEE 802.11 subsystem
srcversion:     8D64C9A86E6BE7B4C1AF862
depends:        cfg80211
vermagic:       2.6.35.14-106.fc14.x86_64 SMP mod_unload 
parm:           ieee80211_default_rc_algo:Default rate control algorithm for mac80211 to use (charp)
parm:           ieee80211_disable_40mhz_24ghz:Disable 40MHz support in the 2.4GHz band (bool)

You can also use the -p switch to just get a modules parameters:

$ modinfo -p mac80211
ieee80211_disable_40mhz_24ghz:Disable 40MHz support in the 2.4GHz band
ieee80211_default_rc_algo:Default rate control algorithm for mac80211 to use

If you notice the section at the bottom where is specifies parm:, these are the parameters that you can pass into this module to change how it's configured. The option you're interested in is this one: ieee80211_disable_40mhz_24ghz. You can load it with this command to disable it:

$ sudo modprobe mac80211 ieee80211_disable_40mhz_24ghz=1

Unloading & Loading modules

To get to a point where you can do this you need to unload the other modules that depend on this one. You can see the dependency list in the lsmod output above, mainly:

mac80211              229095  2 iwlagn,iwlcore

So we need to uninstall these 2 modules:

$ sudo rmmod iwlagn
$ sudo rmmod iwlcore

Now we can uninstall mac80211:

$ sudo rmmod mac80211

Now we can reload it with the parameter to disable the 2.4GHz feature:

$ sudo modprobe mac80211 ieee80211_disable_40mhz_24ghz=1

Now we can reload the other 2 modules:

$ sudo modprobe iwlagn

It's sufficient to just modprobe the highest driver in the stack, the Kernel will take care to reload any additional modules that it depends on.

$ lsmod | grep iw
iwlagn                209751  0 
iwlcore               195714  1 iwlagn
mac80211              229095  2 iwlagn,iwlcore
cfg80211              134981  3 iwlagn,iwlcore,mac80211

Example (3.x Kernels)

Things changed slightly with the 3.x Linux Kernels. The parameter ieee80211_disable_40mhz_24ghz was moved from the mac80211 module to the cfg80211 module. So all the steps are still relevant except you'll need to substitute in the cfg80211 module where mac80211 was used.

What parameters was a module loaded with?

There isn't a command to do this directly, but some modules expose this information in the /sys/module file system. For example:

$ cat /sys/module/mac80211/parameters/ieee80211_disable_40mhz_24ghz 
Y

References

slm
  • 369,824
  • Shouldn't it be: sudo modprobe mac80211 ieee80211_disable_40mhz_24ghz=1 (notice the 1 instead of the 0)? – Joris Kinable Sep 20 '13 at 20:39
  • @user1903852 - thanks for the catch! Fixed. – slm Sep 20 '13 at 20:55
  • 'Disable 40MHz support in the 2.4GHz band' doesn't disable 2.4GHz, it disables the the double frequency band usage (40MHz instead of the 20MHz default). I don't see how any of these options disable the usage of the 2.4GHz band at all. – gertvdijk Jul 21 '14 at 09:31
  • @gertvdijk I think that if you are broadcasting 40MHz only (not 40 & 20 mix) this might work by essentially disabling the only form of 2.4GHz available. DDWRT has this however, a lot of wireless routers do not have a pure 40 option. Also, this option may need to be set in cfg80211 if ieee80211 is not in use. – mchid Oct 16 '15 at 03:00