How to determine what type of wifi networks are supported by your driver on Linux
On Linux (specificially Ubuntu) what's the easiest way to determine what types of Wifi protocols your hardware and driver support?
I have a router running DD-WRT that supports broadcasting in both a 2.4Ghz and 5Ghz wifi with network modes of either Mixed, BG-mixed, B-only, G-only, NG-only, N-only.
I have numerous wireless devices running Linux, from Android phones to networks to Macbooks, and I'm finding it difficult to set a configuration that supports everything. Setting it to broadcast both 2.4 and 5 in mixed mode seems to cover all devices, but also puts the most load on my router. So I tried only enabling 2.4 in mixed both, and everything could connect, but overall network performance was slow because there are tons of 2.4 networks in my area, causing lots of congestion.
When I tried enabling only 5Ghz in mixed mode, I found most of my older devices could not longer see the network, even though some of them have connected to 5Ghz networks at other locations. e.g. I have a Macbook that can connect to some 5Ghz networks, and its lspci shows:
03:00.0 Network controller: Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller (rev 01)
but it's completely unable to detect my router's 5GHz network.
On a netbook, running iwconfig wlan0
shows:
IEEE 802.11abg
implying it should be able to access my router's 5 GHz mixed a/n network, but running nmcli dev wifi list
only shows 2.4 GHz networks. Why is this?
Is there some command I can run from the command line that will list all the frequencies and network modes supported by the current wifi driver, so I can find the optimal setting for my wireless router?
Solution 1:
Supported capability on your clients
iw phy
on GNU/Linux should list what you want (and a lot more) about your wireless interfaces, although it's a bit confusing at first sight.
What you're looking for is if your network card works in dual-band mode. You'll then see Band 1:
and Band 2:
section, first one usually for 2.4Ghz and second one for 5Ghz. Under each bands you'll see Bitrates (non-HT):
, listing the supported bitrates for 802.11bg in 2.4Ghz or 802.11a in 5Ghz.
You're also looking for HT20/HT40
under Capabilities:
for each band. It means 802.11n is supported. HT20
is for 20Mhz width channels, HT40
for 40Mhz width.
If you want to know more about 802.11n capabilities, for example number of spatial streams (for MIMO) and supported rates, look at the HT TX/RX MCS rate indexes supported:
line. 0-15
means MCS Indexes from 0 to 15 are supported, ie. it can works in MIMO 2x2 with data rate up to 130 Mb/s in HT20 or 270 Mb/s in HT40. Additionally, if RX HT20 SGI
and/or RX HT40 SGI
is listed under Capabilities:
, it means Short GI (400 ns) is supported so max data rate is 144 Mb/s for HT20 and 300 Mb/s for HT40. See here for a list of MCS Indexes: https://wireless.wiki.kernel.org/en/developers/documentation/ieee80211/802.11n
Frequencies:
list supported frequencies and associated channels. Some may be disabled because either your hardware or software doesn't support it, or because your regulatory domain doesn't allow it. If your WiFi access point broadcast signal on a disabled channel you will not be able to connect. You can see which channels are allowed in your area here: https://en.wikipedia.org/wiki/List_of_WLAN_channels
Additionally you may see VHT Capabilities
and other VHT
related info. It's about 802.11ac, but your access point does not support it (neither the chipset you indicated), so you can ignore it.
Access point configuration
I would really recommend you to keep your WiFi access point configured to broadcast on both 2.4Ghz and 5Ghz. Nowadays, 2.4Ghz is very crowded and is more subject to interferences, when 5Ghz has much less devices using it. Problem is that 5 Ghz is generally supported only on recent or high-end devices whereas 2.4 Ghz is the default band used on WiFi devices. Also 5Ghz signal range is less than 2.4Ghz and more subject to degradation due to obstacles.
Using both bands enables you to have wireless on the most devices (either because they don't support 5Ghz or because the signal is degraded, so they fall back on 2.4Ghz) while having better performances in high-end/recent devices (because they're using the 5Ghz band).
Finally you shouldn't worry about B, G and N on your access point, you should select the mode which provides the three standads (mixed) so that older 802.11g (802.11b devices are very rare nowadays) devices can still connect and newer 802.11n work at full speed. Also only 802.11a and 802.11n work in the 5Ghz band. (there's 802.11ac too but you're not working with it)
Maybe you'll also see a channel setting. Usually leaving it to the default will do the job, your access point should be clever enough to select the best. (and it prevents you from selecting a channel overlapping on others creating even more interferencies)
Link between the two
iw dev
on GNU/Linux will show you how your client and your access point are connected. Ideally it will be in a channel on the 5Ghz band (and allowed in your area) with 40Mhz width.
Solution 2:
@piernov's answer is good, but a simpler but possibly less accurate method I found was to run:
lspci | egrep -i --color 'wifi|wlan|wireless'
which will show something like:
03:00.0 Network controller: Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller (rev 01)
This shows what the hardware theoretically supports. You can then interpret the "802.11[abcgn/]+", where b and g are 2.4 GHz only, a is 5 GHz only, and ac and n are both 2.4 and 5 GHz.
To see what the driver actually supports, run:
iwconfig wlan0
which should show something like:
wlan0 IEEE 802.11bg ESSID:off/any