I would like to connect to a wireless example network (lets assume no encryption, in order to make explanations easier) via command-line.

I use to perform this procedure:

$ nmcli con

Example output:

NAME            UUID                                   TYPE              TIME
Wireless-1      28d6c265-xxxx-4e83-907f-ecb5ab3ac37c   802-11-wireless   Thu 
Wired-Network   30d29da3-xxxx-4ea2-94ff-0edac8954ff7   802-3-ethernet    Sun 

So, I try with:

$ nmcli con up uuid 28d6c265-xxxx-4e83-907f-ecb5ab3ac37c

But this method starts DHCP autoconfig, and I would like to manually config my network (for auditing matters), perform netdiscover... etc.

If I shutdown network-manager service, both wireless connection routines and DHCP are disabled.

How could I connect (associate) to a Wireless network without IP autoconfig routines start?

Further data:

  • Command-line methods are preferred. GUI accepted.
  • In my example there is no encryption (WPA nor WEP). I don't know if the procedure depends on this feature.
  • I use to work with Ubuntu 16.04, Kali (recent as for June 2017), Raspbyan, Ubuntu Mate and Mint. If possible, generic answer for most Linux distros are preferred.
  • No need for nmcli explicitly. Any other tool could be used, but GPL open source preferred when possible.
  • 1
    You may need to use nmcli con edit (if your version of nmcli supports it) or nm-connection-editor (gui) and set a static IP address (one that is not going to conflict with a dhcp address on the network). – Joe P Jun 21 '17 at 13:43
  • Does it have to be nmcli? If you connect to an unencrypted Wifi network with iw, there's no auto-dhcp, and if you connect to an encrypted one with wpa_cli, you can configure it in /etc/network/interfaces or a wpa-supplicant config file. – dirkt Jun 21 '17 at 14:52
  • @dirkt : no need for nmcli exactly. Any other tool could be used, but GPL open source preferred when possible. I have edited the original question to reflect. – Sopalajo de Arrierez Jun 22 '17 at 13:50
  • Before NM existed (and during the first few years of its existence when I called it Network Mangler), I used iw to configure wireless. It's still around and should do what you want. – NickD Jun 22 '17 at 14:02
  • Both iw and wpa_cli are open source. In fact, nmcli uses both of them - it's just a layer above. – dirkt Jun 22 '17 at 14:33

Your Answer

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

Browse other questions tagged or ask your own question.