systemd resolvectl drop in files for dns

Solution 1:

In the terminal, use nm-connection-editor, and create various VPN/regular connection profiles, with these settings...

enter image description here

enter image description here

Solution 2:

I still did not found the answer, but I've found a workaround.

I've placed a script in /etc/NetworkManager/dispatcher.d which is executed each time a network related events occurs:

#!/bin/bash -e

echo "Receive event from ${DEVICE_IFACE:-dummy} ${NM_DISPATCHER_ACTION:-dummy} " >> /tmp/dispatch.log
[[ "${DEVICE_IFACE:-dummy}" = "tun0" ]] && [[ "${NM_DISPATCHER_ACTION:-dummy}" = "up" ]] && {
    resolvectl dns tun0 10.10.10.10
    resolvectl domain tun0 ~example.com ~example.org
    resolvectl dnssec tun0 off 
} >> /tmp/dispatch.log

note check the permissions, execution bit and must be owned by root