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.