DNSMasq view cache entries and cache size used

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions
Author Message
bobs
DD-WRT User


Joined: 24 Jan 2016
Posts: 59

PostPosted: Mon Feb 08, 2016 17:12    Post subject: DNSMasq view cache entries and cache size used Reply with quote
How can I view cache entries and cache size used on DNSMasq in DD-WRT via SSH?
Sponsor
h8red
DD-WRT User


Joined: 28 Jun 2011
Posts: 304
Location: Vilnius, Lithuania

PostPosted: Mon Feb 08, 2016 17:19    Post subject: Reply with quote
cat /tmp/dnsmasq.leases | wc
_________________
[Atheros] TP-Link TL-WR842ND v2 revision 29048 (VPN and PPTP server, AD blocking, YAMon)
[Atheros] TP-Link TL-WR740N v3 revision 28598 (AD blocking)
[Ralink] Asus rt-n10plus C1 revision 29048 (AP with NAT, QoS, AD blocking)
bobs
DD-WRT User


Joined: 24 Jan 2016
Posts: 59

PostPosted: Mon Feb 08, 2016 17:26    Post subject: Reply with quote
h8red wrote:
cat /tmp/dnsmasq.leases | wc


That is DHCP leases not DNS Entries

I am trying to optimise my DNS cache size to actual use over a period of time.
bobs
DD-WRT User


Joined: 24 Jan 2016
Posts: 59

PostPosted: Mon Feb 08, 2016 21:55    Post subject: Reply with quote
DNSMasq stores DNS cache in ram, is there any way to read this or at the very least, the NUMBER OF ENTRIES in the ram cache?
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 4398

PostPosted: Mon Feb 08, 2016 22:21    Post subject: Reply with quote
From the DNSMasq documentation:

Quote:
-q, --log-queries
Log the results of DNS queries handled by dnsmasq. Enable a full cache dump on receipt of SIGUSR1. If the argument "extra" is supplied, ie --log-queries=extra then the log has extra information at the start of each line. This consists of a serial number which ties together the log lines associated with an individual query, and the IP address of the requestor.


Problem is, I'm not sure if dd-wrt supports the log-queries option, or whether it will respond to signals. At least it didn't work the last time I tried it. It's one of the limitations of dd-wrt when it comes to DNSMasq. Many features have been stripped out to save space, or sometimes it's just running older versions of DNSMasq that never supported the feature.

Note, you would add the directive to "Additional DNSMasq Options" as follows:

Code:
log-queries


Restart DNSMasq:

Code:
stopservice dnsmasq && sleep 5 && startservice dnsmasq


Then from the command line, signal for the dump.

Code:
killall -USR1 dnsmasq


Btw, works on tomato.
bobs
DD-WRT User


Joined: 24 Jan 2016
Posts: 59

PostPosted: Mon Feb 08, 2016 22:44    Post subject: Reply with quote
eibgrad wrote:
From the DNSMasq documentation:

Quote:
-q, --log-queries
Log the results of DNS queries handled by dnsmasq. Enable a full cache dump on receipt of SIGUSR1. If the argument "extra" is supplied, ie --log-queries=extra then the log has extra information at the start of each line. This consists of a serial number which ties together the log lines associated with an individual query, and the IP address of the requestor.


Problem is, I'm not sure if dd-wrt supports the log-queries option, or whether it will respond to signals. At least it didn't work the last time I tried it. It's one of the limitations of dd-wrt when it comes to DNSMasq. Many features have been stripped out to save space, or sometimes it's just running older versions of DNSMasq that never supported the feature.

Note, you would add the directive to "Additional DNSMasq Options" as follows:

Code:
log-queries


Restart DNSMasq:

Code:
stopservice dnsmasq && sleep 5 && startservice dnsmasq


Then from the command line, signal for the dump.

Code:
killall -USR1 dnsmasq


Btw, works on tomato.


Ill open a bug to get it to be able to show the DNS cache COUNT in use and remaining then.
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 4398

PostPosted: Mon Feb 08, 2016 22:49    Post subject: Reply with quote
P.S. Should have mentioned, these dumps are made to the syslog, NOT the command line.
bobs
DD-WRT User


Joined: 24 Jan 2016
Posts: 59

PostPosted: Mon Feb 08, 2016 23:00    Post subject: Reply with quote
eibgrad wrote:
P.S. Should have mentioned, these dumps are made to the syslog, NOT the command line.


I don't really want to list each query and so forth, just a count will do, perhaps even on the UI would be nice, DNS cache used / total / remaining etc.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum