Dnsmasq
Jump to navigation
Jump to search
Links
Troubleshooting
DNS is down:
nslookup google.be
# Server: 127.0.0.1
# Address: 127.0.0.1#53
#
# ** server can't find google.be: NXDOMAIN
127.0.0.1:53
is served by dnsmasq
:
sudo netstat -lpn | grep 127.0.0.1:53
# tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 30718/dnsmasq
# udp 0 0 127.0.0.1:53 0.0.0.0:* 30718/dnsmasq
On Debian, this is configured in /etc/resolv.conf:
# Generated by NetworkManager
nameserver 127.0.0.1
Let's bypass dnsmasq to see if issue is there. For this, we use Google DNS 8.8.8.8
:
cat /etc/resolv.conf
# # Generated by NetworkManager
# nameserver 8.8.8.8
nslookup google.be
# Server: 8.8.8.8
# Address: 8.8.8.8#53
#
# Non-authoritative answer:
# Name: google.be
# Address: 216.58.213.163
# Name: google.be
# Address: 2a00:1450:4007:811::2003
DNS is back when bypassing dnsmasq.
Apparently killing dnsmasq is enough to restore the service (this will restore /etc/resolv.conf)
sudo pkill dnsmasq
dnsmasq is usually started by NetworkManager:
ps aux|grep dnsmasq
# nobody 128496 0.0 0.0 12976 4504 ? S 10:06 0:00 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground
# --no-hosts --bind-interfaces --pid-file=/run/NetworkManager/dnsmasq.pid --listen-address=127.0.0.1 --cache-size=400
# --clear-on-reload --conf-file=/dev/null --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq
# --conf-dir=/etc/NetworkManager/dnsmasq.d
This is configured in /etc/NetworkManager/NetworkManager.conf:
cat /etc/NetworkManager/NetworkManager.conf
# [main]
# plugins=ifupdown,keyfile
# dns=dnsmasq
#
# ...
We also need to tell the dhclient to use dnsmasq, in file /etc/dhcp/dhclient.conf:
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
-#prepend domain-name-servers 127.0.0.1;
+prepend domain-name-servers 127.0.0.1;
#require subnet-mask, domain-name-servers;
#timeout 60;
#retry 60;