Wifi connman: Difference between revisions

From Variscite Wiki
(Created page with "= Managing wifi using connman = ConnMan is a command-line network manager designed for use with embedded devices and fast resolve times. It is modular through a plugin archit...")
 
No edit summary
Line 7: Line 7:
To check if wifi is enabled you can run
To check if wifi is enabled you can run


  # connmanctl technologies
# connmanctl technologies


and check for the line that says Powered: True/False.
and check for the line that says Powered: True/False.
Line 13: Line 13:
To power the wifi on you can run
To power the wifi on you can run


  # connmanctl enable wifi
# connmanctl enable wifi


or if you need to disable it you can run
or if you need to disable it you can run
  # connmanctl disable wifi
# connmanctl disable wifi


== Connecting to an open access point ==
== Connecting to an open access point ==
Line 24: Line 24:
To scan the network connmanctl accepts simple names called technologies. To scan for nearby wifi networks:
To scan the network connmanctl accepts simple names called technologies. To scan for nearby wifi networks:


  # connmanctl scan wifi
# connmanctl scan wifi


To list the available networks found after a scan run (example output):
To list the available networks found after a scan run (example output):


  # connmanctl services
# connmanctl services


  MyNetwork              wifi_dc85de828967_68756773616d_managed_psk
MyNetwork              wifi_dc85de828967_68756773616d_managed_psk
  OtherNET                wifi_dc85de828967_38303944616e69656c73_managed_psk
OtherNET                wifi_dc85de828967_38303944616e69656c73_managed_psk
  AnotherOne              wifi_dc85de828967_3257495245363836_managed_wep
AnotherOne              wifi_dc85de828967_3257495245363836_managed_wep
  FourthNetwork          wifi_dc85de828967_4d7572706879_managed_wep
FourthNetwork          wifi_dc85de828967_4d7572706879_managed_wep
  AnOpenNetwork          wifi_dc85de828967_4d6568657272696e_managed_none
AnOpenNetwork          wifi_dc85de828967_4d6568657272696e_managed_none


Every wifi network is identified by a name composed as
Every wifi network is identified by a name composed as


  wifi_<hashlocal>_<hashremote>_managed_<encrption>
wifi_<hashlocal>_<hashremote>_managed_<encrption>


To connect to an open network, look for wifi networks ending with _managed_none:
To connect to an open network, look for wifi networks ending with _managed_none:


  # connmanctl connect wifi_dc85de828967_4d6568657272696e_managed_none
# connmanctl connect wifi_dc85de828967_4d6568657272696e_managed_none


{{note|Network names can be tab-completed}}
{{note|Network names can be tab-completed}}
Line 48: Line 48:
You should now be connected to the network. Check using ip addr or run
You should now be connected to the network. Check using ip addr or run


  # connmanctl state.
# connmanctl state.


== Connecting to a protected access point ==
== Connecting to a protected access point ==
Line 56: Line 56:
The commands in this section show how to run connmanctl in interactive mode, it is required for running the agent command. To start interactive mode simply type:
The commands in this section show how to run connmanctl in interactive mode, it is required for running the agent command. To start interactive mode simply type:


  # connmanctl
# connmanctl


You then proceed almost as above, first scan for any wifi technologies:
You then proceed almost as above, first scan for any wifi technologies:


  # connmanctl> scan wifi
# connmanctl> scan wifi


To list services:
To list services:


  # connmanctl> services
# connmanctl> services


  MyNetwork              wifi_dc85de828967_68756773616d_managed_psk
MyNetwork              wifi_dc85de828967_68756773616d_managed_psk
  OtherNET                wifi_dc85de828967_38303944616e69656c73_managed_psk
OtherNET                wifi_dc85de828967_38303944616e69656c73_managed_psk
  AnotherOne              wifi_dc85de828967_3257495245363836_managed_wep
AnotherOne              wifi_dc85de828967_3257495245363836_managed_wep
  FourthNetwork          wifi_dc85de828967_4d7572706879_managed_wep
FourthNetwork          wifi_dc85de828967_4d7572706879_managed_wep
  AnOpenNetwork          wifi_dc85de828967_4d6568657272696e_managed_none
AnOpenNetwork          wifi_dc85de828967_4d6568657272696e_managed_none


Now you need to register the agent to handle user requests. The command is:
Now you need to register the agent to handle user requests. The command is:


  # connmanctl> agent on
# connmanctl> agent on


You now need to connect to one of the protected services.
You now need to connect to one of the protected services.
Line 82: Line 82:
If you were connecting to OtherNET in the example above you would type:
If you were connecting to OtherNET in the example above you would type:


  # connmanctl> connect wifi_dc85de828967_38303944616e69656c73_managed_psk
# connmanctl> connect wifi_dc85de828967_38303944616e69656c73_managed_psk


The agent will then ask you to provide any information the daemon needs to complete the connection.
The agent will then ask you to provide any information the daemon needs to complete the connection.
Line 90: Line 90:
The agent will also print additional data about the information it needs as shown in the example below.
The agent will also print additional data about the information it needs as shown in the example below.


  Agent RequestInput wifi_dc85de828967_38303944616e69656c73_managed_psk
Agent RequestInput wifi_dc85de828967_38303944616e69656c73_managed_psk
    Passphrase = [ Type=psk, Requirement=mandatory ]
  Passphrase = [ Type=psk, Requirement=mandatory ]
    Passphrase?
  Passphrase?


Provide the information requested, in this example the passphrase, and then type:
Provide the information requested, in this example the passphrase, and then type:


  # connmanctl> quit
# connmanctl> quit


If the information you provided is correct you should now be connected to the protected access point.
If the information you provided is correct you should now be connected to the protected access point.
Line 110: Line 110:
To view all network profiles run this command from root shell:
To view all network profiles run this command from root shell:


  # cat /var/lib/connman/*/settings
# cat /var/lib/connman/*/settings

Revision as of 02:50, 27 January 2017

Managing wifi using connman

ConnMan is a command-line network manager designed for use with embedded devices and fast resolve times. It is modular through a plugin architecture, but has native dhcp and ntp support.

Enabling and disabling wifi

To check if wifi is enabled you can run

# connmanctl technologies

and check for the line that says Powered: True/False.

To power the wifi on you can run

# connmanctl enable wifi

or if you need to disable it you can run

# connmanctl disable wifi

Connecting to an open access point

The commands in this section show how to run connmanctl in command mode.

To scan the network connmanctl accepts simple names called technologies. To scan for nearby wifi networks:

# connmanctl scan wifi

To list the available networks found after a scan run (example output):

# connmanctl services
MyNetwork               wifi_dc85de828967_68756773616d_managed_psk
OtherNET                wifi_dc85de828967_38303944616e69656c73_managed_psk
AnotherOne              wifi_dc85de828967_3257495245363836_managed_wep
FourthNetwork           wifi_dc85de828967_4d7572706879_managed_wep
AnOpenNetwork           wifi_dc85de828967_4d6568657272696e_managed_none

Every wifi network is identified by a name composed as

wifi_<hashlocal>_<hashremote>_managed_<encrption>

To connect to an open network, look for wifi networks ending with _managed_none:

# connmanctl connect wifi_dc85de828967_4d6568657272696e_managed_none


Network names can be tab-completed

You should now be connected to the network. Check using ip addr or run

# connmanctl state.

Connecting to a protected access point

For protected access points you will need to provide some information to the ConnMan daemon, at the very least a password or a passphrase.

The commands in this section show how to run connmanctl in interactive mode, it is required for running the agent command. To start interactive mode simply type:

# connmanctl

You then proceed almost as above, first scan for any wifi technologies:

# connmanctl> scan wifi

To list services:

# connmanctl> services
MyNetwork               wifi_dc85de828967_68756773616d_managed_psk
OtherNET                wifi_dc85de828967_38303944616e69656c73_managed_psk
AnotherOne              wifi_dc85de828967_3257495245363836_managed_wep
FourthNetwork           wifi_dc85de828967_4d7572706879_managed_wep
AnOpenNetwork           wifi_dc85de828967_4d6568657272696e_managed_none

Now you need to register the agent to handle user requests. The command is:

# connmanctl> agent on

You now need to connect to one of the protected services.

To do this easily, just use tab completion for the wifi_ service.

If you were connecting to OtherNET in the example above you would type:

# connmanctl> connect wifi_dc85de828967_38303944616e69656c73_managed_psk

The agent will then ask you to provide any information the daemon needs to complete the connection.

The information requested will vary depending on the type of network you are connecting to.

The agent will also print additional data about the information it needs as shown in the example below.

Agent RequestInput wifi_dc85de828967_38303944616e69656c73_managed_psk
  Passphrase = [ Type=psk, Requirement=mandatory ]
  Passphrase?

Provide the information requested, in this example the passphrase, and then type:

# connmanctl> quit

If the information you provided is correct you should now be connected to the protected access point.

Settings

Settings and profiles are automatically created for networks the user connects to often.

They contain fields for the passphrase, essid and other information.

Profile settings are stored in directories under /var/lib/connman/ by their service name.

To view all network profiles run this command from root shell:

# cat /var/lib/connman/*/settings