You are not logged in.

#1 2024-04-12 00:16:22

bebaszna
Member
Registered: 2024-04-07
Posts: 4

OpenVPN client - DNS will get set only on the 1st launch

OpenVPN client

systemed-resolved

When I run OpenVPN client, it'll get connected and will be able to load a target resource properly only during the very first launch, after reboot. On all the consequentive launches, it'll get connected still "Initialization Sequence Completed", but  the resources won't get loaded.

By trial and error I've found out that it's an issue that has to do with DNS.

sudo resolvectl status
===>

# 1st launch

Link 6 (tun0)
    Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6 mDNS/IPv4 mDNS/IPv6
         Protocols: +DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
       Current DNS Server: 10.1.1.7
       DNS Servers: 10.1.1.7
       DNS Domain: aaa.xyz


# all other ones

Link 6 (tun0)
       Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6 mDNS/IPv4 mDNS/IPv6
         Protocols: +DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
        DNS Domain: aaa.xyz

I've found a cure:

sudo systemd-resolve -i tun0 \
  --set-dns=10.1.1.7 \
  --set-domain=aaa.xyz \
  --set-dnssec=off

which will have to be run each time OpenVPN gets restarted.


How to make it run automatically?

Or rather - why does this happen at all? How to make OpenVPN set the **proper DNS** automatically?


And why does it get set properly right after reboot of the computer and only during the 1st time?

Last edited by bebaszna (2024-04-12 00:18:54)

Offline

#2 2024-04-12 05:29:06

-thc
Member
Registered: 2017-03-15
Posts: 717

Re: OpenVPN client - DNS will get set only on the 1st launch

With my OpenVPN's this works flawlessly and needs no "hack".
Technically it's not OpenVPN's job to set the DNS server - it's the job of your network management.

Please post the output of

find /etc/systemd -type l -exec test -f {} \; -print | awk -F'/' '{ printf ("%-45s | %s\n", $(NF-0), $(NF-1)) }' | sort -f

and which "OpenVPN client" do you use?

Offline

Board footer

Powered by FluxBB