1.. highlight:: console
2
3kxdpgun – DNS benchmarking tool
4===============================
5
6Synopsis
7--------
8
9:program:`kxdpgun` [*options*] **-i** *filename* *targetIP*
10
11Description
12-----------
13
14Powerful generator of DNS traffic, sending and receiving packets through XDP.
15
16Queries are generated according to a textual file which is read sequentially
17in a loop until a configured duration elapses. The order of queries is not
18guaranteed. Responses are received (unless disabled) and counted, but not
19checked against queries.
20
21The number of parallel threads is autodetected according to the number of queues
22configured for the network interface.
23
24Options
25.......
26
27**-t**, **--duration** *seconds*
28  Duration of traffic generation, specified as a decimal number in seconds
29  (default is 5.0).
30
31**-T**, **--tcp**
32  Send queries over TCP.
33
34**-Q**, **--qps** *queries*
35  Number of queries-per-second (approximately) to be sent (default is 1000).
36  The program is not optimized for low speeds at which it may lose
37  communication packets. The recommended minimum speed is 2 packets per thread
38  (Rx/Tx queue).
39
40**-b**, **--batch** *size*
41  Send more queries in a batch. Improves QPS but may affect the counterpart's
42  packet loss (default is 10 for UDP and 1 for TCP).
43
44**-r**, **--drop**
45  Drop incoming responses. Improves QPS, but disables response statistics.
46
47**-p**, **--port** *number*
48  Remote destination port (default is 53).
49
50**-F**, **--affinity** *cpu_spec*
51  CPU affinity for all threads specified in the format [<cpu_start>][s<cpu_step>],
52  where <cpu_start> is the CPU ID for the first thread and <cpu_step> is the
53  CPU ID increment for next thread (default is 0s1).
54
55**-i**, **--infile** *filename*
56  Path to a file with query templates.
57
58**-I**, **--interface** *interface*
59  Network interface for outgoing communication. This can be useful in situations
60  when the interfaces are in a bond for example.
61
62**-l**, **--local** *localIP*\ [**/**\ *prefix*]
63  Override the auto-detected source IP address. If an address range is specified
64  instead, various IPs from the range will be used for different queries uniformly.
65
66*targetIP*
67  The IPv4 or IPv6 address of remote destination.
68
69**-h**, **--help**
70  Print the program help.
71
72**-V**, **--version**
73  Print the program version.
74
75Queries file format
76...................
77
78Each line describes a query in the form:
79
80*query_name* *query_type* [*flags*]
81
82Where *query_name* is a domain name to be queried, *query_type* is a record type
83name, and *flags* is a single character:
84
85**E** Send query with EDNS.
86
87**D** Request DNSSEC (EDNS + DO flag).
88
89Signals
90.......
91
92Sending USR1 signal to a running process triggers current statistics dump
93to the standard output.
94
95Notes
96-----
97
98Linux kernel 4.18+ is required.
99
100The utility has to be executed under root or with these capabilities:
101CAP_NET_RAW, CAP_NET_ADMIN, CAP_SYS_ADMIN, and CAP_SYS_RESOURCE if maximum
102locked memory limit is too low on Linux < 5.11.
103
104The utility allocates source UDP/TCP ports from the range 2000-65535.
105
106Exit values
107-----------
108
109Exit status of 0 means successful operation. Any other exit status indicates
110an error.
111
112Examples
113--------
114
115Manually created queries file::
116
117  abc6.example.com. AAAA
118  nxdomain.example.com. A
119  notzone. A
120  a.example.com. NS E
121  ab.example.com. A D
122  abcd.example.com. DS D
123
124Queries file generated from a zone file (Knot DNS format)::
125
126  cat ZONE_FILE | awk "{print \$1,\$3}" | grep -E "(NS|DS|A|AAAA|PTR|MX|SOA)$" | sort -u -R > queries.txt
127
128Basic usage::
129
130  # kxdpgun -i ~/queries.txt 2001:DB8::1
131
132*Using UDP with increased batch size*::
133
134  # kxdpgun -t 20 -Q 1000000 -i ~/queries.txt -b 20 -p 8853 192.0.2.1
135
136*Using TCP*::
137
138  # kxdpgun -t 20 -Q 100000 -i ~/queries.txt -T -p 8853 192.0.2.1
139
140See Also
141--------
142
143:manpage:`kdig(1)`.
144