1

I have two VPNs - one via wireguard for my general internet traffic, one via openvpn (for work). DNS resolution over openvpn is only partly working.

With both tunnels up:

A) systemd-resolve needs to be "taught" to use tun0. (This was working previously when both VPNs were using openvpn.)

> systemd-resolve jenkins.staging.mycompany.com
jenkins.staging.mycompany.com: resolve call failed: All attempts to contact name servers or networks failed

> systemd-resolve -i tun0 jenkins.staging.mycompany.com
jenkins.staging.mycompany.com: 10.1.2.36       -- link: tun0

-- Information acquired via protocol DNS in 48.5ms.
-- Data is authenticated: no

> systemd-resolve jenkins.staging.mycompany.com
jenkins.staging.mycompany.com: 10.1.2.36       -- link: tun0

-- Information acquired via protocol DNS in 852us.
-- Data is authenticated: no

B) dig works out of the box. nslookup only works if I tell it which DNS server to use. curl doesn't work.

> curl jenkins.staging.mycompany.com:8080
curl: (6) Could not resolve host: jenkins.staging.mycompany.com

> dig jenkins.staging.mycompany.com

; <<>> DiG 9.11.5-P4-5.1ubuntu2.1-Ubuntu <<>> jenkins.staging.mycompany.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 2834
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;jenkins.staging.mycompany.com. IN  A

;; AUTHORITY SECTION:
mycompany.com.      56  IN  SOA [aws dns info]

;; Query time: 47 msec
;; SERVER: 172.16.0.1#53(172.16.0.1)
;; WHEN: Sat Apr 18 09:08:44 EDT 2020
;; MSG SIZE  rcvd: 143

> nslookup jenkins.staging.mycompany.com
Server:     172.16.0.1    <- uses wrong dns server by default
Address:    172.16.0.1#53

** server can't find jenkins.staging.mycompany.com: NXDOMAIN

> nslookup jenkins.staging.mycompany.com 10.0.0.2
Server:     10.0.0.2
Address:    10.0.0.2#53

Non-authoritative answer:
Name:   jenkins.staging.mycompany.com
Address: 10.1.2.36

My theory was that wireguard was somehow stealing DNS responsibilities from systemd, so I attempted to add the openvpn provided DNS to the client conf file:

[Interface]
PrivateKey = xxx
Address = 172.aa.bb.cc/32
DNS = 172.16.0.1 10.0.0.2

But this doesn't help.

systemd-resolve's config looks fine, I think(?):

> resolveconf status

Global
       LLMNR setting: no
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
  Current DNS Server: 172.16.0.1
         DNS Servers: 172.16.0.1
                      10.0.0.2
          DNS Domain: staging.mycompany.com
                      production.mycompany.com
                      infrastructure.mycompany.com
          DNSSEC NTA: 10.in-addr.arpa
                      ...
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 5 (tun0)
      Current Scopes: DNS
DefaultRoute setting: yes
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 10.0.0.2
          DNS Domain: staging.mycompany.com
                      production.mycompany.com
                      infrastructure.mycompany.com
fridgepolice
  • 111
  • 2
  • @A.B thanks, where am I looking? netstat -rn doesn't show anything obviously unusual. – fridgepolice Apr 18 '20 at 13:39
  • I was about to start into network settings, but I realize some handling (DNS) is also done by systemd, so I would have been starting in the wrong direction too. Sorry I don't really know where to start to solve your problem. My usual method is to reproduce it, but here I can't reproduce of course. – A.B Apr 18 '20 at 13:48

1 Answers1

0

I have a suggestion but I don't have enough reputation to comment so I'm putting my comment in an answer. Have you looked at the interface metric for your Wireguard virtual adapter and your OpenVPN virtual adapter? I know in Windows, when I run into the problem you are describing, I have to manually set the interface metric on both, for the OpenVPN virtual adapter it just has to be lower than the metric for the other adapter.

CB_Ron
  • 313
  • 2
  • 10