본문 바로가기

리눅스

[리눅스] bind(named) 성능 점검(queryperf)

728x90

bind(named) 성능 점검(queryperf)

 bind 9.12(bind-9.12.4-P2) 이후 버전에서는 queryperf 툴이 보이지 않는다.

서버 역할 서버 아이피 비고
클라이언트(queryperf) 192.168.0.62  
DNS 서버 192.168.0.63  

테스트 환경

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy

queryperf 설치 및 사용법

bind-9.12.4-P2 소스 파일 다운로드

 bind 소스 파일 다운로드 URL : https://downloads.isc.org/isc/

cd /usr/local/src
wget https://downloads.isc.org/isc/bind9/9.12.4-P2/bind-9.12.4-P2.tar.gz
tar xfz bind-9.12.4-P2.tar.gz

/usr/local/src/bind-9.12.4-P2/contrib/queryperf 이동

cd bind-9.12.4-P2/contrib/queryperf
./configure
$ ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for library containing res_mkquery... none required
checking for library containing __res_mkquery... no
checking for library containing res_9_mkquery... no
checking for socket in -lsocket... no
checking for inet_ntoa in -lnsl... yes
checking for gethostbyname2... yes
checking for getaddrinfo... yes
checking for getnameinfo... yes
checking for socklen_t... yes
checking for sa_len... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
make
$ make
gcc  -DHAVE_CONFIG_H -c queryperf.c
gcc  -DHAVE_CONFIG_H  queryperf.o  -lnsl  -lm -o queryperf
$ ls
config.h     config.log     configure     input     Makefile.in  queryperf    queryperf.o  utils
config.h.in  config.status  configure.in  Makefile  missing      queryperf.c  README
file queryperf
$ file queryperf
queryperf: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=3ab23f0cf5b2e0c306521d34e9ac23801b575319, for GNU/Linux 3.2.0, not stripped

queryperf 복사

cp queryperf /usr/local/bin/.

queryperf 사용법

$ queryperf -h

DNS Query Performance Testing Tool
Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $


Usage: queryperf [-d datafile] [-s server_addr] [-p port] [-q num_queries]
                 [-b bufsize] [-t timeout] [-n] [-l limit] [-f family] [-1]
                 [-i interval] [-r arraysize] [-u unit] [-H histfile]
                 [-T qps] [-e] [-D] [-R] [-c] [-v] [-h]
  -d specifies the input data file (default: stdin)
  -s sets the server to query (default: 127.0.0.1)
  -p sets the port on which to query the server (default: 53)
  -q specifies the maximum number of queries outstanding (default: 20)
  -t specifies the timeout for query completion in seconds (default: 5)
  -n causes configuration changes to be ignored
  -l specifies how a limit for how long to run tests in seconds (no default)
  -1 run through input only once (default: multiple iff limit given)
  -b set input/output buffer size in kilobytes (default: 32 k)
  -i specifies interval of intermediate outputs in seconds (default: 0=none)
  -f specify address family of DNS transport, inet or inet6 (default: any)
  -r set RTT statistics array size (default: 50000)
  -u set RTT statistics time unit in usec (default: 100)
  -H specifies RTT histogram data file (default: none)
  -T specify the target qps (default: 0=unspecified)
  -e enable EDNS 0
  -D set the DNSSEC OK bit (implies EDNS)
  -R disable recursion
  -c print the number of packets with each rcode
  -v verbose: report the RCODE of each response on stdout
  -h print this usage

sample 파일 생성

find / -name gen-data-queryperf.py
$ find / -name gen-data-queryperf.py
/usr/local/src/bind-9.12.4-P2/contrib/queryperf/utils/gen-data-queryperf.py

/usr/local/src/bind-9.12.4-P2/contrib/queryperf/utils 이동

cd utils

실행 권한 할당

chmod +x gen-data-queryperf.py

gen-data-queryperf 실행

python3 ./gen-data-queryperf.py -n 10 -p 100 -t com > domainquery.txt
cat domainquery.txt
$ cat domainquery.txt
www.oq3nf.com     A
www.6.com     A
www.e0ddg-.com     A
www.dmyfeh.com     A
www.7b.com     A
www.4ro-.com     A
www.af.com     A
www.d.com     A
www.is8.com     A
www.fr21yi.com     A

queryperf 테스트 방법

queryperf -s 192.168.0.63 -p 53 -d domainquery.txt
$ queryperf -s 192.168.0.63 -p 53 -d domainquery.txt

DNS Query Performance Testing Tool
Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $

[Status] Processing input data
[Status] Sending queries (beginning with 192.168.0.63)
[Status] Testing complete

Statistics:

  Parse input file:     once
  Ended due to:         reaching end of file

  Queries sent:         10 queries
  Queries completed:    10 queries
  Queries lost:         0 queries
  Queries delayed(?):   0 queries

  RTT max:         	0.008005 sec
  RTT min:              0.002793 sec
  RTT average:          0.006675 sec
  RTT std deviation:    0.001482 sec
  RTT out of range:     0 queries

  Percentage completed: 100.00%
  Percentage lost:        0.00%

  Started at:           Mon Nov 28 21:57:23 2022
  Finished at:          Mon Nov 28 21:57:23 2022
  Ran for:              0.014676 seconds

  Queries per second:   681.384573 qps
queryperf -s 192.168.0.63 -p 53 -d domainquery.txt -T 1000
queryperf -s 192.168.0.63 -p 53 -d domainquery.txt -T 1000 -t 2

dns server query logging(dns server : 192.168.0.63)

 

참고URL

- DNS 성능 점검(queryperf) : https://anti1346.tistory.com/115

- BIND Logging : https://kb.isc.org/docs/aa-01526

- BIND GITHUB : https://gitlab.isc.org/isc-projects/bind9

- ISC Download : https://downloads.isc.org/isc/

 

728x90