Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


ConnMan

ConnMan is a CLI 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.

Reference(s)

Table of contents


TODO


Install

Very useful optional dependencies to install:

Then, install connman:

# emerge -a net-misc/connman
# pacman -S connman

For Artix users

  • If using openrc:
    # pacman -S cronie connman-openrc
    
  • If using runit:
    # pacman -S cronie connman-runit
    
  • If using s6:
    # pacman -S cronie connman-s6
    
# apt install connman
# yum install connman
# dnf install connman

The previous installation step allow to control connman with connmanctl, but you might want a user interface and not just a cli tool:

Now, add connman to your init manager:

# rc-update add connmand default
# /etc/init.d/connmand start

Depending on your runit implementation, either run:

# ln -s /etc/runit/sv/connmand /service
or run:
# ln -s /etc/runit/sv/connmand /var/service
or run:
# ln -s /etc/runit/sv/connmand /run/runit/service
In any case, finally run:
# sv up connmand

# service connmand start
# chkconfig connmand on
# systemctl enable connmand
# systemctl start connmand

Config

  • If you want to prefer Ethernet over wireless:

    # vi /etc/connman/main.conf
        > ...
        > [General]
        > ...
      ~ > PreferredTechnologies = ethernet,wifi
        > ...
    

  • If you don't want to allow to be connected to both Ethernet and wireless at the same time (in order to have only a single unambiguous connection active at a time):

    # vi /etc/connman/main.conf
        > ...
        > [General]
        > ...
      ~ > SingleConnectedTechnology=true
        > ...
    

  • If you don't want to let connman change the transient host name on a per network basis (which can cause problems with X authority):

    # vi /etc/connman/main.conf
      > ...
      > [General]
      > ...
    ~ > AllowHostnameUpdates=false
      > ...
    

  • If something like Docker is creating virtual interfaces, connman may attempt to connect to one of these instead of your physical adapter if the connection drops. A simple way of avoiding this is to blacklist the interfaces you do not want to use.

    connman will by default blacklist interfaces starting with vmnet, vboxnet, virbr and ifb, so those need to be included in the new blacklist as well. Blacklisting interface names is also useful to avoid a race condition where connman may access eth# or wlan# before systemd/udev can change it to use a Predictable Network Interface Names like enp4s0. Blacklisting the conventional (and unpredictable) interface prefixes makes connman wait until they are renamed.

    # vi /etc/connman/main.conf
      > ...  [General] ...
    ~ > NetworkInterfaceBlacklist=vmnet,vboxnet,virbr,ifb,ve-,vb-,docker,veth,eth,wlan
      > ...
    

Use

  • Shows a list of all technology types existing on the system (e.g. ethernet, wifi, bluetooth...) , their properties and their status:
    $ connmanctl technologies
    

WiFi

  • Enable wifi, note that it powers on to the WiFi, but doesn't connect unless there is a service with auto connect set to True:

    $ connmanctl enable wifi
    

  • Connect to a non password protected WiFi access point:

    $ connmanctl scan wifi && connmanctl services
      > ...
    $ connmanctl connect wifi_dc85de828967_4d6568657272696e_managed_none
    

  • Connect to a password protected WiFi access point:

    $ connmanctl scan wifi && connmanctl services
      > ...
    $ connmanctl # enter interactive mode
      > agent on
      > connect wifi_dc85de828967_38303944616e69656c73_managed_psk
      > exit
    

  • After the first connection, a wifi service is saved in /var/lib/connamn/wifi_*. It's settings can be modified, e.g. the auto connection setting:

    # vi /var/lib/connamn/wifi_.../settings
      > ...
    ~ > AutoConnect=true
      > ...
    

  • Disconnect:

    $ connmanctl disconnect wifi_dc85de828967_38303944616e69656c73_managed_psk
    

  • Note that some WiFi connection points may need additional steps, like for eduroam.

Ethernet

  • Ethernet connections are setup automatically. After the first connection, an ethernet service is saved in /var/lib/connamn/ethernet_*. It's settings can be modified, e.g. the auto connection setting:

    # vi /var/lib/connamn/ethernet_.../settings
      > ...
    ~ > AutoConnect=true
      > ...
    

  • Sometimes, multiple ethernet interfaces are needed with a single ethernet mac address (typically depending on the network you want to connect to). This can be achieved like so:

    $ connmanctl disable ethernet
    $ cd /var/lib/connman
    
    Create two network interfaces:
    $ sudo cp ethernet_00249b2c785a_cable ethernet_00249b2c785a_cable_network_name_1
    $ sudo mv ethernet_00249b2c785a_cable ethernet_00249b2c785a_cable_network_name_2
    
    Change the settings of those network interfaces the way you want:
    $ sudo vi /var/lib/connamn/ethernet_00249b2c785a_cable_network_name_1/settings
      > ...
    $ sudo vi /var/lib/connamn/ethernet_00249b2c785a_cable_network_name_2/settings
      > ...
    
    Select one of those interfaces with a symbolic link:
    $ sudo ln -s ethernet_00249b2c785a_cable_network_name_1 ethernet_00249b2c785a_cable
    $ connmanctl enable ethernet
    

Troubleshooting

Reference(s)

ConnMan dmenu


If this cheat sheet has been useful to you, then please consider leaving a star here.