7

How to verify dnsmasq's configuration?

dnsmasq used to be able to give verbose info about itself in /var/log/daemon.log, as explained in dnsmasq testing.

However, when I restarted my dnsmasq service, nothing is logged to /var/log/daemon.log:

% echo "    *** DEBUG `date --rfc-3339=seconds` DEBUG *** " >> /var/log/daemon.log

% service dnsmasq restart 
* Restarting DNS forwarder and DHCP server dnsmasq                      [ OK ] 

% tail /var/log/daemon.log
*** DEBUG 2013-11-27 23:04:08-05:00 DEBUG *** 

This is Ubuntu 13.10 Saucy.

3 Answers 3

7

dnsmasq will print errors to the terminal if you run it directly.

dnsmasq --test will do basic syntax checks on the config files

dnsmasq on its own will try to start dnsmasq, and gives a line number in the config if it finds any problems there.

Otherwise (if you don't use sudo), it should eventually reach the stage where it tries to create a lease, but fails due to permissions. If you use sudo at this point it should hopefully work, but then you may have to kill the process manually.

6

AFAIK dnsmasq will normally log to the syslog service. By default it uses facility DAEMON.

FWIW: "It works for me" (in Fedora 18 / 19).

If you aren't seeing any messages I'd suggest verifying your syslog configuration. Or, a more emperical approach, try something like "grep -c dnsmasq /var/log/*".

See also the detailed description of logging in the manual page here: http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

There are some other possibilities for logging mentioned there that can effect its behaviour e.g. if facility contains a '/' character.

Are other subsystems (sys-)logging correctly? Can you cause syslog to log a message by using the 'logger' command?

HTH!

Robb.

1
  • thanks. It worked for me as well, that was Debian. Thanks for the grep tip, now I found that in Ubuntu 13.10 Saucy dnsmasq logs to syslog instead of daemon.log, even though the man page still says send syslog entries defaults to DAEMON.
    – xpt
    Nov 29, 2013 at 2:22
2

DNSMASQ is one of the common DNS/DHCP cace solution on linux/unix, some good links:

help.ubuntu.com/community/Dnsmasq manpages.ubuntu.com/manpages/lucid/man8/dnsmasq.8.html wiki.debian.org/HowTo/dnsmasq

  1. Verification steps: Turn on the debug logging under /etc/dnsmasq.conf:

log-queries
log-dhcp

  1. Then, restart and watch for logs when you dig hostname:

On debian variants, it dnsmasq logs by default in /var/log/syslog.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.