I decided to switch the network manager from
systemd-networkd on a whim during the night and the switch went smoothly. This article documents the switching process and briefly describes how the combination of
netctl is archlinux’s own son, upstream at https://git.archlinux.org/netctl.git/, and is the only network management tool other than
systemd-networkd to access the base group. netcl relies on dhcpcd or dhclient It relies on dhcpcd or dhclient to obtain dynamic IP addresses,
wpa_supplicant to access encrypted WiFi, and
wifi-menu to interactively select hotspots and enter passwords from the command line. A series of systemd service files (
netctl-auto@.service) are also provided to help users configure, e.g. after enabling
netctl-auto@< interface>.service, your NIC can be automatically switched in the optional profile.
As its name implies, this is a member of the systemd family. It is primarily responsible for detecting and configuring network devices, and in particular it can be used to configure the network of containers started by
iwd (iNet wireless daemon) is a WiFi backend developed by Intel to replace
wpa_supplicant. Its main goal is to optimize resource utilization by not relying on any external libraries but by maximizing the functionality provided by the Linux kernel. iwd works well with systemd-network.
Usage Scenario Introduction
I don’t need to switch/add/modify/delete Wi-Fi configuration frequently, so I don’t need a service that is resident in the notification area to switch. Also, my VPN is already fully managed through systemd, so I don’t need a network management tool to do that for me. What I need is a combination of tools: one for managing network devices and one for connecting to WiFi and authenticating. The previous combination was
wpa_supplicant, but now I have a new favorite:
How to use
First you need to disable the services associated with netctl to avoid conflicts between multiple network management tools together.
Configure the network card
Then follow the Wiki instructions to write the configuration for the wireless NIC under
For the wireless NIC, the minimal configuration is as follows.
Matchis mainly used to match the managed devices, which can be selected by device name, MAC address, etc.
Networkis used for network related specific configuration, such as DHCP, DNS, etc.
I have coredns enabled locally as a DNS service, so I need to add some extra configuration to get IPv4 addresses via DHCP, but not use the DNS issued by DHCP.
iwd seems to change the name of the network device when it starts, and my NIC was changed to wlan0.
After the configuration is written, you can start the
If you have changed the network configuration, just restrart it.
For more specific configuration, see ArchWiki or
iwd is not a self-contained package, so you need to install it yourself first.
Before we can start using it, we need to start and enable the iwd service.
Then you can use
iwctl to manage it. iwctl enters an interactive command line interface by default, which is still a great experience.
At this point, entering help will return all supported commands, each command is relatively intuitive, as long as a little understanding of the technical terms related to WiFi can quickly get started, in addition, all commands in this interface support auto-completion, praise.
First of all, let’s see what devices we have.
The interface is dynamic and the
* in the upper right corner will keep flashing to indicate that the interface is live.
We can then manually trigger an STA scan.
After that, you can see what WiFi hotspots are available for connection.
This interface is also dynamic and allows you to check the signal strength of the machines that are currently connected to the network.
Finally, you will be able to select the SSID you want to connect to the network, and if you need to enter a password, iwd will also show a prompt to enter the password.
Here is a point that needs to be raised: after iwd successfully connects to the network through the interactive interface, it automatically generates the corresponding configuration file under
/var/lib/iwd, and then iwd connects automatically. So on the one hand, you don’t need to write the configuration file manually, and on the other hand, the switching process is automatic and does not require manual intervention.
The configuration file name generated by iwd has certain rules, using SSID as the file name, and then using encryption as the suffix, e.g.
*.open means it is an open network, and
*.psk means it is a network using PSK encryption.
Check the status
After all the configurations are done, you can check the status of WiFi and NIC separately.