Arch/labwc Environment Network Related Settings
When installing Arch, if no network cable is plugged in, archinstall will prompt you to use iwd The relevant suite connects to a wireless network, meeting the most basic network needs.
This article records my commonly used network settings, mainly including configurations for NetworkManager, iwd, Dnsmasq, and Waybar.
1. Installing NetworkManager, dnsmasq, and iwd
1sudo pacman -S networkmanager dnsmasq iwd
Choose NetworkManager. It's powerful and can meet most network-related needs. It's pre-installed on most desktop environments, and its built-in tools like nmcli and nmtui are also very useful.
Dnsmasq is very practical in small networks, such as home networks.
iwd has lightweight dependencies and is reliable.
1sudo pacman -S networkmanager dnsmasq iwd
Choose NetworkManager. It's powerful and can meet most network-related needs. It's pre-installed in most desktop environments, and its built-in tools like nmcli and nmtui are also very useful.
2. Configuration Files
Enabling dnsmasq in NetworkManager
1
2➜ ~ cat /etc/NetworkManager/conf.d/dns.conf
3[main]
4dns=dnsmasq
Setting up dnsmasq caching
1➜ ~ cat /etc/NetworkManager/dnsmasq.d/custom-cache.conf
2cache-size=4096
cache-size means the maximum number of DNS query results it caches in memory.
-c, --cache-size=
Set the size of dnsmasq's cache. The default is 150 names. Setting the cache size to zero disables caching. Note: huge cache size impacts performance.
Although systemd-resolved also provides similar functionality, Dnsmasq also allows for custom domains, ad blocking, etc. Additionally, systemd is too complex, feeling like it tries to manage everything.
Custom Domains
The example shows that automatic proxy and router each define a domain name, which is easier to remember.
1➜ ~ cat /etc/NetworkManager/dnsmasq.d/custom-domain.conf
2address=/proxy.local/192.168.1.5
3address=/route.local/192.168.124.1
Upstream DNS Settings
In actual testing, Shanghai Telecom DNS experienced packet loss at times, and Tencent DNS had high latency at times. Finally, Alibaba Cloud was chosen.
Everyone's network conditions are different; test and choose one that suits your needs.
1
2➜ ~ cat /etc/NetworkManager/dnsmasq.d/upstream-dns.conf
3# aliyun
4server=223.5.5.5
5server=223.6.6.6
6
7# cf
8server=1.1.1.1
9
10# Optimize parameters (optional, improves resolution efficiency)
11strict-order # Strictly use upstream DNS in the configured order (try the first one, if it fails, try the second one)
12
13no-poll # Disable DNS round-robin, reduce resource consumption
14
15proxy-dnssec # Forward DNSSEC requests (improves resolution security)
Of course, you can also set up ad blocking, etc. I understand that frequently visited websites generally don't have ads.
Enable iwd as a WiFi backend
1➜ ~ cat /etc/NetworkManager/conf.d/wifi_backend.conf
2[device]
3wifi.backend=iwd
4wifi.iwd.autoconnect=yes
iwd has very few dependencies (see the "Depends On" section below 👇), only requiring the kernel and C libraries.
1➜ ~ sudo pacman -Qi iwd
2Name: iwd
3Version: 3.10-1
4Description: Internet Wireless Daemon
5Architecture: x86_64
6URL: https://git.kernel.org/cgit/network/wireless/iwd.git/
7Licenses: LGPL-2.1-or-later
8Groups: None
9Provides: None
10Depends On: glibc readline libreadline.so=8-64 ell gcc-libs
11Optional Deps: qrencode: for displaying QR code after DPP is started [installed]
12Required By: None
13Optional For : networkmanager
14Conflicts With : None
15Replacements: None
16Installed Size: 2.18 MiB
17Packager: Andreas Radke <andyrtr@archlinux.org>
18Build Date: Fri 26 Sep 2025 01:46:26 PM CST
19Install Date: Tue 09 Dec 2025 05:06:33 PM CST
20Install Reason: Explicitly installed
21Install Script: No
22Validated By: Signature
You can check out the official wiki: [https://archive.kernel.org/oldwiki/iwd.wiki.kernel.org/]
The result is a self-contained environment that only depends on the Linux Kernel and the runtime C library.
iwd Architecture Diagram
The mini PC comes with an Intel network card. iwd is written by Intel for Linux. I even bought Intel stock, betting that America would save the toothpaste factory.
1➜ ~ lspci | grep -i network
202:00.0 Network controller: Intel Corporation Wi-Fi 6 AX200 (rev 1a)
This configuration should be sufficient for daily network needs.
3. Waybar Network-Related Configuration
If you like my old configuration, I suggest referring to the repository: https://github.com/kmephistoh/dotfiles
The configuration is located in the config/waybar directory and can be reused directly.
1"network":{
2 "format": "{icon}{essid}{signalStrength}%",
3 "format-wifi": "{ifname}{ipaddr}/{cidr}{signalStrength}%",
4 "format-ethernet": "{ipaddr}",
5 "format-disconnected": " disconnected",
6 "tooltip-format": "{ifname}:{ipaddr}/{cidr}via{gwaddr}",
7 "interval": 5
8},
Remember to install the nerd font, otherwise the icon will show as a square:
1sudo pacman -S ttf-jetbrains-mono-nerd
Waybar screenshot:
You can see the network card name, IP information, wireless network signal strength, etc., and of course, the SSID is displayed. That's possible; you can simply change the configuration.
4. Other
Following the above configuration, if you're observant enough, you might have some questions 🤔:
1➜ ~ ps aux |grep dnsmasq
2nobody 786 0.0 0.0 14900 7680 ? S 19:05 0:00 /usr/bin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/run/NetworkManager/dnsmasq.pid --listen-address=127.0.0.1 --cache-size=400 --clear-on-reload --conf-file=/dev/null --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d
I clearly wrote... Why does the startup parameter still show --cache-size=400 even though cache-size=4096? How can I confirm that the current cache-size is effective?
Actually, it is effective. The verification method is to send a SIGUSR1 signal to the dnsmasq process. When dnsmasq receives the SIGUSR1 signal, it will write the statistics to the system log.
Here's an example: First, use the pgrep command to find the PID, then use the kill command to send a signal (note that you should also open the logs and check journalctl -u NetworkManager -f).
1➜ ~ pgrep dnsmasq
2786
3➜ ~ sudo kill -USR1 786
Simultaneously check the log output:
1➜ ~ journalctl -u NetworkManager -f
2Dec 23 19:29:54 minipc dnsmasq[786]: time 1766488194
3Dec 23 19:29:54 minipc dnsmasq[786]: cache size 4096, 0/298 cache insertions re-used unexpired cache entries.
4Dec 23 19:29:54 minipc dnsmasq[786]: queries forwarded 126, queries answered loccasionally 81
5Dec 23 19:29:54 minipc dnsmasq[786]: queries for authoritative zones 0
6Dec 23 19:29:54 minipc dnsmasq[786]: DNSSEC per-query subqueries HWM 0
7Dec 23 19:29:54 minipc dnsmasq[786]: DNSSEC per-query crypto work HWM 0
8Dec 23 19:29:54 minipc dnsmasq[786]: DNSSEC per-RRSet signature fails HWM 0
9Dec 23 19:29:54 minipc dnsmasq[786]: pool memory in use 720, max 1776, allocated 2400
10Dec 23 19:29:54 minipc dnsmasq[786]: child processes for TCP requests: in use 0, highest since last SIGUSR1 0, max allowed 20.
11Dec 23 19:29:54 minipc dnsmasq[786]: server 223.5.5.5#53: queries sent 126, retried 0, failed 0, nxdomain replies 0, avg. latency 21ms
12Dec 23 19:29:54 minipc dnsmasq[786]: server 223.6.6.6#53: queries sent 0, retried 0, failed 0, nxdomain replies 0, avg. latency 0ms
13Dec 23 19:29:54 minipc dnsmasq[786]: server 1.1.1.1#53: queries sent 0, retried 0, failed 0, nxdomain replies 0, avg. latency 0ms
14Dec 23 19:29:54 minipc dnsmasq[786]: server 192.168.124.1#53: queries sent 0, retried 0, failed 0, nxdomain replies 0, avg. latency 0ms
The log output above includes cache size 4096, 0/298 cache insertions re-used unexpired cache entries., indicating that 4096 is indeed currently in effect.
If the computer or router is not turned off for a long time, DNS caching can still speed up network access.
Finally, what if the network disconnects?
First, I rarely experience disconnections at home. If I do disconnect, in the LabWC environment, I prefer command-line operation.
-
Command line:
nmcli device wifi connect ssid password your_wifi_password -
tui:
nmtui-connectFollow the on-screen instructions; it's very simple.
You can also use the automated command-line tools iwctl and iwd.
1iwctl # Enter the wireless tool
2device list # Check the wireless network card name (e.g., wlan0)
3station wlan0 scan # Scan for WiFi
4station wlan0 get-networks # List WiFi networks
5station wlan0 connect "WiFi name" # Enter the password to connect
6exit # Exit the tool
7ping archlinux.org # Verify network connection
I recommend using nmtui-connect, since nobody wants to remember such long commands. Of course, there are also various GUI options available with NetworkManager.
Since you're already using a window manager, I don't see the need for it.
Generally speaking, Linux systems automatically save WiFi network connection information in configuration files, and the system will automatically connect at boot, with a very low probability of disconnection.
Onboard wireless network cards may experience issues in summer when heat dissipation is poor.
Copyright statement:
- All content that is not sourced is original., please do not reprint without authorization (because the typesetting is often disordered after reprinting, the content is uncontrollable, and cannot be continuously updated, etc.);
- For non-profit purposes, to deduce any content of this blog, please give the relevant webpage address of this site in the form of 'source of original text' or 'reference link' (for the convenience of readers).
See Also:
- Window manager labwc usage notes
- Rime Adds Dota 2 Dictionary
- Recommended Clipboard Management Tool: Clipcat
- WeChat Mini Program Development Notes
- Solve the problem that VSCode cannot input Chinese under Arch
- Mini console assembly notes
- Labwc replaces customized skin
- Greetd and greetd tutorial
- My Toolbox
- Labwc Convenient Configuration