====== 對 DNS 進行壓力測試 ======
* 環境 debian
===== 1.安裝 dnsperf =====
* apt install dnsperf
* ++看安裝訊息|
root@aac:~# apt install dnsperf
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libldns3
Suggested packages:
python3-dnspython python3-pcapy
The following NEW packages will be installed:
dnsperf libldns3
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 259 kB of archives.
After this operation, 763 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ftp.tw.debian.org/debian bookworm/main amd64 libldns3 amd64 1.8.3-1 +b1 [179 kB]
Get:2 http://ftp.tw.debian.org/debian bookworm/main amd64 dnsperf amd64 2.10.0-2 [79.8 kB]
Fetched 259 kB in 0s (745 kB/s)
Selecting previously unselected package libldns3:amd64.
(Reading database ... 64174 files and directories currently installed.)
Preparing to unpack .../libldns3_1.8.3-1+b1_amd64.deb ...
Unpacking libldns3:amd64 (1.8.3-1+b1) ...
Selecting previously unselected package dnsperf.
Preparing to unpack .../dnsperf_2.10.0-2_amd64.deb ...
Unpacking dnsperf (2.10.0-2) ...
Setting up libldns3:amd64 (1.8.3-1+b1) ...
Setting up dnsperf (2.10.0-2) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for libc-bin (2.36-9+deb12u9) ...
++
===== 2.建立壓測查詢清單 =====
* Exp. google.com, facebook.com ...
echo "google.com A
facebook.com A
youtube.com A
amazon.com A
wikipedia.org A" > queries.txt
===== 3.執行壓測 =====
* Exp. DNS : 192.168.11.6
dnsperf -s 192.168.11.6 -d queries.txt -c 20 -l 30
測試結果:
root@aac:~# dnsperf -s 192.168.11.6 -d queries.txt -c 20 -l 30
DNS Performance Testing Tool
Version 2.10.0
[Status] Command line: dnsperf -s 192.168.11.6 -d queries.txt -c 20 -l 30
[Status] Sending queries (to 192.168.11.6:53)
[Status] Started at: Sat Feb 22 06:48:14 2025
[Status] Stopping after 30.000000 seconds
[Status] Testing complete (time limit)
Statistics:
Queries sent: 573736
Queries completed: 573736 (100.00%)
Queries lost: 0 (0.00%)
Response codes: NOERROR 9997 (1.74%), REFUSED 563739 (98.26%)
Average packet size: request 29, response 29
Run time (s): 30.000292
Queries per second: 19124.347190
Average Latency (s): 0.003655 (min 0.000152, max 0.482989)
Latency StdDev (s): 0.006873