NetworkManager: Difference between revisions
Prabuanand (talk | contribs) (moved networking Prerequisites from introduction to its own section,fixed wiki tags, moved conflict explanation to introduction) |
Prabuanand (talk | contribs) (redone the headings, rephrased some sentence) |
||
Line 11: | Line 11: | ||
Install the basic network management daemon of NetworkManager suite:{{Cmd|# apk add {{Pkg|networkmanager}}}} | Install the basic network management daemon of NetworkManager suite:{{Cmd|# apk add {{Pkg|networkmanager}}}} | ||
Some of the popular NetworkManager user interfaces or front ends available as sub-packages are: | Some of the popular NetworkManager user interfaces or front ends available as sub-packages are: | ||
Line 22: | Line 19: | ||
{{Tip| Refer {{pkg|networkmanager-*}} for the list of all NetworkManager subpackages. [[Install]] the appropriate subpackages based on the required functionalities.}} | {{Tip| Refer {{pkg|networkmanager-*}} for the list of all NetworkManager subpackages. [[Install]] the appropriate subpackages based on the required functionalities.}} | ||
== | == Configuration == | ||
To be able to use NetworkManager with your current user (i.e. non root), you need to add your user to the <code>plugdev</code> group created by NetworkManager: {{Cmd|# adduser <YourUsername> plugdev}} | |||
{{Note|If you are already logged in, you will need to relogin for the new group to take effect.}} | |||
Add the following to the {{path|/etc/NetworkManager/NetworkManager.conf}} file as follows:{{Cat|/etc/NetworkManager/NetworkManager.conf|<nowiki>[main] | |||
dhcp=internal | |||
plugins=ifupdown,keyfile | |||
[ifupdown] | |||
managed=true </nowiki>}} | |||
== | === Permitting all users to use nm-applet === | ||
You can enable all users to edit connections in the Networkmanager gui tool i.e {{ic|nm-applet}} without using [[Polkit]] as follows: | |||
# Create the <code>conf.d</code> directory for networkmanager: {{Cmd|# mkdir -p /etc/NetworkManager/conf.d}} | |||
# Add following content to {{path|/etc/NetworkManager/conf.d/any-user.conf}} so that {{cat|/etc/NetworkManager/conf.d/any-user.conf|[main] | |||
auth-polkit{{=}}false}} | |||
# Restart networkmanager: {{Cmd|# rc-service networkmanager restart}} | |||
== | === Wired networks === | ||
For wired networks the configuration is complete. Proceed to [[#Service configuration|Service configuration]] section. | |||
=== | === Wireless networks === | ||
[ | [[NetworkManager]] supports both wireless daemons i.e [[#iwd_backend|iwd]] and [[#wpa_supplicant_backend|wpa_supplicant]]. Using both daemons simulatenously leads to conflicts. Install the {{Pkg|networkmanager-wifi}} package, so NetworkManager can use the WiFi device plugins to connect and manage wifi:{{Cmd|# apk add {{Pkg|networkmanager-wifi}}}} | ||
==== wpa_supplicant backend ==== | |||
{{Main|Wi-Fi}} | |||
[[Wi-Fi#wpa supplicant|wpa supplicant]] is the default wifi daemon in Alpine Linux. To use it as backend, retain the NetworkManager's configuration file {{Path|/etc/NetworkManager/NetworkManager.conf}} as shown in [[#Configuration|Configuration]] section and add the <code>[device]</code> section alone as follows: {{Cat|/etc/NetworkManager/NetworkManager.conf|<nowiki>... | |||
[device] | [device] | ||
wifi.scan-rand-mac-address=yes | wifi.scan-rand-mac-address=yes | ||
Line 58: | Line 64: | ||
# rc-update del wpa_supplicant boot</nowiki>}} | # rc-update del wpa_supplicant boot</nowiki>}} | ||
=== iwd backend === | ==== iwd backend ==== | ||
{{Main|iwd}} | {{Main|iwd}} | ||
NetworkManager supports wireless networks with [[iwd]] daemon as backend, however, consider [https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues?scope=all&utf8=%E2%9C%93&state=opened&search=iwd existing issues] before using it. | NetworkManager supports wireless networks with [[iwd]] daemon as backend, however, consider [https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues?scope=all&utf8=%E2%9C%93&state=opened&search=iwd existing issues] before using it. | ||
To use [[iwd]] as backend retain the NetworkManager's configuration file {{Path|/etc/NetworkManager/NetworkManager.conf}} as shown in [[# | To use [[iwd]] as backend retain the NetworkManager's configuration file {{Path|/etc/NetworkManager/NetworkManager.conf}} as shown in [[#Configuration|Configuration]] section and add the <code>[device]</code> section alone as follows: {{Cat|/etc/NetworkManager/NetworkManager.conf|... | ||
[device] | [device] | ||
wifi.backend{{=}}iwd | wifi.backend{{=}}iwd | ||
Line 70: | Line 76: | ||
{{Cmd|<noWiki># rc-service iwd start | {{Cmd|<noWiki># rc-service iwd start | ||
# rc-service networkmanager restart</noWiki>}} | # rc-service networkmanager restart</noWiki>}} | ||
=== Service configuration === | |||
To start|stop|restart the {{ic|networkManager}} service, use [[OpenRC]] command:{{Cmd|# rc-service networkmanager start}} | |||
Set the service to autostart on boot:{{Cmd|# rc-update add networkmanager default}} | |||
== VPN support == | == VPN support == | ||
Support for Wireguard and other VPN's like OpenVPN are provided by NetworkManager plugins in the following {{Pkg|networkmanager-openvpn}} subpackage. | |||
== Plasma support == | == Plasma support == | ||
Line 85: | Line 95: | ||
=== nm-applet not authorized to control networking === | === nm-applet not authorized to control networking === | ||
If you get above error message, follow the [[#Permitting all users to use nm-applet|Permitting all users to use nm-applet]] section. | |||
=== device is strictly unmanaged === | |||
If 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", and networks do not appear, ensure that [ifupdown] section is configured in the {{path|/etc/NetworkManager/NetworkManager.conf}} file as explained in [[#Configuration|Configuration]] section. | |||
== See also == | == See also == |
Revision as of 04:45, 15 June 2025
NetworkManager can be used to provide network management services in Alpine Linux. Ensure that only one network management service is running at a time to prevent conflicts between them.
Prerequisites
- The community repository must be enabled.
- Set up eudev. Otherwise your network devices can be listed as (strictly-)unmanaged.
- A non-root user account, is recommended.
- Ensure that network interfaces are configured and tested.
Installation
Install the basic network management daemon of NetworkManager suite:
# apk add networkmanager
Some of the popular NetworkManager user interfaces or front ends available as sub-packages are:
- TUI: networkmanager-tui, (run
nmtui
) - Command line: networkmanager-cli (run
nmcli
) - GUI: plasma-nm for Plasma integration and applet
- GUI: network-manager-applet for a GTK system tray applet
Configuration
To be able to use NetworkManager with your current user (i.e. non root), you need to add your user to the plugdev
group created by NetworkManager:
# adduser <YourUsername> plugdev
Add the following to the /etc/NetworkManager/NetworkManager.conf file as follows:
Contents of /etc/NetworkManager/NetworkManager.conf
Permitting all users to use nm-applet
You can enable all users to edit connections in the Networkmanager gui tool i.e nm-applet
without using Polkit as follows:
- Create the
conf.d
directory for networkmanager:# mkdir -p /etc/NetworkManager/conf.d
- 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 - Restart networkmanager:
# rc-service networkmanager restart
Wired networks
For wired networks the configuration is complete. Proceed to Service configuration section.
Wireless networks
NetworkManager supports both wireless daemons i.e iwd and wpa_supplicant. Using both daemons simulatenously leads to conflicts. Install the networkmanager-wifi package, so NetworkManager can use the WiFi device plugins to connect and manage wifi:
# apk add networkmanager-wifi
wpa_supplicant backend
wpa supplicant is the default wifi daemon in Alpine Linux. To use it as backend, retain the NetworkManager's configuration file /etc/NetworkManager/NetworkManager.conf as shown in Configuration section and add the [device]
section alone as follows:
Contents of /etc/NetworkManager/NetworkManager.conf
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 add the networkmanager
service and disable the networking
and wpa_supplicant
boot services:
# rc-update add networkmanager default # rc-update del networking boot # rc-update del wpa_supplicant boot
iwd backend
NetworkManager supports wireless networks with iwd daemon as backend, however, consider existing issues before using it.
To use iwd as backend retain the NetworkManager's configuration file /etc/NetworkManager/NetworkManager.conf as shown in Configuration section and add the [device]
section alone as follows:
Contents of /etc/NetworkManager/NetworkManager.conf
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
Service configuration
To start|stop|restart the networkManager
service, use OpenRC command:
# rc-service networkmanager start
Set the service to autostart on boot:
# rc-update add networkmanager default
VPN support
Support for Wireguard and other VPN's like OpenVPN are provided by NetworkManager plugins in the following networkmanager-openvpn subpackage.
Plasma support


Troubleshooting
nm-applet not authorized to control networking
If you get above error message, follow the Permitting all users to use nm-applet section.
device is strictly unmanaged
If 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", and networks do not appear, ensure that [ifupdown] section is configured in the /etc/NetworkManager/NetworkManager.conf file as explained in Configuration section.
See also
- Networking - Main page
- wpa_supplicant - Default wifi daemon
- iwd - An alternate wifi daemon