Things you can do with dnsmasq!

after a reboot, dnsmasq fails to start,, investigating

dnsmasq --test to check the files

that's what's odd, test come out clean

what is the version you're running now?
dnsmasq --version

Dnsmasq version 2.77test4 Copyright (c) 2000-2016 Simon Kelley
Compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify

This software comes with ABSOLUTELY NO WARRANTY.
Dnsmasq is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License, version 2 or 3.

check the pihole log, whenever dnsmasq starts (sudo service dnsmasq start), it logs something like

Apr 14 19:29:01 dnsmasq[16988]: started, version 2.77test4 cachesize 10000
Apr 14 19:29:01 dnsmasq[16988]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
Apr 14 19:29:01 dnsmasq[16988]: DNSSEC validation enabled
Apr 14 19:29:01 dnsmasq[16988]: DNSSEC signature timestamps not checked until first cache reload
Apr 14 19:29:01 dnsmasq[16988]: warning: ignoring resolv-file flag because no-resolv is set
Apr 14 19:29:01 dnsmasq[16988]: using nameserver 127.10.10.4#5554
Apr 14 19:29:01 dnsmasq[16988]: using nameserver 127.10.10.3#5553
Apr 14 19:29:01 dnsmasq[16988]: using nameserver 127.10.10.2#5552
Apr 14 19:29:01 dnsmasq[16988]: using nameserver 127.10.10.1#5551
Apr 14 19:29:01 dnsmasq[16988]: using local addresses only for domain localdomain
Apr 14 19:29:01 dnsmasq[16988]: read /etc/hosts - 13 addresses
Apr 14 19:29:01 dnsmasq[16988]: read /etc/pihole/local.list - 2 addresses

Pihole won't have any new logs, if dnsmasq won't start.

sudo service dnsmasq start

Job for dnsmasq.service failed. See 'systemctl status dnsmasq.service' and 'journalctl -xn' for details.

systemctl status dnsmasq.service

dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled)
Drop-In: /run/systemd/generator/dnsmasq.service.d
└─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
Active: failed (Result: exit-code) since Fri 2017-04-14 13:30:58 EDT; 6s ago
Process: 10655 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
Process: 10651 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)

suggestion from this article:

systemctl, when used to start dnsmasq is not very verbose. Just try to start the service just like this:
sudo dnsmasq

If it start all right, to stop it:
sudo kill -9 $(pidof dnsmasq)

okay, so apparently port 53 is already in use

what other packages have you installed?

none that I can think of that would use port 53

I'm going to completely remove dnsmasq, then reinstall it, see if that helps

you can find out who's using port 53 with: sudo lsof -i -P

On my system, something like this comes up (dnsmasq uses port 53 (UDP/TCP):

COMMAND     PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd       1     root   47u  IPv4   6937      0t0  TCP d0wn-se-ns1.dns:5554 (LISTEN)
systemd       1     root   48u  IPv4   6938      0t0  UDP d0wn-se-ns1.dns:5554
systemd       1     root   49u  IPv4   6944      0t0  TCP d0wn-de-ns1.dns:5553 (LISTEN)
systemd       1     root   50u  IPv4   6945      0t0  UDP d0wn-de-ns1.dns:5553
systemd       1     root   51u  IPv4   6946      0t0  TCP d0wn-at-ns1.dns:5551 (LISTEN)
systemd       1     root   52u  IPv4   6947      0t0  UDP d0wn-at-ns1.dns:5551
systemd       1     root   53u  IPv4   6942      0t0  TCP d0wn-nl-ns3.dns:5552 (LISTEN)
systemd       1     root   54u  IPv4   6943      0t0  UDP d0wn-nl-ns3.dns:5552
avahi-dae   381    avahi   12u  IPv4   8641      0t0  UDP *:5353
avahi-dae   381    avahi   13u  IPv6   8642      0t0  UDP *:5353
avahi-dae   381    avahi   14u  IPv4   8643      0t0  UDP *:36195
avahi-dae   381    avahi   15u  IPv6   8644      0t0  UDP *:53676
dhcpcd      560     root    8u  IPv4   7024      0t0  UDP *:68
sshd        561     root    3u  IPv4  12054      0t0  TCP *:22 (LISTEN)
sshd        561     root    4u  IPv6  12056      0t0  TCP *:22 (LISTEN)
perl       1265     root    5u  IPv4  12528      0t0  TCP *:10000 (LISTEN)
perl       1265     root    6u  IPv4  12529      0t0  UDP *:10000
lighttpd   7004 www-data    5u  IPv4  19498      0t0  TCP *:80 (LISTEN)
lighttpd   7004 www-data    6u  IPv6  19499      0t0  TCP *:80 (LISTEN)
dnscrypt-  8200 dnscrypt    3u  IPv4   6942      0t0  TCP d0wn-nl-ns3.dns:5552 ( LISTEN)
dnscrypt-  8200 dnscrypt    4u  IPv4   6943      0t0  UDP d0wn-nl-ns3.dns:5552
dnscrypt-  8200 dnscrypt   11u  IPv4 105583      0t0  UDP *:58839
dnscrypt-  8204 dnscrypt    3u  IPv4   6946      0t0  TCP d0wn-at-ns1.dns:5551 (LISTEN)
dnscrypt-  8204 dnscrypt    4u  IPv4   6947      0t0  UDP d0wn-at-ns1.dns:5551
dnscrypt-  8204 dnscrypt   11u  IPv4 105593      0t0  UDP *:52244
dnscrypt-  8206 dnscrypt    3u  IPv4   6937      0t0  TCP d0wn-se-ns1.dns:5554 (LISTEN)
dnscrypt-  8206 dnscrypt    4u  IPv4   6938      0t0  UDP d0wn-se-ns1.dns:5554
dnscrypt-  8206 dnscrypt   11u  IPv4 104165      0t0  UDP *:46047
dnscrypt-  8207 dnscrypt    3u  IPv4   6944      0t0  TCP d0wn-de-ns1.dns:5553 (LISTEN)
dnscrypt-  8207 dnscrypt    4u  IPv4   6945      0t0  UDP d0wn-de-ns1.dns:5553
dnscrypt-  8207 dnscrypt   11u  IPv4 105699      0t0  UDP *:53298
ntpd      12543      ntp   16u  IPv4 115590      0t0  UDP *:123
ntpd      12543      ntp   17u  IPv6 115591      0t0  UDP *:123
ntpd      12543      ntp   18u  IPv4 115596      0t0  UDP localhost:123
ntpd      12543      ntp   19u  IPv4 115597      0t0  UDP raspberrypi.localdomain:123
ntpd      12543      ntp   20u  IPv6 115598      0t0  UDP localhost:123
ntpd      12543      ntp   21u  IPv6 115599      0t0  UDP [fe80::3e65:bd8d:89da:9178]:123
sshd      15938     root    3u  IPv4 127795      0t0  TCP raspberrypi.localdomain:22->hp7900.localdomain:49180 (ESTABLISHED)
sshd      15946       pi    3u  IPv4 127795      0t0  TCP raspberrypi.localdomain:22->hp7900.localdomain:49180 (ESTABLISHED)
sshd      15960     root    3u  IPv4 127806      0t0  TCP raspberrypi.localdomain:22->hp7900.localdomain:49181 (ESTABLISHED)
sshd      15965       pi    3u  IPv4 127806      0t0  TCP raspberrypi.localdomain:22->hp7900.localdomain:49181 (ESTABLISHED)
dnsmasq   16988  dnsmasq    4u  IPv4 133266      0t0  UDP *:53
dnsmasq   16988  dnsmasq    5u  IPv4 133267      0t0  TCP *:53 (LISTEN)
dnsmasq   16988  dnsmasq    6u  IPv6 133268      0t0  UDP *:53
dnsmasq   16988  dnsmasq    7u  IPv6 133269      0t0  TCP *:53 (LISTEN)

I found the culprit

dnscrypt-

now i have to figure out how to remove that

this means that you have another configuration file for dnscrypt somewhere (apart from the five files from the rar file)!

crazy,, it replicated itself into 12 distinct files

removing the files from /lib/systemd/system/ fixed it

A long time a ago, I wrote an article to uninstall a previous version of dnscrypt-proxy, you can find it here

basicly, it comes down to (if you only installed one version of dnscrypt):

  • cd into the old version folder:
    cd dnscrypt-proxy-x.x.x
  • uninstall the old version
    sudo make uninstall

thanks for the tip,,, I aparently forgot to remove a previous attempt at dnscrypt,,, to make uninstall I actually had to redownload the version on the wiki, and the make uninstall.

I'm going to try dnscrypt again completely fresh

maybe next week,,, fresh install also wants to use port 53

Hi,
I appreciate I'm really late to the conversation with this but it's been useful for me already with the 03-bypass.conf file as I have a device on my network that I needed to completely bypass my pi-hole.

Thanks for the original post (and as I said, I do appreciate that I'm bumping a very old thread here).

I have another question which I'm hoping can be resolved by tweaking the dnsmasq settings.

I have one device on my network that I want to give a reserved address to but I want it to point to an external DNS source.

I have this device listed in /etc/dnsmasq.d/04-pihole-static-dhcp.conf and it gets the reserved address.

I set up 04-bypass.conf and the device still gets the reserved address and pi-hole as the DNS server.

So I renamed that file to 05-bypass.conf, restarted the services and it half works. The device now gets the DNS server I've specified but it's given a DHCP IP address.

I then renamed it to 03-bypass.conf and now it gets the reserved address and pi-hole as the DNS server.

Is there any way I can still have a reserved IP address but have external DNS servers using this method?

Thanks,