Wifi connman
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
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.
Static IP Address
To use static IP address, run the following command after establishing a successful connection to AP
# connmanctl> config <service> --ipv4 manual <ip address> <netmask> <gateway>
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