1KXDPGUN(8) Knot DNS KXDPGUN(8)
2
3
4
6 kxdpgun - XDP-powered DNS benchmarking tool
7
9 kxdpgun [options] -i filename target_IP
10
12 Powerful generator of DNS traffic, sending and receiving packets
13 through XDP.
14
15 Queries are generated according to a textual file which is read sequen‐
16 tially in a loop until a configured duration elapses. The order of
17 queries is not guaranteed. Responses are received (unless disabled) and
18 counted, but not checked against queries.
19
20 The number of parallel threads is autodetected according to the number
21 of queues configured for the network interface.
22
23 Parameters
24 filename
25 Path to the queries file. See the description below regarding
26 the file format.
27
28 target_IP
29 The IPv4 or IPv6 address of remote destination.
30
31 Options
32 -t, --duration seconds
33 Duration of traffic generation, specified as a decimal number in
34 seconds (default is 5.0).
35
36 -T, --tcp[=debug_mode]
37 Send queries over TCP. See the list of optional debug modes be‐
38 low.
39
40 -U, --quic[=debug_mode]
41 Send queries over QUIC. See the list of optional debug modes be‐
42 low.
43
44 -Q, --qps queries
45 Number of queries-per-second (approximately) to be sent (default
46 is 1000). The program is not optimized for low speeds at which
47 it may lose communication packets. The recommended minimum speed
48 is 2 packets per thread (Rx/Tx queue).
49
50 -b, --batch size
51 Send more queries in a batch. Improves QPS but may affect the
52 counterpart's packet loss (default is 10 for UDP and 1 for
53 TCP/QUIC).
54
55 -r, --drop
56 Drop incoming responses. Improves QPS, but disables response
57 statistics.
58
59 -p, --port number
60 Remote destination port (default is 53 for UDP/TCP, 853 for
61 QUIC).
62
63 -F, --affinity cpu_spec
64 CPU affinity for all threads specified in the format
65 [<cpu_start>][s<cpu_step>], where <cpu_start> is the CPU ID for
66 the first thread and <cpu_step> is the CPU ID increment for next
67 thread (default is 0s1).
68
69 -i, --infile filename
70 Path to a file with query templates.
71
72 -I, --interface interface
73 Network interface for outgoing communication. This can be useful
74 in situations when the interfaces are in a bond for example.
75
76 -l, --local localIP[/prefix]
77 Override the auto-detected source IP address. If an address
78 range is specified instead, various IPs from the range will be
79 used for different queries uniformly (address range not sup‐
80 ported in the QUIC mode).
81
82 -L, --mac-local
83 Override auto-detected local MAC address.
84
85 -R, --mac-remote
86 Override auto-detected remote MAC address.
87
88 -v, --vlan id
89 Add VLAN 802.1Q header with the given id. VLAN offloading should
90 be disabled.
91
92 -m, --mode mode
93 Set the XDP mode. Supported values are:
94
95 • auto (default) – the XDP mode is selected automatically to
96 achieve the best performance, which means that native driver
97 support is preferred over the generic one, and zero-copy is
98 used if available.
99
100 • copy – the XDP socket copy mode is forced even if zero-copy is
101 available. This can resolve various driver issues, but at the
102 cost of lower performance.
103
104 • generic – the generic XDP implementation is forced even if na‐
105 tive implementation is available. This mode doesn't require
106 support from the driver nor hardware, but offers the worst
107 performance.
108
109 -G, --qlog path
110 Generate qlog files in the directory specified by path. The di‐
111 rectory has to exist.
112
113 This option is ignored if not in the QUIC mode. The recommended
114 usage is with --quic=R or with low QPS. Otherwise, too many
115 files are generated.
116
117 -h, --help
118 Print the program help.
119
120 -V, --version
121 Print the program version.
122
123 Queries file format
124 Each line describes a query in the form:
125
126 query_name query_type [flags]
127
128 Where query_name is a domain name to be queried, query_type is a record
129 type name, and flags is a single character:
130
131 E Send query with EDNS.
132
133 D Request DNSSEC (EDNS + DO flag).
134
135 TCP/QUIC debug modes
136 0 Perform full handshake for all connections (QUIC only).
137
138 1 Just send SYN (Initial) and receive SYN-ACK (Handshake).
139
140 2 Perform TCP/QUIC handshake and don't send anything, allow close
141 initiated by counterpart.
142
143 3 Perform TCP/QUIC handshake and don't react further.
144
145 5 Send incomplete query (N-1 bytes) and don't react further.
146
147 7 Send query and don't ACK the response or anything further.
148
149 8 Don't close the connection and ignore close by counterpart.
150
151 9 Operate normally except for not ACKing the final FIN+ACK (TCP
152 only).
153
154 R Instead of opening a connection for each query, reuse connec‐
155 tions.
156
157 Signals
158 Sending USR1 signal to a running process triggers current statistics
159 dump to the standard output.
160
162 Linux kernel 4.18+ is required.
163
164 The utility has to be executed under root or with these capabilities:
165 CAP_NET_RAW, CAP_NET_ADMIN, CAP_SYS_ADMIN, CAP_IPC_LOCK, and
166 CAP_SYS_RESOURCE (Linux < 5.11).
167
168 The utility allocates source UDP/TCP ports from the range 2000-65535.
169
171 Exit status of 0 means successful operation. Any other exit status in‐
172 dicates an error.
173
175 Manually created queries file:
176
177 abc6.example.com. AAAA
178 nxdomain.example.com. A
179 notzone. A
180 a.example.com. NS E
181 ab.example.com. A D
182 abcd.example.com. DS D
183
184 Queries file generated from a zone file (Knot DNS format):
185
186 cat ZONE_FILE | awk "{print \$1,\$3}" | grep -E "(NS|DS|A|AAAA|PTR|MX|SOA)$" | sort -u -R > queries.txt
187
188 Basic usage:
189
190 # kxdpgun -i ~/queries.txt 2001:DB8::1
191
192 Using UDP with increased batch size:
193
194 # kxdpgun -t 20 -Q 1000000 -i ~/queries.txt -b 20 -p 8853 192.0.2.1
195
196 Using TCP:
197
198 # kxdpgun -t 20 -Q 100000 -i ~/queries.txt -T -p 8853 192.0.2.1
199
201 kdig(1).
202
204 CZ.NIC Labs <https://www.knot-dns.cz>
205
207 Copyright 2010–2023, CZ.NIC, z.s.p.o.
208
209
210
211
2123.3.2 2023-10-20 KXDPGUN(8)