Wireguard config from KDE not working properly

Hello,

I am trying to setup a wireguard client on a Almalinux 10 KDE v2.

The wireguard configuration is contained in a file named wg0.conf with the following format:


[Interface]

PrivateKey = <private key>

Address = 10.0.1.5

DNS = 192.168.1.1

[Peer]

PublicKey = <public key>

AllowedIPs = 0.0.0.0/0

Endpoint = <ddns name>:51820

PersistentKeepalive = 25

First, I have installed the wireguard-tools package.


sudo dnf install wireguard-tools

then I copied wg0.conf into /etc/wireguard/


sudo cp wg0.conf /etc/wireguard/

then I started wireguad client using:


sudo wg-quick up wg0

[#] ip link add wg0 type wireguard

[#] wg setconf wg0 /dev/fd/63

[#] ip -4 address add 10.0.1.5 dev wg0

[#] ip link set mtu 1420 up dev wg0

[#] resolvconf -a wg0 -m 0 -x

Failed to set DNS configuration: Could not activate remote peer 'org.freedesktop.resolve1': activation request failed: unknown unit

[#] ip link delete dev wg0

to fix the DNS issue, I have started systemd-resolved


sudo systemctl enable --now systemd-resolved

then the wireguard client started correctly


sudo wg-quick up wg0

[#] ip link add wg0 type wireguard

[#] wg setconf wg0 /dev/fd/63

[#] ip -4 address add 10.0.1.5 dev wg0

[#] ip link set mtu 1420 up dev wg0

[#] resolvconf -a wg0 -m 0 -x

[#] wg set wg0 fwmark 51820

[#] ip -4 route add 0.0.0.0/0 dev wg0 table 51820

[#] ip -4 rule add not fwmark 51820 table 51820

[#] ip -4 rule add table main suppress_prefixlength 0

[#] sysctl -q net.ipv4.conf.all.src_valid_mark=1

[#] nft -f /dev/fd/63

and browsng the Internet was fine.

But when instead of using wg-quick, I am importing the configuration into NetworkManager via cli


nmcli connection import type wireguard file wg0.conf

A message indicating the connection is successful but it is not possible to browse the Internet.

I have tried the same config via KDE on other distribution and it is working fine.

What is the problem here? How can I configure wireguard via KDE on Almalinux?

Thanks

Hi @vivi!

On AlmaLinux 10, NetworkManager does not use systemd-resolved by default for DNS, even if you have started it. When you use wg-quick, it manually puts the DNS in /etc/resolv.conf (via resolvconf). But when you import via nmcli, NetworkManager tries to use its own DNS system (which is disconnected from systemd-resolved), and on AlmaLinux 10 it is set to not use systemd-resolved at all. That’s why you lost your internet connection – DNS wasn’t working, even though the tunnel was OK.

sudo nano /etc/NetworkManager/NetworkManager.conf
[main]
dns=systemd-resolved

Why? This tells NetworkManager to send all DNS requests to systemd-resolved (which is already running and knows how to handle DNS from wg0.conf).

sudo systemctl restart NetworkManager

nmcli connection delete wg0
nmcli connection import type wireguard file /etc/wireguard/wg0.conf

resolvectl status wg0

All the best! :v:

Thanks for the proposition.
Unfortunately, after entering all commands and configuration, there is still no connection to the Internet.

Something I noticed in logs when activating wg0 from NetworkManager GUI is:

sudo systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; preset: disabled)
     Active: active (running) since Tue 2025-09-02 19:33:20 CEST; 21min ago
 Invocation: ab253ace88d940f5af6681eed35b3437
       Docs: man:systemd-resolved.service(8)
             man:org.freedesktop.resolve1(5)
             https://systemd.io/WRITING_NETWORK_CONFIGURATION_MANAGERS
             https://systemd.io/WRITING_RESOLVER_CLIENTS
   Main PID: 715 (systemd-resolve)
     Status: "Processing requests..."
      Tasks: 1 (limit: 10679)
     Memory: 2.5M (peak: 6.7M, swap: 2M, swap peak: 2M)
        CPU: 217ms
     CGroup: /system.slice/systemd-resolved.service
             └─715 /usr/lib/systemd/systemd-resolved

Sep 02 19:52:50 localhost.localdomain systemd-resolved[715]: Using degraded feature set UDP instead of TCP for DNS server 192.168.1.1.
Sep 02 19:52:55 localhost.localdomain systemd-resolved[715]: Using degraded feature set TCP instead of UDP for DNS server 192.168.1.1.
Sep 02 19:53:26 localhost.localdomain systemd-resolved[715]: Using degraded feature set UDP instead of TCP for DNS server 192.168.1.1.
Sep 02 19:53:31 localhost.localdomain systemd-resolved[715]: Using degraded feature set TCP instead of UDP for DNS server 192.168.1.1.
Sep 02 19:53:52 localhost.localdomain systemd-resolved[715]: Using degraded feature set UDP instead of TCP for DNS server 192.168.1.1.
Sep 02 19:53:57 localhost.localdomain systemd-resolved[715]: Using degraded feature set TCP instead of UDP for DNS server 192.168.1.1.
Sep 02 19:54:17 localhost.localdomain systemd-resolved[715]: Using degraded feature set UDP instead of TCP for DNS server 192.168.1.1.
Sep 02 19:54:23 localhost.localdomain systemd-resolved[715]: Using degraded feature set TCP instead of UDP for DNS server 192.168.1.1.
Sep 02 19:54:43 localhost.localdomain systemd-resolved[715]: Using degraded feature set UDP instead of TCP for DNS server 192.168.1.1.
Sep 02 19:54:54 localhost.localdomain systemd-resolved[715]: Using degraded feature set TCP instead of UDP for DNS server 192.168.1.1.