How can I tell which DNS servers DNSMasq is using?

You can find the DNS servers with the NetworkManagerCLI (nmcli) tool:

nmcli dev show | grep DNS
IP4.DNS[1]:                             172.22.216.251
IP6.DNS[1]:                             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[1]:                             172.22.216.251
IP6.DNS[1]:                             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

Tags:

Dns

Dnsmasq