It’s a shame that we don’t have the very awesome DNSPerf available in the Ubuntu repositories, however it’s very easy to install and well worth the small effort of compiling it from source if you are wanting to test the performance or stress test your DNS servers.
How to Install DNSPerf
Firstly we will need to install some dependancies:
apt-get install libbind-dev libkrb5-dev libssl-dev libcap-dev libxml2-dev apt-get install bind9utils make
Now lets download the source code
cd /root wget ftp://ftp.nominum.com/pub/nominum/dnsperf/220.127.116.11/dnsperf-src-18.104.22.168-1.tar.gz
Uncompress and compile.
tar xfvz dnsperf-src-22.214.171.124-1.tar.gz cd dnsperf-src-126.96.36.199-1 ./configure make sudo make install
From here you should see the program compiling and you should be good to go, run the following to confirm it’s working.
You should see something like the following:
DNS Performance Testing Tool Nominum Version 188.8.131.52 Usage: dnsperf [-f family] [-s server_addr] [-p port] [-a local_addr] [-x local_port] [-d datafile] [-c clients] [-n maxruns] [-l timelimit] [-b buffer_size] [-t timeout] [-e] [-D] [-y [alg:]name:secret] [-q num_queries] [-Q max_qps] [-S stats_interval] [-u] [-v] [-h] -f address family of DNS transport, inet or inet6 (default: any) -s the server to query (default: 127.0.0.1) -p the port on which to query the server (default: 53) -a the local address from which to send queries -x the local port from which to send queries (default: 0) -d the input data file (default: stdin) -c the number of clients to act as -n run through input at most N times -l run for at most this many seconds -b socket send/receive buffer size in kilobytes -t the timeout for query completion in seconds (default: 5) -e enable EDNS 0 -D set the DNSSEC OK bit (implies EDNS) -y the TSIG algorithm, name and secret -q the maximum number of queries outstanding (default: 100) -Q limit the number of queries per second -S print qps statistics every N seconds -u send dynamic updates instead of queries -v verbose: report each query to stdout -h print this help
Now we need to download the query file, and uncompress it.
wget ftp://ftp.nominum.com/pub/nominum/dnsperf/data/queryfile-example-current.gz gunzip queryfile-example-current.gz
The command below queries a DNS server at 192.168.100.100 for 60 seconds, it will send 10 queries per second.
dnsperf -s 192.168.100.100 -d queryfile-example-current -l 60 -c 1 -Q 10
The following command is a little less kind on your DNS server located at 192.168.100.100 in that it will act as 30 clients over 30 seconds with 60 queries a second and give a step by step output for each query.
dnsperf -s 192.168.100.100 -d queryfile-example-current -l 30 -c 10 -Q 60 -v
The following will test two DNS servers one at 192.168.100.100 and one at 192.168.100.200 for 30 seconds.
dnsperf -s 192.168.100.100 -s 192.168.100.200 -d queryfile-example-current -l 30
Hopefully at the end of all that you should a nice output like the following.
Statistics: Queries sent: 18393 Queries completed: 18157 (98.72%) Queries lost: 236 (1.28%) Response codes: NOERROR 16904 (93.10%), NXDOMAIN 1253 (6.90%) Average packet size: request 38, response 107 Run time (s): 32.915659 Queries per second: 551.621950 Average Latency (s): 0.104805 (min 0.001224, max 2.991246) Latency StdDev (s): 0.202635