gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.4k stars 547 forks source link

Private DNS #753

Closed cardinalfan1 closed 2 years ago

cardinalfan1 commented 2 years ago

I'm not sure if this is an issue with netmaker or configuration elsewhere. For testing purposes, I created two VMs, one as a server and one as a netmaker client. Server is set up with docker-compose.contained.yml file available on the github. Client is thru the install script.

When I run resolvectl on the client, I am able to see the dns being set.

Link 78 (nm-vpn)
      Current Scopes: DNS
DefaultRoute setting: no
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
  Current DNS Server: 10.177.123.254
         DNS Servers: 10.177.123.254
          DNS Domain: ~vpn

And when I query for hostnames thru resolvectl, it does work:

resolvectl query netmaker.vpn
netmaker.vpn: 10.177.123.254                   -- link: nm-vpn

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

However, I am not able to access these hosts by name thru any regular system command... ping, etc.

host netmaker.vpn
Host netmaker.vpn not found: 3(NXDOMAIN)

Any configuration or setup things that I missed? Thanks for the help

cardinalfan1 commented 2 years ago

Also, not sure if this is relevant, but the global DNS listing for resolvectl doesn't include the private DNS server

Global
       LLMNR setting: no
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
  Current DNS Server: 8.8.8.8
         DNS Servers: 8.8.8.8
                      8.8.4.4
afeiszli commented 2 years ago

what does nslookup return?

mattkasun commented 2 years ago

what does /etc/nsswitch contain. ping and other programs follow the rules there regarding lookups

cardinalfan1 commented 2 years ago

what does nslookup return?

~$nslookup test1.vpn
Server:         8.8.8.8
Address:        8.8.8.8#53

** server can't find test1.vpn: NXDOMAIN
~$ nslookup netmaker.vpn
Server:         8.8.8.8
Address:        8.8.8.8#53

** server can't find netmaker.vpn: NXDOMAIN
cardinalfan1 commented 2 years ago

what does /etc/nsswitch contain. ping and other programs follow the rules there regarding lookups

~$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat systemd
group:          compat systemd
shadow:         compat
gshadow:        files

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis
mattkasun commented 2 years ago

OK, I am baffled. What OS are you running?

cardinalfan1 commented 2 years ago

OK, I am baffled. What OS are you running?

Me too! I haven't been able to figure out what's going on despite hours of google searching. Both server & client are:

~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS"
mattkasun commented 2 years ago

Ubuntu is the one distro where we have never seeen any issue with DNS ------ until now.

cardinalfan1 commented 2 years ago

Just looking into it a little further, when I run

~$ ping test1.vpn
ping: test1.vpn: Name or service not known

and check the docker logs for netmaker on the server i get something pop up:

[netmaker] 2022-02-12 23:36:24 Ping Handler:  ping/8ed926d7-6ac9-4abe-a395-f0e52b87970e
[netmaker] 2022-02-12 23:37:26 Ping Handler:  ping/8ed926d7-6ac9-4abe-a395-f0e52b87970e
[netmaker] 2022-02-12 23:38:28 Ping Handler:  ping/8ed926d7-6ac9-4abe-a395-f0e52b87970e
[netmaker] 2022-02-12 23:39:30 Ping Handler:  ping/8ed926d7-6ac9-4abe-a395-f0e52b87970e
[netmaker] 2022-02-12 23:40:32 Ping Handler:  ping/8ed926d7-6ac9-4abe-a395-f0e52b87970e

EDIT: NVM This is unrelated

cardinalfan1 commented 2 years ago

Also, the contents of /etc/resolv.conf are:

cat /etc/resolv.conf
# Generated by SolusVM
nameserver 8.8.8.8
nameserver 8.8.4.4

When I manually add the dns server into this file everything works like it's supposed to

Is netclient supposed to update this or is resolvctl supposed to update this file it gets the config?

cardinalfan1 commented 2 years ago

Finally figured it out, if anyone else has this problem.... need to add nameserver 127.0.0.53 to /etc/resolv.conf. This IP points to systemd-resolved. Then, restart: sudo systemctl restart systemd-resolved

Closing this thread...