NetworkManager

From Alpine Linux

NetworkManager is the standard Linux network configuration tool suite.

Installation

Networkmanager needs to have udev to be setup properly. Otherwise your network devices can be listed as (strictly-)unmanaged. Setting up eudev on a desktop system is recommended in Alpine Linux. Without a fully functional device manager users will not be able to connect to input devices. The alpine-conf package provides setup-devd script to easily install and setup device managers.

Setup eudev.

# setup-devd udev

For more details and other options see eudev.

Install the basic network management daemon of NetworkManager suite:

# apk add networkmanager

To be able to use NetworkManager with your current user (i.e. not root), you need to add your user to the plugdev group created by NetworkManager :

# adduser <YourUsername> plugdev

Note: you will need to log out for the new group to take effect

Some of the popular NetworkManager user interfaces or front ends available as sub-packages are:

Tip: Refer networkmanager-* for the list of all NetworkManager subpackages. Install the appropriate subpackages based on the required functionalities.

Networkmanager service

Ensure that network interfaces are configured and tested.

Start NetworkManager:

# rc-service networkmanager start

Set the service to autostart on boot:

# rc-update add networkmanager default

Wired networks

If wired networks do not appear or you get an error message like "Could not activate connection: Connection 'Ethernet connection 1' is not available on device eth0 because device is strictly unmanaged", add the following to /etc/NetworkManager/NetworkManager.conf:

Contents of /etc/NetworkManager/NetworkManager.conf

[ifupdown] managed=true

Wireless networks

Install networkmanager-wifi package if you want NetworkManager to connect and manage wifi:

# apk add networkmanager-wifi

NetworkManager supports both wireless daemons i.e iwd and wpa_supplicant. Using both may lead to conflicts.

wpa_supplicant backend

wpa supplicant is the default in Alpine Linux and can be configured to start on system boot.

Note: wpa supplicant might not be required, if it isn't it may be a good idea to have it setup just as a fallback.

Now open /etc/NetworkManager/NetworkManager.conf in a text editor and change it to something like this:

Contents of /etc/NetworkManager/NetworkManager.conf

[main] dhcp=internal plugins=ifupdown,keyfile [ifupdown] managed=true [device] wifi.scan-rand-mac-address=yes wifi.backend=wpa_supplicant
Note: If these options dont work on your system, change them as necessary.

Now you need to stop conflicting services:

# rc-service networking stop

# rc-service wpa_supplicant stop

Now restart NetworkManager:

# rc-service networkmanager restart

Now connect to a network using one of the interfaces configured. If that connects and stays connected with no issues enable the networkmanager service and disable the networking and wpa_supplicant boot services:

# rc-update add networkmanager

# rc-update del networking boot

# rc-update del wpa_supplicant boot

iwd backend

NetworkManager supports wireless networks with iwd as backend, however, consider existing issues before using it.

Using both wireless daemons i.e wpa_supplicant and iwd simultaneously lead to conflicts. Once iwd has been configured, ensure that wpa_supplicant and related services are stopped before continuing. Start the iwd service and restart NetworkManager:

# rc-service iwd start # rc-service networkmanager restart

To use iwd as backend edit NetworkManager's configuration because it still defaults to wpa_supplicant. Edit the file /etc/NetworkManager/NetworkManager.conf and ensure that [device] section appears as follows:

Contents of /etc/NetworkManager/NetworkManager.conf

[device] wifi.backend=iwd wifi.iwd.autoconnect=yes

VPN support

NetworkManager has support for Wireguard and support for other VPN's are provided by plugins in the following subpackage:

Plasma support

Todo: (KDE Plasma Desktop) find out if it is possible to prevent requesting the password for KDE Wallet on login


Todo: (KDE Plasma Desktop) for autoconnect to wifi network on start, it appears that the "all users may connect to this network" option must be selected in settings, as root is not a choice to allow. There are likely better workarounds


Troubleshooting

nm-applet not authorized to control networking

You can enable all users to edit connections without adding polkit.

First, make the conf.d directory for networkmanager:

# mkdir -p /etc/NetworkManager/conf.d

Then, add following content to /etc/NetworkManager/conf.d/any-user.conf so that

Contents of /etc/NetworkManager/conf.d/any-user.conf

[main] auth-polkit=false

Finally, restart networkmanager:

# rc-service networkmanager restart

See also