DNS 用のストレスツールである kxdpgun をいろいろ試してみました。
※ここでは実際に設定、動作したものを掲載していますが、内容について保証するものではありません。流用される場合は各自の責任でお願いします。
DNS 用のストレスツールの比較を行いました。「DNS 用ストレスツールの比較」をご参照ください。
kxdpgun を実施する OS のバージョンは以下のとおりです。
[root@rocky8-client ~]# uname -a
Linux rocky8-client.mydomain 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 17:00:45 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
kxdpgun のバージョンは以下のとおりです。
[root@rocky8-client ~]# kxdpgun --version
kxdpgun (Knot DNS), version 3.3.10
参考:kxdpgun のインストール
EPEL リポジトリインストール
[root@rocky8-client ~]# dnf install epel-release -y
- 省略 -
インストール済み:
epel-release-8-18.el8.noarch
完了しました!
[root@rocky8-client ~]#
kxdpgun のインストール
[root@rocky8-client ~]# dnf install knot-dnsutils -y
- 省略 -
インストール済み:
knot-libs-3.3.10-1.el8.x86_64 knot-utils-3.3.10-1.el8.x86_64
完了しました!
[root@rocky8-client ~]#
参考:kxdpgun のヘルプ
[root@rocky8-client ~]# kxdpgun -h
Usage: kxdpgun [options] -i <queries_file> <dest_ip>
Options:
-t, --duration <sec> Duration of traffic generation.
(default is 5 seconds)
-T, --tcp[=debug_mode] Send queries over TCP.
-U, --quic[=debug_mode] Send queries over QUIC.
-Q, --qps <qps> Number of queries-per-second (approximately) to be sent.
(default is 1000 qps)
-b, --batch <size> Send queries in a batch of defined size.
(default is 10 for UDP, 1 for TCP)
-r, --drop Drop incoming responses (disables response statistics).
-p, --port <port> Remote destination port.
(default is 53 for UDP/TCP, 853 for QUIC)
-F, --affinity <spec> CPU affinity in the format [<cpu_start>][s<cpu_step>].
(default is 0s1)
-i, --infile <file> Path to a file with query templates.
-I, --interface <ifname> Override auto-detected interface for outgoing communication.
-l, --local <ip[/prefix]> Override auto-detected source IP address or subnet.
-L, --local-mac <MAC> Override auto-detected local MAC address.
-R, --remote-mac <MAC> Override auto-detected remote MAC address.
-v, --vlan <id> Add VLAN 802.1Q header with the given id.
-e, --edns-size <size> EDNS UDP payload size, range 512-4096 (default 1232)
-m, --mode <mode> Set XDP mode (auto, copy, generic).
-G, --qlog <path> Output directory for qlog (useful for QUIC only).
-h, --help Print the program help.
-V, --version Print the program version.
Parameters:
<dest_ip> IPv4 or IPv6 address of the remote destination.
[root@rocky8-client ~]#
概要
- クエリデータをファイルに登録し、kxdpgun コマンドに読み込ませることでクエリを送信することができます。
- クエリリクエストの RD フラグは 1(再帰問い合わせ)のため、基本的にはスタブリゾルバからキャッシュ DNS へ負荷をかけるためのツールと思われます。ヘルプでは、RD フラグを 0(非再起問い合わせ)として送信するためのオプションは見当たりませんでした。ただし、権威 DNS が再帰問い合わせを拒否しなければ(再帰問い合わせを拒否する権威 DNS が存在するかは承知していません)、権威 DNS へ負荷をかけることも可能です。(*1)
- トランスポートのデフォルトは UDP です。-T オプションを指定することで TCP に変更することが可能です。
- UDP 通信時のクエリレスポンスで truncated(切り捨て)発生しても TCP フォールバックは行われません。
- 試験期間はデフォルトで 5 秒(-t オプションで変更可能)です。期間中、指定ファイルのクエリデータは繰り返し使用されます。期間中のクエリリクエストの件数は -Q オプションで指定する qps で決まります。(当然ですが環境のスペックにより指定した qps を満たせない場合があります)
- ヘルプではクエリ毎の timeout 値を指定するオプションは見当たりませんでした(デフォルト値も不明です)。ですので RTT(Round-Trip Time)を制限して検証したい、というようなことは難しいかもしれません。
*1 BIND では権威 DNS 用の構成(下記の named.conf 抜粋参照)でも、再帰問い合わせに応答していました。
recursion no;
allow-query { any; };
allow-recursion { none; };
allow-query-cache { none; };
検証では kxdpgun 実行中にパケットをキャプチャしています。ただし、kxdpgun は XDP(*2)に対応しており、クライアント(スタブリゾルバ)側では wireshark、tcpdump ともにパケットをキャプチャできませんでした。ここで掲載しているパケットキャプチャのログは、すべて DNS サーバ側で取得したものです。
*2 Linux Kernel のプロトコルスタックの初期段階でパケットを処理する技術らしいです。おそらくですがパケットキャプチャソフトまでパケットが届いていないものと思われます。
キャッシュ DNS へ UDP でクエリ
kxdpgun はデフォルトでは UDP でクエリリクエストを送信します。
クエリデータを登録したファイルを用意します。
[root@rocky8-client kxdpgun]# cat test.com.lst
always1.test.com A
[root@rocky8-client kxdpgun]#
以下の条件で実施します。
(-t) 試験期間に 1 秒を指定
(-Q) qps に 1 を指定
(-b) クエリリクエストを一度に送信する件数に 1 を指定(*1)
(-i) クエリのリストファイルに test.com.lst を指定
試験対象の DNS サーバに cachedns(/etc/hosts 登録済み)を指定
*1 -b オプションについては別途検証します。
「概要」に記載しましたが、-t で指定した時間(秒)、クエリリクエストを送信し続けます。今回は最小件数で動作を確認したいため、-t に 1 を指定しています。ただし、少しわかりずらいのですが、kxdpgun では -t で指定した時間の最後にもクエリリクエストが送信されるようです。例えば、-Q 1(1 qps)で -t 1(試験期間 1 秒)の場合、0 秒(開始時)と 1 秒後にそれぞれクエリリクエストが送信されます。(下記ログでは試験期間 1 秒に対し、クエリは 2 件計上されています)
[root@rocky8-client kxdpgun]# kxdpgun -t 1 -Q 1 -b 1 -i test.com.lst cachedns
using interface enp0s3, XDP threads 1, IPv4/UDP, emulated mode
thread#00: sent 2, received 2
total queries: 2 (2 pps) (200.000000%) <<リクエスト件数(リクエスト件数/秒)
total replies: 2 (2 pps) (100.000000%) <<レスポンス件数(レスポンス件数/秒)
average DNS reply size: 118 B
average Ethernet reply rate: 2560 bps (0.00 Mbps)
responded NOERROR: 2
duration: 1 s <<試験期間
[root@rocky8-client kxdpgun]#
以下は、kxdpgun 実行中のパケットキャプチャのログです。
x.x.x.44 はクライアント(スタブリゾルバ)、x.x.x.40 はキャッシュ DNS のアドレスです。クエリリクエストのパケット(#1)では RD(Recursion desired)を 1(再帰問い合わせ)としてリクエストしています。
[root@rocky8-dns02 ~]# tshark -i 1 -f "host 10.0.2.44 and port 53" -w /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp0s3'
4 ^C
[root@rocky8-dns02 ~]# tshark -t a -r /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
1 16:29:10.716261871 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0x215f A always1.test.com
2 16:29:10.752750830 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0x215f A always1.test.com A 2.3.4.5 NS ns1.test.com NS ns2.test.com A 10.0.2.32 A 10.0.2.32
3 16:29:11.717749052 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0x215f A always1.test.com
4 16:29:11.718412322 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0x215f A always1.test.com A 2.3.4.5 NS ns1.test.com NS ns2.test.com A 10.0.2.32 A 10.0.2.32
[root@rocky8-dns02 ~]# tshark -nn -r /tmp/test.pcap -Y '(frame.number==1)' -V | grep ^Domain -A10|cat -n
Running as user "root" and group "root". This could be dangerous.
1 Domain Name System (query)
2 Transaction ID: 0x215f
3 Flags: 0x0100 Standard query
4 0... .... .... .... = Response: Message is a query
5 .000 0... .... .... = Opcode: Standard query (0)
6 .... ..0. .... .... = Truncated: Message is not truncated
7 .... ...1 .... .... = Recursion desired: Do query recursively
8 .... .... .0.. .... = Z: reserved (0)
9 .... .... ...0 .... = Non-authenticated data: Unacceptable
10 Questions: 1
11 Answer RRs: 0
[root@rocky8-dns02 ~]#
キャッシュ DNS へ TCP でクエリ
TCP でクエリリクエストを送信する場合は、kxdpgun に -T オプションを指定します。
クエリデータを登録したファイルを用意します。
[root@rocky8-client kxdpgun]# cat test.com.lst
always1.test.com A
[root@rocky8-client kxdpgun]#
以下の条件で実施します。
(-t) 試験期間に 1 秒を指定
(-Q) qps に 1 を指定
(-T) トランスポートに TCP を指定
(-b) クエリリクエストを一度に送信する件数に 1 を指定(*1)
(-i) クエリのリストファイルに test.com.lst を指定
試験対象の DNS サーバに cachedns(/etc/hosts 登録済み)を指定
*1 -b オプションについては別途検証します。
[root@rocky8-client kxdpgun]# kxdpgun -t 1 -Q 1 -b 1 -T -i test.com.lst cachedns
using interface enp0s3, XDP threads 1, IPv4/TCP, emulated mode
thread#00: sent 2, received 2
total SYNs: 2 (2 pps) (200.000000%)
total established: 2 (2 pps) (100.000000%)
total replies: 2 (2 pps) (100.000000%)
total closed: 2 (2 pps) (100.000000%)
average DNS reply size: 118 B
average Ethernet reply rate: 11744 bps (0.01 Mbps)
responded NOERROR: 2
duration: 1 s
[root@rocky8-client kxdpgun]#
以下は、kxdpgun 実行中のパケットキャプチャのログです。
x.x.x.44 はクライアント(スタブリゾルバ)、x.x.x.40 はキャッシュ DNS のアドレスです。TCP の 3WAY ハンドシェイク(#1-3)の後、クエリリクエスト(#4)が送信されています。
[root@rocky8-dns02 ~]# tshark -i 1 -f "host 10.0.2.44 and port 53" -w /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp0s3'
25 ^C
[root@rocky8-dns02 ~]# tshark -t a -r /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
1 16:38:10.929126920 10.0.2.44 → 10.0.2.40 TCP 62 2000 → 53 [SYN] Seq=0 Win=0 Len=0 WS=1 MSS=1220
2 16:38:10.929313481 10.0.2.40 → 10.0.2.44 TCP 62 53 → 2000 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 WS=128
3 16:38:10.930695713 10.0.2.44 → 10.0.2.40 TCP 60 2000 → 53 [ACK] Seq=1 Ack=1 Win=65535 Len=0
4 16:38:10.932545355 10.0.2.44 → 10.0.2.40 DNS 90 Standard query 0x3e61 A always1.test.com
5 16:38:10.932568394 10.0.2.40 → 10.0.2.44 TCP 54 53 → 2000 [ACK] Seq=1 Ack=37 Win=29312 Len=0
6 16:38:10.943827455 10.0.2.40 → 10.0.2.44 DNS 174 Standard query response 0x3e61 A always1.test.com A 2.3.4.5 NS ns1.test.com NS ns2.test.com A 10.0.2.32 A 10.0.2.32
7 16:38:11.148014374 10.0.2.40 → 10.0.2.44 TCP 174 [TCP Retransmission] 53 → 2000 [PSH, ACK] Seq=1 Ack=37 Win=29312 Len=120
8 16:38:11.555530356 10.0.2.40 → 10.0.2.44 TCP 174 [TCP Retransmission] 53 → 2000 [PSH, ACK] Seq=1 Ack=37 Win=29312 Len=120
9 16:38:11.931759754 10.0.2.44 → 10.0.2.40 TCP 62 2001 → 53 [SYN] Seq=0 Win=0 Len=0 WS=1 MSS=1220
10 16:38:11.931831521 10.0.2.40 → 10.0.2.44 TCP 62 53 → 2001 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 WS=128
11 16:38:11.936207983 10.0.2.44 → 10.0.2.40 TCP 60 2000 → 53 [ACK] Seq=37 Ack=121 Win=65535 Len=0
12 16:38:11.938458954 10.0.2.44 → 10.0.2.40 TCP 60 2000 → 53 [FIN, ACK] Seq=37 Ack=121 Win=65535 Len=0
13 16:38:11.939752939 10.0.2.44 → 10.0.2.40 TCP 60 2001 → 53 [ACK] Seq=1 Ack=1 Win=65535 Len=0
14 16:38:11.940332545 10.0.2.44 → 10.0.2.40 DNS 90 Standard query 0x3e61 A always1.test.com
15 16:38:11.940340484 10.0.2.40 → 10.0.2.44 TCP 54 53 → 2001 [ACK] Seq=1 Ack=37 Win=29312 Len=0
16 16:38:11.940977958 10.0.2.40 → 10.0.2.44 TCP 54 53 → 2000 [FIN, ACK] Seq=121 Ack=38 Win=29312 Len=0
17 16:38:11.941677618 10.0.2.40 → 10.0.2.44 DNS 174 Standard query response 0x3e61 A always1.test.com A 2.3.4.5 NS ns1.test.com NS ns2.test.com A 10.0.2.32 A 10.0.2.32
18 16:38:12.155914947 10.0.2.40 → 10.0.2.44 TCP 174 [TCP Retransmission] 53 → 2001 [PSH, ACK] Seq=1 Ack=37 Win=29312 Len=120
19 16:38:12.579583046 10.0.2.40 → 10.0.2.44 TCP 174 [TCP Retransmission] 53 → 2001 [PSH, ACK] Seq=1 Ack=37 Win=29312 Len=120
20 16:38:12.755815468 10.0.2.40 → 10.0.2.44 TCP 54 [TCP Retransmission] 53 → 2000 [FIN, ACK] Seq=121 Ack=38 Win=29312 Len=0
21 16:38:12.932630451 10.0.2.44 → 10.0.2.40 TCP 60 2000 → 53 [ACK] Seq=38 Ack=122 Win=65535 Len=0
22 16:38:12.936114396 10.0.2.44 → 10.0.2.40 TCP 60 2001 → 53 [ACK] Seq=37 Ack=121 Win=65535 Len=0
23 16:38:12.939417086 10.0.2.44 → 10.0.2.40 TCP 60 2001 → 53 [FIN, ACK] Seq=37 Ack=121 Win=65535 Len=0
24 16:38:12.940254342 10.0.2.40 → 10.0.2.44 TCP 54 53 → 2001 [FIN, ACK] Seq=121 Ack=38 Win=29312 Len=0
25 16:38:12.946046818 10.0.2.44 → 10.0.2.40 TCP 60 2001 → 53 [ACK] Seq=38 Ack=122 Win=65535 Len=0
[root@rocky8-dns02 ~]#
権威 DNS へ UDP でクエリ
クエリリクエストの送信先に権威 DNS を指定して実施します。
クエリデータを登録したファイルを用意します。
[root@rocky8-client kxdpgun]# cat test.com.lst
always1.test.com A
[root@rocky8-client kxdpgun]#
以下の条件で実施します。
(-t) 試験期間に 1 秒を指定
(-Q) qps に 1 を指定
(-b) クエリリクエストを一度に送信する件数に 1 を指定
(-i) クエリのリストファイルに test.com.lst を指定
試験対象の DNS サーバに dns-testcom(/etc/hosts 登録済み。test.com の NS)を指定
[root@rocky8-client kxdpgun]# kxdpgun -t 1 -Q 1 -b 1 -i test.com.lst dns-testcom
using interface enp0s3, XDP threads 1, IPv4/UDP, emulated mode
thread#00: sent 2, received 2
total queries: 2 (2 pps) (200.000000%) <<リクエスト件数(リクエスト件数/秒)
total replies: 2 (2 pps) (100.000000%) <<レスポンス件数(レスポンス件数/秒)
average DNS reply size: 50 B
average Ethernet reply rate: 1472 bps (0.00 Mbps)
responded NOERROR: 2
duration: 1 s
[root@rocky8-client kxdpgun]#
以下は、kxdpgun 実行中のパケットキャプチャのログです。
x.x.x.44 はクライアント(スタブリゾルバ)、x.x.x.32 は権威 DNS(test.com の NS) のアドレスです。権威 DNS には BIND を使用していますが、再帰問い合わせ(RD(Recursion desired) = 1)に対してもレスポンスを返しています。
[root@rocky8-dns02 ~]# tshark -i 1 -f "host 10.0.2.44 and port 53" -w /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp0s3'
4 ^C
[root@rocky8-dns02 ~]# tshark -t a -r /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
1 17:21:09.246842344 10.0.2.44 → 10.0.2.32 DNS 76 Standard query 0x506b A always1.test.com
2 17:21:09.252572201 10.0.2.32 → 10.0.2.44 DNS 92 Standard query response 0x506b A always1.test.com A 2.3.4.5
3 17:21:10.248763211 10.0.2.44 → 10.0.2.32 DNS 76 Standard query 0x506b A always1.test.com
4 17:21:10.257753691 10.0.2.32 → 10.0.2.44 DNS 92 Standard query response 0x506b A always1.test.com A 2.3.4.5
[root@rocky8-dns02 ~]# tshark -nn -r /tmp/test.pcap -Y '(frame.number==1)' -V | grep ^Domain -A10|cat -n
Running as user "root" and group "root". This could be dangerous.
1 Domain Name System (query)
2 Transaction ID: 0x506b
3 Flags: 0x0100 Standard query
4 0... .... .... .... = Response: Message is a query
5 .000 0... .... .... = Opcode: Standard query (0)
6 .... ..0. .... .... = Truncated: Message is not truncated
7 .... ...1 .... .... = Recursion desired: Do query recursively
8 .... .... .0.. .... = Z: reserved (0)
9 .... .... ...0 .... = Non-authenticated data: Unacceptable
10 Questions: 1
11 Answer RRs: 0
[root@rocky8-dns02 ~]#
truncated(切り捨て)発生時の動作
UDP でクエリリクエストを送信した場合、クエリレスポンスの RR(Resource Record)サイズが大きいと(DNS サーバの設定にもよりますが)truncated(切り捨て)が発生します。dig では、UDP を TCP に変更し、再度クエリリクエストを送信します。これを TCP フォールバックといいます。「概要」で述べたとおりですが、kxdpgun は TCP フォールバックには対応していません。
まずは dig で TCP フォールバックが行われる様子を確認します。(2 行目に Truncated が表示されています)
[root@rocky8-client kxdpgun]# dig @cachedns bigtxt.test.co.jp TXT
;; Truncated, retrying in TCP mode.
; <<>> DiG 9.11.36-RedHat-9.11.36-16.el8_10.4 <<>> @cachedns bigtxt.test.co.jp TXT
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30136
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 46efe85ad9925a38a7183a51685d062f7351adf2de37100f (good)
;; QUESTION SECTION:
;bigtxt.test.co.jp. IN TXT
;; ANSWER SECTION:
bigtxt.test.co.jp. 604800 IN TXT "123456789.1234 -長いので省略- 56789.123456789."
;; AUTHORITY SECTION:
test.co.jp. 604800 IN NS ns2.test.jp.
test.co.jp. 604800 IN NS ns1.test.jp.
;; ADDITIONAL SECTION:
ns1.test.jp. 604800 IN A 10.0.2.28
ns2.test.jp. 604800 IN A 10.0.2.29
;; Query time: 2 msec
;; SERVER: 10.0.2.40#53(10.0.2.40)
;; WHEN: 木 6月 26 17:34:55 JST 2025
;; MSG SIZE rcvd: 5209
[root@rocky8-client kxdpgun]#
以下は、dig 実行中のパケットキャプチャのログです。
x.x.x.44 はクライアント(スタブリゾルバ)、x.x.x.40 はキャッシュ DNS のアドレスです。クエリリクエスト(#1)に対するクエリレスポンス(#2)の Truncated は 1(切り捨て発生)であり、続けてTCP フォールバック(#3 以降)が行われています。
[root@rocky8-client ~]# tshark -i 1 -f "port 53" -w /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp0s3'
18 ^C
[root@rocky8-client ~]# tshark -t a -r /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
1 17:34:55.145282519 10.0.2.44 → 10.0.2.40 DNS 100 Standard query 0x6bc5 TXT bigtxt.test.co.jp OPT
2 17:34:55.170792036 10.0.2.40 → 10.0.2.44 DNS 116 Standard query response 0x6bc5 TXT bigtxt.test.co.jp OPT
3 17:34:55.171620993 10.0.2.44 → 10.0.2.40 TCP 74 44807 → 53 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=3550261983 TSecr=0 WS=128
4 17:34:55.172323290 10.0.2.40 → 10.0.2.44 TCP 74 53 → 44807 [SYN, ACK] Seq=0 Ack=1 Win=28960 Len=0 MSS=1460 SACK_PERM=1 TSval=233888321 TSecr=3550261983 WS=128
5 17:34:55.172825633 10.0.2.44 → 10.0.2.40 TCP 66 44807 → 53 [ACK] Seq=1 Ack=1 Win=29312 Len=0 TSval=3550261984 TSecr=233888321
6 17:34:55.174029872 10.0.2.44 → 10.0.2.40 DNS 142 Standard query 0x75b8 TXT bigtxt.test.co.jp OPT
7 17:34:55.174825328 10.0.2.40 → 10.0.2.44 TCP 66 53 → 44807 [ACK] Seq=1 Ack=77 Win=29056 Len=0 TSval=233888323 TSecr=3550261985
8 17:34:55.176086850 10.0.2.40 → 10.0.2.44 TCP 1514 53 → 44807 [ACK] Seq=1 Ack=77 Win=29056 Len=1448 TSval=233888324 TSecr=3550261985 [TCP segment of a reassembled PDU]
9 17:34:55.176096229 10.0.2.44 → 10.0.2.40 TCP 66 44807 → 53 [ACK] Seq=77 Ack=1449 Win=32128 Len=0 TSval=3550261987 TSecr=233888324
10 17:34:55.176167982 10.0.2.40 → 10.0.2.44 TCP 1514 53 → 44807 [ACK] Seq=1449 Ack=77 Win=29056 Len=1448 TSval=233888324 TSecr=3550261985 [TCP segment of a reassembled PDU]
11 17:34:55.176173981 10.0.2.44 → 10.0.2.40 TCP 66 44807 → 53 [ACK] Seq=77 Ack=2897 Win=35072 Len=0 TSval=3550261987 TSecr=233888324
12 17:34:55.176241019 10.0.2.40 → 10.0.2.44 TCP 1514 53 → 44807 [ACK] Seq=2897 Ack=77 Win=29056 Len=1448 TSval=233888324 TSecr=3550261985 [TCP segment of a reassembled PDU]
13 17:34:55.176245905 10.0.2.44 → 10.0.2.40 TCP 66 44807 → 53 [ACK] Seq=77 Ack=4345 Win=37888 Len=0 TSval=3550261987 TSecr=233888324
14 17:34:55.176310965 10.0.2.40 → 10.0.2.44 DNS 933 Standard query response 0x75b8 TXT bigtxt.test.co.jp TXT NS ns2.test.jp NS ns1.test.jp A 10.0.2.28 A 10.0.2.29 OPT
15 17:34:55.176316824 10.0.2.44 → 10.0.2.40 TCP 66 44807 → 53 [ACK] Seq=77 Ack=5212 Win=40832 Len=0 TSval=3550261987 TSecr=233888324
16 17:34:55.180252291 10.0.2.44 → 10.0.2.40 TCP 66 44807 → 53 [FIN, ACK] Seq=77 Ack=5212 Win=40832 Len=0 TSval=3550261991 TSecr=233888324
17 17:34:55.181073084 10.0.2.40 → 10.0.2.44 TCP 66 53 → 44807 [FIN, ACK] Seq=5212 Ack=78 Win=29056 Len=0 TSval=233888330 TSecr=3550261991
18 17:34:55.181080570 10.0.2.44 → 10.0.2.40 TCP 66 44807 → 53 [ACK] Seq=78 Ack=5213 Win=40832 Len=0 TSval=3550261992 TSecr=233888330
[root@rocky8-client ~]# tshark -nn -r /tmp/test.pcap -Y '(frame.number==2)' -V | grep ^Domain -A10|cat -n
Running as user "root" and group "root". This could be dangerous.
1 Domain Name System (response)
2 Transaction ID: 0x6bc5
3 Flags: 0x8380 Standard query response, No error
4 1... .... .... .... = Response: Message is a response
5 .000 0... .... .... = Opcode: Standard query (0)
6 .... .0.. .... .... = Authoritative: Server is not an authority for domain
7 .... ..1. .... .... = Truncated: Message is truncated <<切り捨て発生
8 .... ...1 .... .... = Recursion desired: Do query recursively
9 .... .... 1... .... = Recursion available: Server can do recursive queries
10 .... .... .0.. .... = Z: reserved (0)
11 .... .... ..0. .... = Answer authenticated: Answer/authority portion was not authenticated by the server
[root@rocky8-client ~]#
次に kxdpgun では TCP フォールバックが行われないことを確認します。
クエリデータを登録したファイルを用意します。
[root@rocky8-client kxdpgun]# cat test.co.jp.lst
bigtxt.test.co.jp TXT
[root@rocky8-client kxdpgun]#
以下の条件で実施します。
(-t) 試験期間に 1 秒を指定
(-Q) qps に 1 を指定
(-b) クエリリクエストを一度に送信する件数に 1 を指定
(-i) クエリのリストファイルに test.co.jp.lst を指定
試験対象の DNS サーバに cachedns(/etc/hosts 登録済み)を指定
[root@rocky8-client kxdpgun]# kxdpgun -t 1 -Q 1 -b 1 -i test.co.jp.lst cachedns
using interface enp0s3, XDP threads 1, IPv4/UDP, emulated mode
thread#00: sent 2, received 2
total queries: 2 (2 pps) (200.000000%) <<リクエスト件数(リクエスト件数/秒)
total replies: 2 (2 pps) (100.000000%) <<レスポンス件数(レスポンス件数/秒)
average DNS reply size: 35 B
average Ethernet reply rate: 1232 bps (0.00 Mbps)
responded NOERROR: 2
duration: 1 s
[root@rocky8-client kxdpgun]#
以下は、kxdpgun 実行中のパケットキャプチャのログです。
x.x.x.44 はクライアント(スタブリゾルバ)、x.x.x.40 はキャッシュ DNS のアドレスです。クエリリクエスト(#1)に対するクエリレスポンス(#2)の Truncated は 1(切り捨て発生)ですが、TCP フォールバックは行われていません。
[root@rocky8-dns02 ~]# tshark -i 1 -f "host 10.0.2.44 and port 53" -w /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp0s3'
4 ^C
[root@rocky8-dns02 ~]# tshark -t a -r /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
1 17:43:17.854233925 10.0.2.44 → 10.0.2.40 DNS 77 Standard query 0x8170 TXT bigtxt.test.co.jp
2 17:43:17.855119544 10.0.2.40 → 10.0.2.44 DNS 77 Standard query response 0x8170 TXT bigtxt.test.co.jp
3 17:43:18.855765269 10.0.2.44 → 10.0.2.40 DNS 77 Standard query 0x8170 TXT bigtxt.test.co.jp
4 17:43:18.857277287 10.0.2.40 → 10.0.2.44 DNS 77 Standard query response 0x8170 TXT bigtxt.test.co.jp
[root@rocky8-dns02 ~]# tshark -nn -r /tmp/test.pcap -Y '(frame.number==2)' -V | grep ^Domain -A10|cat -n
Running as user "root" and group "root". This could be dangerous.
1 Domain Name System (response)
2 Transaction ID: 0x8170
3 Flags: 0x8380 Standard query response, No error
4 1... .... .... .... = Response: Message is a response
5 .000 0... .... .... = Opcode: Standard query (0)
6 .... .0.. .... .... = Authoritative: Server is not an authority for domain
7 .... ..1. .... .... = Truncated: Message is truncated <<切り捨て発生
8 .... ...1 .... .... = Recursion desired: Do query recursively
9 .... .... 1... .... = Recursion available: Server can do recursive queries
10 .... .... .0.. .... = Z: reserved (0)
11 .... .... ..0. .... = Answer authenticated: Answer/authority portion was not authenticated by the server
[root@rocky8-dns02 ~]#
timeout 発生時の動作
kxdpgun のクエリ毎の timeout 値はヘルプにも記載がなくわかりませんでした。レスポンスを 5000 ms ~ 9500 ms 遅延させるクエリデータを用意し、クエリリクエストを送信しましたが、timeout は発生せず、クエリレスポンスは全件 NOERROR でした。
クエリデータを登録したファイルを用意します。
[root@rocky8-client kxdpgun]# cat test.com.lst
always.slp5000.test.com A
always.slp5500.test.com A
always.slp6000.test.com A
always.slp6500.test.com A
always.slp7000.test.com A
always.slp7500.test.com A
always.slp8000.test.com A
always.slp8500.test.com A
always.slp9000.test.com A
always.slp9500.test.com A
[root@rocky8-client kxdpgun]#
以下の条件で実施します。
以下の条件で実施します。
(-t) 試験期間に 10 秒を指定
(-Q) qps に 1 を指定
(-b) クエリリクエストを一度に送信する件数に 10 を指定
(-i) クエリのリストファイルに test.com.lst を指定
試験対象の DNS サーバに dns-testcom(/etc/hosts 登録済み。test.com の NS)を指定
[root@rocky8-client kxdpgun]# kxdpgun -t 10 -Q 1 -b 10 -i test.com.lst dns-testcom
using interface enp0s3, XDP threads 1, IPv4/UDP, emulated mode
thread#00: sent 20, received 20
total queries: 20 (2 pps) (200.000000%) <<リクエスト件数(リクエスト件数/秒)
total replies: 20 (2 pps) (100.000000%) <<レスポンス件数(レスポンス件数/秒)
average DNS reply size: 57 B
average Ethernet reply rate: 1584 bps (0.00 Mbps)
responded NOERROR: 20
duration: 10 s
[root@rocky8-client kxdpgun]#
以下は、kxdpgun 実行中のパケットキャプチャのログです。
x.x.x.44 はクライアント(スタブリゾルバ)、x.x.x.32 は権威 DNS(test.com の NS) のアドレスです。クエリリクエストに対し、最大で 9500 ms の遅延でクエリレスポンスが返されています。
[root@rocky8-dns01 ~]# tshark -i 1 -f "host 10.0.2.44 and port 53" -w /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp0s3'
40 ^C
[root@rocky8-dns01 ~]# tshark -t a -r /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
1 20:19:34.278383750 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp5000.test.com
2 20:19:34.279844295 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp5500.test.com
3 20:19:34.279864156 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp6000.test.com
4 20:19:34.281116092 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp6500.test.com
5 20:19:34.281122338 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp7000.test.com
6 20:19:34.281730558 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp7500.test.com
7 20:19:34.282966888 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp8000.test.com
8 20:19:34.282975212 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp8500.test.com
9 20:19:34.284090621 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp9000.test.com
10 20:19:34.284112166 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp9500.test.com
11 20:19:39.284523091 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp5000.test.com A 2.3.4.5
12 20:19:39.787499429 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp5500.test.com A 2.3.4.5
13 20:19:40.288471202 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp6000.test.com A 2.3.4.5
14 20:19:40.796965620 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp6500.test.com A 2.3.4.5
15 20:19:41.289908576 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp7000.test.com A 2.3.4.5
16 20:19:41.795007897 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp7500.test.com A 2.3.4.5
17 20:19:42.291295222 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp8000.test.com A 2.3.4.5
18 20:19:42.791193194 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp8500.test.com A 2.3.4.5
19 20:19:43.292063583 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp9000.test.com A 2.3.4.5
20 20:19:43.806579383 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp9500.test.com A 2.3.4.5
21 20:19:44.280334247 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp5000.test.com
22 20:19:44.283462962 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp5500.test.com
23 20:19:44.284795097 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp6000.test.com
24 20:19:44.287109466 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp6500.test.com
25 20:19:44.287756785 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp7000.test.com
26 20:19:44.289699539 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp7500.test.com
27 20:19:44.291093869 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp8000.test.com
28 20:19:44.291098041 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp8500.test.com
29 20:19:44.291098878 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp9000.test.com
30 20:19:44.291486331 10.0.2.44 → 10.0.2.32 DNS 83 Standard query 0xaacf A always.slp9500.test.com
31 20:19:49.287089000 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp5000.test.com A 2.3.4.5
32 20:19:49.792188776 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp5500.test.com A 2.3.4.5
33 20:19:50.290509814 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp6000.test.com A 2.3.4.5
34 20:19:50.791258408 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp6500.test.com A 2.3.4.5
35 20:19:51.292000729 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp7000.test.com A 2.3.4.5
36 20:19:51.799498476 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp7500.test.com A 2.3.4.5
37 20:19:52.297444450 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp8000.test.com A 2.3.4.5
38 20:19:52.804980627 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp8500.test.com A 2.3.4.5
39 20:19:53.321409270 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp9000.test.com A 2.3.4.5
40 20:19:53.812359443 10.0.2.32 → 10.0.2.44 DNS 99 Standard query response 0xaacf A always.slp9500.test.com A 2.3.4.5
[root@rocky8-dns01 ~]#
クエリリクエストの送信件数について
-t、-Q、-b オプションの指定により、クエリリクエストの送信件数がどうなるかを検証します。
前述のとおりですが、-t で指定した時間(秒)、クエリリクエストを送信し続けます。その間 -i で指定されたファイルのデータは繰り返し使用されます。先の説明では省略しましたが、これまでは検証をわかりやすくするため、クエリリクエストを 1 秒間隔で 1 件ずつ送信するためのオプション(-Q 1 -b 1)を指定しています。例えば、-Q 1 -b 1 で試験期間を 2 秒(-t 2)とした場合、0 秒(開始時)、1 秒後、2 秒後の計 3 件クエリリクエストが送信されます。(-t 3 であれば 4 件、-t 4 であれば 5 件のクエリリクエストが送信されます)
クエリデータを登録したファイルを用意します。
[root@rocky8-client kxdpgun]# cat test.com.lst
always1.test.com A
[root@rocky8-client kxdpgun]#
-t 2 指定時の動作を確認します。
(-t) 試験期間に 2 秒を指定
(-Q) qps に 1 を指定
(-b) クエリリクエストを一度に送信する件数に 1 を指定
(-i) クエリのリストファイルに test.com.lst を指定
試験対象の DNS サーバに cachedns(/etc/hosts 登録済み)を指定
[root@rocky8-client kxdpgun]# kxdpgun -t 2 -Q 1 -b 1 -i test.com.lst cachedns
using interface enp0s3, XDP threads 1, IPv4/UDP, emulated mode
thread#00: sent 3, received 3
total queries: 3 (1 pps) (150.000000%) <<リクエスト件数(リクエスト件数/秒)
total replies: 3 (1 pps) (100.000000%) <<レスポンス件数(レスポンス件数/秒)
average DNS reply size: 118 B
average Ethernet reply rate: 1920 bps (0.00 Mbps)
responded NOERROR: 3
duration: 2 s
[root@rocky8-client kxdpgun]#
以下は、kxdpgun 実行中のパケットキャプチャのログです。
x.x.x.44 はクライアント(スタブリゾルバ)、x.x.x.40 はキャッシュ DNS のアドレスです。ファイルに登録されたクエリデータは 1 件ですが、0 秒(開始時)、1 秒後、2 秒後の計 3 回、同じクエリリクエストがファイルから繰り返し読み込まれ送信されています。(実際にはファイルのクエリデータをキャッシュし、再利用しているものと思われますが)
[root@rocky8-dns02 ~]# tshark -i 1 -f "host 10.0.2.44 and port 53" -w /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp0s3'
6 ^C
[root@rocky8-dns02 ~]# tshark -t a -r /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
1 17:25:32.523431317 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xd577 A always1.test.com
2 17:25:32.552491923 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xd577 A always1.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
3 17:25:33.524525075 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xd577 A always1.test.com
4 17:25:33.525054227 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xd577 A always1.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
5 17:25:34.524442359 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xd577 A always1.test.com
6 17:25:34.524897668 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xd577 A always1.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
[root@rocky8-dns02 ~]#
-b は同時に送信するクエリリクエストの件数です。送信間隔は qps を満たすように調整されます。例えば、オプションに -Q 1 -b 2 を指定した場合、クエリリクエストを立て続けに 2 件送信した後、2 秒の間隔をおいて次の 2 件が送信されます。結果として 2 秒で 2 件のクエリリクエスト送信のため 1 qps となります。同様に -Q 1 -b 3 を指定した場合、クエリリクエストを立て続けに 3 件送信した後、3 秒の間隔をおいて次の 3 件が送信されます。この場合 3 秒で 3 件のクエリリクエスト送信のためやはり 1 qps となります。
クエリデータを登録したファイルを用意します。
[root@rocky8-client kxdpgun]# cat test.com.lst
always1.test.com A
always2.test.com A
always3.test.com A
[root@rocky8-client kxdpgun]#
-b 2 指定時の動作を確認します。
(-t) 試験期間に 5 秒を指定
(-Q) qps に 1 を指定
(-b) クエリリクエストを一度に送信する件数に 2 を指定
(-i) クエリのリストファイルに test.com.lst を指定
試験対象の DNS サーバに cachedns(/etc/hosts 登録済み)を指定
[root@rocky8-client kxdpgun]# kxdpgun -t 5 -Q 1 -b 2 -i test.com.lst cachedns
using interface enp0s3, XDP threads 1, IPv4/UDP, emulated mode
thread#00: sent 8, received 7
total queries: 8 (1 pps) (160.000000%) <<リクエスト件数(リクエスト件数/秒)
total replies: 7 (1 pps) (87.500000%) <<レスポンス件数(レスポンス件数/秒)
average DNS reply size: 118 B
average Ethernet reply rate: 1792 bps (0.00 Mbps)
responded NOERROR: 7
duration: 5 s
[root@rocky8-client kxdpgun]#
以下は、kxdpgun 実行中のパケットキャプチャのログです。
x.x.x.44 はクライアント(スタブリゾルバ)、x.x.x.40 はキャッシュ DNS のアドレスです。立て続けにクエリリクエスト(#1 #2)を送信したのち、2 秒の間隔をおいて、次の 2 件(#5 #6)を送信しています。
[root@rocky8-dns02 ~]# tshark -i 1 -f "host 10.0.2.44 and port 53" -w /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp0s3'
16 ^C
[root@rocky8-dns02 ~]# tshark -t a -r /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
1 17:40:53.473064297 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0x6e7b A always1.test.com
2 17:40:53.473111050 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0x6e7b A always2.test.com
3 17:40:53.484664642 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0x6e7b A always2.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
4 17:40:53.485174817 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0x6e7b A always1.test.com A 2.3.4.5 NS ns1.test.com NS ns2.test.com A 10.0.2.32 A 10.0.2.32
5 17:40:55.475861374 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0x6e7b A always3.test.com
6 17:40:55.478650073 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0x6e7b A always1.test.com
7 17:40:55.479410435 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0x6e7b A always1.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
8 17:40:55.488292229 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0x6e7b A always3.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
9 17:40:57.474409814 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0x6e7b A always2.test.com
10 17:40:57.474501569 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0x6e7b A always3.test.com
11 17:40:57.475668303 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0x6e7b A always2.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
12 17:40:57.477569335 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0x6e7b A always3.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
13 17:40:59.473414634 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0x6e7b A always1.test.com
14 17:40:59.474051336 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0x6e7b A always1.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
15 17:40:59.476426963 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0x6e7b A always2.test.com
16 17:40:59.476803399 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0x6e7b A always2.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
[root@rocky8-dns02 ~]#
続けて -b 3 指定時の動作を確認します。
(-t) 試験期間に 5 秒を指定
(-Q) qps に 1 を指定
(-b) クエリリクエストを一度に送信する件数に 3 を指定
(-i) クエリのリストファイルに test.com.lst を指定
試験対象の DNS サーバに cachedns(/etc/hosts 登録済み)を指定
[root@rocky8-client kxdpgun]# kxdpgun -t 5 -Q 1 -b 3 -i test.com.lst cachedns
using interface enp0s3, XDP threads 1, IPv4/UDP, emulated mode
thread#00: sent 9, received 6
total queries: 9 (1 pps) (180.000000%) <<リクエスト件数(リクエスト件数/秒)
total replies: 6 (1 pps) (66.666667%) <<レスポンス件数(レスポンス件数/秒)
average DNS reply size: 118 B
average Ethernet reply rate: 1536 bps (0.00 Mbps)
responded NOERROR: 6
duration: 5 s
[root@rocky8-client kxdpgun]#
以下は、kxdpgun 実行中のパケットキャプチャのログです。
x.x.x.44 はクライアント(スタブリゾルバ)、x.x.x.40 はキャッシュ DNS のアドレスです。立て続けにクエリリクエスト(#1 #2 #3)を送信したのち、3 秒の間隔をおいて、次の 3 件(#7 #8 #9)を送信しています。
[root@rocky8-dns02 ~]# tshark -i 1 -f "host 10.0.2.44 and port 53" -w /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp0s3'
18 ^C
[root@rocky8-dns02 ~]# tshark -t a -r /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
1 17:43:12.054604824 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xf87b A always1.test.com
2 17:43:12.055840325 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xf87b A always2.test.com
3 17:43:12.059120191 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xf87b A always3.test.com
4 17:43:12.065829636 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xf87b A always1.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
5 17:43:12.066790649 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xf87b A always2.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
6 17:43:12.067443771 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xf87b A always3.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
7 17:43:15.055502359 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xf87b A always1.test.com
8 17:43:15.056385407 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xf87b A always2.test.com
9 17:43:15.057294628 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xf87b A always3.test.com
10 17:43:15.057886877 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xf87b A always1.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
11 17:43:15.061061086 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xf87b A always2.test.com A 2.3.4.5 NS ns1.test.com NS ns2.test.com A 10.0.2.32 A 10.0.2.32
12 17:43:15.063892694 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xf87b A always3.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
13 17:43:18.055795216 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xf87b A always1.test.com
14 17:43:18.056619256 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xf87b A always2.test.com
15 17:43:18.057717736 10.0.2.44 → 10.0.2.40 DNS 76 Standard query 0xf87b A always3.test.com
16 17:43:18.058457249 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xf87b A always1.test.com A 2.3.4.5 NS ns2.test.com NS ns1.test.com A 10.0.2.32 A 10.0.2.32
17 17:43:18.059402099 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xf87b A always2.test.com A 2.3.4.5 NS ns1.test.com NS ns2.test.com A 10.0.2.32 A 10.0.2.32
18 17:43:18.059972697 10.0.2.40 → 10.0.2.44 DNS 160 Standard query response 0xf87b A always3.test.com A 2.3.4.5 NS ns1.test.com NS ns2.test.com A 10.0.2.32 A 10.0.2.32
[root@rocky8-dns02 ~]#
大量クエリ
10 万件のクエリデータを作成し、kxdpgun に読み込ませます。
今回、クエリリクエストを 10000 qps(-Q 10000)で要求しましたが、本検証環境のスペックが脆弱なため、kxdpgun のログ表示ではリクエスト 2398 件/秒、レスポンス 224 件/秒でした。DNS サーバ側のパケットキャプチャの集計でも、リクエスト 2398 件/秒(計 71945 件)、レスポンス 254 件/秒(計 7637 件)であり、ほぼ DNS サーバがボトルネックになっているものと思われます。
クエリデータを作成します。(*1)
*1 ここでは権威サーバには PolarDNS を使用しています。PolarDNS は、alwaysX.test.com のクエリリクエストに対し、NOERROR のクエリレスポンスを自動的に返します。ゾーンファイルへの RR の登録を必要としません。
[root@rocky8-client kxdpgun]# rm -f test.com.lst
[root@rocky8-client kxdpgun]# for i in `seq 1 100000`; do
> echo "always${i}.test.com A" >> test.com.lst
> done
[root@rocky8-client kxdpgun]# wc -l test.com.lst
100000 test.com.lst
[root@rocky8-client kxdpgun]# head -n 2 test.com.lst; tail -n 2 test.com.lst
always1.test.com A
always2.test.com A
always99999.test.com A
always100000.test.com A
[root@rocky8-client kxdpgun]#
以下の条件で実施します。
(-t) 試験期間に 30 秒を指定
(-Q) qps に 10000 を指定
(-b) クエリリクエストを一度に送信する件数に 5 を指定
(-i) クエリのリストファイルに test.com.lst を指定
試験対象の DNS サーバに cachedns(/etc/hosts 登録済み)を指定
[root@rocky8-client kxdpgun]# kxdpgun -t 30 -Q 10000 -b 5 -i test.com.lst cachedns
using interface enp0s3, XDP threads 1, IPv4/UDP, emulated mode
thread#00: sent 71945, received 6737
total queries: 71945 (2398 pps) (23.981667%) <<リクエスト件数(リクエスト件数/秒)
total replies: 6737 (224 pps) (9.364098%) <<レスポンス件数(レスポンス件数/秒)
average DNS reply size: 55 B
average Ethernet reply rate: 174753 bps (0.17 Mbps)
responded NOERROR: 1408
responded SERVFAIL: 5329
duration: 30 s
[root@rocky8-client kxdpgun]#
以下は、kxdpgun 実行中のパケットキャプチャのログです。
リクエストが 71945 件に対し、レスポンスは 7637 件にとどまっています。
[root@rocky8-dns02 ~]# tshark -i 1 -f "host 10.0.2.44 and port 53" -w /tmp/test.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp0s3'
79582 ^C
[root@rocky8-dns02 ~]# tshark -t a -r /tmp/test.pcap | grep "Standard query" | grep -v "Standard query response" | wc -l
Running as user "root" and group "root". This could be dangerous.
71945
[root@rocky8-dns02 ~]# tshark -t a -r /tmp/test.pcap | grep "Standard query response" | wc -l
Running as user "root" and group "root". This could be dangerous.
7637
[root@rocky8-dns02 ~]#