1

I'm using Hyper-V to create a VM running Ubuntu 18.04. I'm having some issues with docker not resolving DNS requests properly. This guide suggests using nmcli to identify the DNS server.

$ nmcli dev show | grep 'IP4.DNS'
IP4.DNS[1]:                             10.0.0.2

First of all, is nmcli installed by default? I don't think so, but even after installing it running this command doesn't show anything for IP4.DNS -- nor even DNS. Is there a better way of discovering what DNS server my installation is using?

WhiskerBiscuit
  • 553
  • 2
  • 8
  • 16
  • 1
    Run `systemd-resolve --status | grep 'DNS Servers'` and see what it says your DNS servers are. If there is no output, then your system is not configured to use DNS at all and you will have to set that up. For now, let's just test to see if there's any DNS servers configured. – Thomas Ward Jul 31 '18 at 14:48
  • Ok, that does show my PiHole dns server. I’ll try updating the dameon.json file, but I suspect that will just prevent docker from running. – WhiskerBiscuit Jul 31 '18 at 18:58
  • It sounds then that the PiHole server isn't able to recurse outbound. – Thomas Ward Jul 31 '18 at 19:02
  • [Related (possible duplicate)](https://askubuntu.com/questions/191563/how-to-view-the-dns-address-assigned-by-dhcp/1174934#1174934) – Pablo Bianchi Dec 01 '19 at 23:33

4 Answers4

4

nmcli dev show is a good option.

File /etc/resolv.conf will have the nameservers actually configured for name resolution, so if you run cat /etc/resolv.conf you should see your current DNSs' servers.

Pablo Bianchi
  • 14,308
  • 4
  • 74
  • 117
Leo Mendez
  • 41
  • 1
  • 3
    In a `netplan` controlled environment with `systemd-resolve` as the resolver system, `/etc/resolv.conf` will only point to the local systemd-resolve resolver. `/etc/resolv.conf` therefore can't be trusted when Netplan and systemd-resolve are in play. `nmcli dev show` can also be problematic as well that same way if the DNS isn't set with Network Manager. – Thomas Ward Jul 31 '18 at 19:01
  • nmcli just works if you have network-manager installed. And it's used generally only on desktop installations – josircg May 18 '23 at 12:25
2

nslookup unraid.local I think this is the most accurate way to find which DNS you are using. Or just check /etc/resolv.conf content.

nmcli dev show or systemd-resolve --status only show DNS server settings in its configuration, but your DNS may be controlled by other programs.

Jay
  • 131
  • 4
1

As resolv.conf states, you can use

resolvectl status

to show the currently used configuration

Philippp
  • 111
  • 2
0
resolvectl dns

Shows globally defined dns server as well as a list of bridges and network interfaces with their defined dns servers

modesto
  • 219
  • 2
  • 4