What are the most reliable wifi commandline tools? iw vs wpa_cli vs nmcli

iwlwifinmcliwifiwpawpa-cli

I am exploring a few low-level tools for connecting to wireless networks, and I found the following tools (with useful documentation/tutorial links):

I cannot seem to find a thorough evaluation of these tools, or of similar tools. Perhaps someone can compare these tools in terms of reliability and user-friendliness? Which one is best for a Linux desktop? A link to an existing article is welcome since I cannot find much through a web-search.

Sorry if this question is too open-ended, but I cannot find a good comparison and I have received mixed reviews from individuals about which tool is the most reliable.


Here is a bit from my experience:

I have been using wpa_cli, and I have been pretty satisfied. It works out of the box on many Linux systems, but it doesn't seem to work when NetworkManager is installed. My main problem is that I now have over 100 wifi networks in my config, and there doesn't seem to be an easy way to add/remove a network by SSID. I have to use the network number that is assigned by wpa_supplicant, and it seems unreasonable to re-number or rearrange the networks. I also have to manually enter the SSID for new networks – perhaps something like tab-completion or a text-based selection menu would be nice. This has burned lots of my time when, for example, the ssid had some trailing whitespace.

Also, I have had issues where I need to manually set a specific configuration like scan_ssid=1 for hidden networks, and key_mgmt=NONE for unencrypted networks. I am worried that some other special case may pop up when connecting to a new wifi network, and I may not have time to peruse the wpa_supplicant.conf for a solution. Thus, user-friendliness is a bit of a challenge with wpa_cli, but maybe there are features of the tool that I am not aware of.

I was advised that nmcli is the most user-friendly and does not sacrifice any reliability, even though it relies on NetworkManager as a dependency. I received another recommendation that iw is best for a Linux desktop since it is built in with all Linux distros, but my impression is that iw does not facilitate managing and automating configurations when there are lots of connections configured. The ArchWiki also says that iw only supports nl80211, but that may not be a realistic concern.

Since I cannot seem to find much comparison across these tools, any insight or references would be appreciated.

Best Answer

IW

The command iw is generally used to configure the wifi devices , it can be used to connect to an open wifi network or to an access point protected by a WEP key.

The limitation : It is not possible to connect to a wifi network protected by a WPA* key.

nmcli

It is a network-manager command line tool to configure the NetworkManager and connecting to a all wifi network , it is a NetworkManger dependency . It is a powerful command line tool but you can connect without it.

wpa_cli

It is a command line tool to interact with the wpa_supplicant allowing you to write the configuration file used by wpa_supplicant (under /etc/wpa_supplicant directory) and connecting to wifi notwork (and more...).

It is a complete tool to manage your wifi connection.

but it doesn't seem to work when NetworkManager is installed.

Right , when the NetworkManager is installed it will start at boot , it will launch the wpa_supplicant.service to connect using the saved networkmanger configuration file, the wpa_cli will try to modify the wpa_supplicant configuration file and connect again which cause the command to fail.

To successfully connect through wpa_cli you should stop the NetworkManager.service.

Related Question