https://bugs.kde.org/show_bug.cgi?id=519626

altosch <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from altosch <[email protected]> ---
It seems that just pinging isn't enough. It usually works, but sometimes it
doesn't. 

It's also needed to directly configure the DNS, set the priority, and flush the
cache.

------------ 

* wg-quick script modification (if you start the VPN from the console):

# fill in your own DNS addresses from your VPN provider

PostUp = ping -c 5 -w 10 1.1.1.1; resolvectl dns %i your_1st_VPN_DNS
your_2nd_VPN_DNS 1.1.1.1; resolvectl domain %i "~."; resolvectl flush-caches

------------ 

* dispatcher script for the NetworkManager (if you start the VPN from Plasma):

#!/bin/bash

# NetworkManager dispatcher script to fix WireGuard DNS race condition
# Place this in /etc/NetworkManager/dispatcher.d/99-vpn-wait and chmod +x

INTERFACE=$1
ACTION=$2

# Replace "my-vpn-name" with the name of your connection in KDE Plasma
if [[ "$CONNECTION_ID" == "my-vpn-name" ]] && [[ "$ACTION" == "up" || "$ACTION"
== "vpn-up" ]]; then

    # 1. Force a handshake by pinging a public IP. 
    # This ensures the tunnel is actually transporting data before we configure
DNS.
    /usr/bin/ping -c 1 -w 10 1.1.1.1 > /dev/null 2>&1

    if [ $? -eq 0 ]; then

        # 2. Re-apply DNS configuration now that the tunnel is open
        # fill in your own DNS addresses
        /usr/bin/resolvectl dns "$INTERFACE" your_1st_VPN_DNS your_2nd_VPN_DNS
1.1.1.1 8.8.8.8

        # 3. Set the routing domain to "~." to force all DNS queries through
this interface
        /usr/bin/resolvectl domain "$INTERFACE" "~."

        # 4. Flush caches to clear any "degraded" status or timeouts
        /usr/bin/resolvectl flush-caches
    fi
fi

------------ 

If you want to know what happens during connection, open a separate terminal
window and use the command:

sudo journalctl -u systemd-resolved -f

Then try connecting.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to