5

I have a well configured /etc/wpa_supplicant/wpa_supplicant.conf with all my ESSIDs and passwords. I do not have a graphical interface like KDE or Gnome. To switch between available networks, I need to do four commands.

I'm running Debian and would like to have a utility similar to Arch's Linux netctl to manage my connections. What are the options available to Debian?

  • 1
    I've not used it but there is wicd-cli if that corresponds. – meuh Aug 1 '16 at 19:01
3

The two option are wicd-cli (noted in the comment by meuh) and networkmanager. Which to use is matter of personal preference. I use networkmanager just because it has a better manual (but that, again, is matter of preference).

Just like wpa_supplicant stores files in /etc/wpa_supplicant/ one per interface, networkmanager stores files in /etc/NetworkManager/system-connections/ one per SSID. The parameter names for networkmanager are not very different from wpa_supplicant, for example a file in /etc/NetworkManager/system-connections/ may look as follows:

[connection]
id=BluePenguin
uuid=799ce6af-b66c-4669-9319-8d9a029cb6ee
type=wifi

[wifi]
ssid=BluePenguin

[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=******

(This looks similar to network={} in wpa_supplicant)

My experience with networkmanager is on Arch, not Debian, therefore I cannot tell with 100% accuracy on the Debian dependency chain. But, networkmanager does not require Xorg (or GTK, or KDE).

Moreover, the command line tool to networkmanager: nmcli, is very similar in design to iproute2. In essence, as you would do:

ip addr help

to get help for the addr command, you do:

nmcli device wifi help

to get help on all wifi commands for devices. Since I use ip a lot, I find nmcli very intuitive, but then again, that is matter of personal preference.

networkmanager has a built-in DHCP client, but can be configured to use an external one.


As for reducing the number of commands, nmcli will perform the work of disconnecting from one SSID (closing DHCP too) and connect to a new SSID (and start DHCP) with on command (assuming the password is already saved):

nmcli device wifi connect <new SSID>

Or for the lazy typer:

nmcli d w c <new SSID>

References:

  • I'll mark your answer as correct, although networkmanager isn't the exact tool I was hoping to find. But it gets closer. Thanks! – Willian Paixao Nov 9 '16 at 18:52
  • @WillianPaixao - Network managers in linux had a hard time recently when everyone started moving to systemd (but thank god, everyone if there now). Now that the init system stabilized, i believe, there will be new attempts at network management (notably because things like ifup finally died out). I find nmcli pretty intuitive and decent enough to even debug my wifi problems. wicd-cli/wicd-curses (as meuh commented) may be another option but i never used it so I am not entitled to an opinion. – grochmal Nov 9 '16 at 21:31
2

You can manage network from command line through:

1)wpa_cli

I assumes that wpa_supplicant is already running .

type:

nmcli

It will show a prompt similar to this:

wpa_cli v2.3
Copyright (c) 2004-2014, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.


 Selected interface 'wlan0'

Interactive mode

You can scan for the networks using :

scan

and

scan_results

You will get some information : bssid / frequency / signal level / flags / ssid

To connect you need to create a network :

add_network

This will output a number, which is the network ID, e,g: 0

The command add_network will create an empty network, to configure it you need to set the SSID and PSK for the network:

set_network 0 ssid "your_Network_here"
set_network 0 psk "your_secret_passphrase_here"

Enable and save the network and settings:

enable network 0
save_config

Once connected , run the dhclient command to get an IP.

Use q or quit to exit the Interactive mode.

2) Using wpa_supplicant

Create a configuration file /etc/wpa_supplicant.conf throught the command wpa_passphrase:

wpa_passphrase Your_ssid Your_passphrase > /etc/wpa_supplicant.conf

to connect run:

wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
dhclient wlan0
  • wpa_cliis exaclty what I'm currently using, @gad3r. It takes too much "trouble" too switch between networks. Not to mention that the whole wpa_supplicanthas half dozen commands and too many options. But thanks for your answer. – Willian Paixao Nov 9 '16 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.