It uses the same host-statistics and
host-statistics-max options, as documented for bind8. Only IPv4
is supported, so all others queries (IPv6) will appear in the count for "0.0.0.0".
+++ Statistics Dump +++ (1219265892)
success 0
referral 0
nxrrset 0
nxdomain 0
recursion 4
failure 0
duplicate 0
dropped 0
++ Name Server Statistics ++
(Legend)
TotalQ
[192.168.0.100]
3
[192.168.0.102]
1
--- Statistics Dump --- (1219265892)
However, if you wish to use this on a high traffic server with close to that many clients, you probably want to turn up the HOSTSTAT_HASHSIZE to something larger than 1k to reduce the overhead of walking the linked lists. It could also be made more efficient by storing the entries in order and using a binary search, but I didn't need this, so I didn't code it.
I also didn't care what the responses were, just where queries were coming from, so I only tracked total queries (as "TotalQ"). It would be fairly easy to add support for more counters, as the TotalQ counter is incremented in the same function which implements the other statistics counters.
$ http://ftp.isc.org/isc/bind9/9.4.3b2/bind-9.4.3b2.tar.gz $ tar xzf bind-9.4.3b2.tar.gz $ cd bind-9.4.3b2 $ patch -p1 </path/to/download/bind9.host-statistics.patch patching file bin/named/include/named/server.h patching file bin/named/query.c patching file bin/named/server.c Hunk #1 succeeded at 2936 (offset 83 lines). Hunk #2 succeeded at 3707 (offset 89 lines). Hunk #3 succeeded at 3746 (offset 89 lines). Hunk #4 succeeded at 4308 (offset 89 lines). Hunk #5 succeeded at 4350 (offset 89 lines). patching file lib/isccfg/namedconf.c Hunk #1 succeeded at 670 (offset 52 lines). $ ./configure && make