How can I tell which DNS servers DNSMasq is using to resolve a name to an IP address? I can't figure it out. All of the existing questions here seem to just go as far as telling users that they are using DNSMasq.
You can find the DNS servers with the NetworkManagerCLI (
nmcli dev show | grep DNS IP4.DNS: 172.22.216.251 IP6.DNS: 2a01:4f0:400c:1::1
Ubuntu 14.04 and older
The command is slightly different in older (<15.04) versions of Ubuntu:
> nmcli dev list | grep DNS IP4.DNS: 172.22.216.251 IP6.DNS: 2a01:4f0:400c:1::1
For a more generic answer when you are using dnsmasq without network manager and with several upstream DNS :
sh# kill -USR1 <PID OF DNSMASQ> sh# tail /var/log/syslog
Upon receiving SIGUSR1, dnsmasq will log various statistics, including the number of DNS request send to each upstream server. Based on that, you can easily determine the most frequently used DNS server on your system.
Generally, for the system using
systemd, the DNS servers
dnsmasq is using can be found via
journalctl -u dnsmasq
On Ubuntu 15.04 the command is:
$ nmcli dev show | grep DNS IP4.DNS: 18.104.22.168
network-manager 0.9.8.8-0ubuntu7.2 amd64
The command is:
root@D-MIS-001:~# nmcli dev list | grep DNS IP4.DNS: 172.16.10.173 IP4.DNS: 172.16.10.133
This is what seems to be the current package version for Ubuntu 14.04 LTS. The correct command for 15.* may have changed.