Few issues with Wireguard client on Debian

Oct 9, 2022

Today I tried to configure Wireguard client on one my Debian machine and I faced with few issues.

The first one was related to resolvconf - after the installation of Wireguard client and adding of the configuration file I tried to start the client and got such error:

~ wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.6.0.2/32 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] resolvconf -a wg0 -m 0 -x
/usr/bin/wg-quick: line 32: resolvconf: command not found
[#] ip link delete dev wg0

After short googling I figured out that modern Linux distributions with systemd comes with its own flavor of resolvconf as part of the resolvectl command. And for the fix of this issue I can just create a symlink:

~ ln -s /usr/bin/resolvectl /usr/local/bin/resolvconf

Also, there is a Debian bug report related to this symlink.

When I tried to run Wireguard client again I got next message:

~ wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.6.0.2/32 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] resolvconf -a wg0 -m 0 -x
Failed to set DNS configuration: Unit dbus-org.freedesktop.resolve1.service not found.
[#] ip link delete dev wg0

This message was pretty straightforward - as I put in my Wireguard configuration the line with private DNS server address it required from me to check systemd-resolved.service status on my client machine and to start it if turned off.

~ systemctl status systemd-resolved.service
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: en>
     Active: inactive (dead)
       Docs: man:systemd-resolved.service(8)
             man:org.freedesktop.resolve1(5)
             https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-m>
             https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients

~ systemctl start systemd-resolved.service

Also I enabled the service starts whenever the system boots:

~ systemctl enable systemd-resolved.service

After that I was able to run Wireguard client and to connect to the server successfully.