Verify dnsmasq configuration

45,827

Solution 1

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.

Solution 2

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.

Solution 3

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.

Share:
45,827

Related videos on Youtube

xpt
Author by

xpt

Updated on September 18, 2022

Comments

  • xpt
    xpt over 1 year

    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.