about dnstcpbench
dnstcpbench can generate TCP fallback queries, which is developed by Netherlabs.
build dnstcpbench on Ubuntu12.04
# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"
# uname -ri
3.2.0-49-generic x86_64
|
before building dnstcpbench, install packages which are required to build dnsttcpbench.
# apt-get install autoconf automake bison flex g++ libboost-all-dev libtool make pkg-config ragel zlib1g-dev git
|
build dnstcpbench
# git clone https://github.com/PowerDNS/pdns.git
# cd pdns/
# ./bootstrap
# ./configure --with-modules="" --without-lua
# cd pdns/ ( <- move to pdns/pdns directory )
# make dnstcpbench
# ./dnstcpbench --help
Allowed options:
-h [ --help ] produce help message
-v [ --verbose ] be verbose
-u [ --udp-first ] try UDP first
-f [ --file ] arg source file - if not specified, defaults to stdin
--tcp-no-delay arg (=1) use TCP_NODELAY socket option
--timeout-msec arg (=10) wait for this amount of milliseconds for an answer
--workers arg (=100) number of parallel workers
|
TCP tuning on the dnstcpbench box.
# echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
# ulimit -n 102400
|
create a query list file
# cat query_list.txt
www2.foo.bar A
|
It seems that we need to define query types with capital letter.
run dnstcpbench
When specifying “--udp-first” option, dnstcpbench will send queries over UDP at first. And then if dnstcpbench receives responses are truncated, dnstcpbench will send queries over TCP.
# ./dnstcpbench --udp-first --file=query_list.txt 192.168.11.200 53
Average qps: 1, median qps: 0
Average UDP latency: 928usec, median: 0usec
Average TCP latency: 2540usec, median: 0usec
OK: 1, network errors: 0, other errors: 0
Timeouts: 0
Truncateds: 1, auth answers: 1
|
dnstcpbench : 192.168.11.100
BIND: 192.168.11.200
capture data which was collected on the dnstcpbench box.
# tshark -r aa.pcap
1 0.000000 192.168.11.100 -> 192.168.11.200 DNS 72 Standard query A www2.foo.bar
2 0.000358 192.168.11.200 -> 192.168.11.100 DNS 552 Standard query response A
3 0.000943 192.168.11.100 -> 192.168.11.200 TCP 74 57192 > domain [SYN] Seq=0 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=327321 TSecr=318733 WS=8
4 0.000978 192.168.11.200 -> 192.168.11.100 TCP 74 domain > 57192 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=324122 TSecr=327321 WS=16
5 0.001484 192.168.11.100 -> 192.168.11.200 TCP 66 57192 > domain [ACK] Seq=1 Ack=1 Win=14480 Len=0 TSval=327321 TSecr=324122
|
dnstcpbench supports multi threads
# ./dnstcpbench --udp-first --file=query_list.txt 192.168.11.200 53
Average qps: 943.396, median qps: 1008.31
Average UDP latency: 1190.06usec, median: 1106.41usec
Average TCP latency: 62321.8usec, median: 2659.29usec
OK: 48229, network errors: 0, other errors: 0
Timeouts: 1771
Truncateds: 50000, auth answers: 48229
# top -b -n 1 | grep dnstcp
4666 root 20 0 2821m 31m 1584 S 187 6.3 0:25.74 dnstcpbench
|
on the BIND box
# netstat -an | grep 53
tcp 0 0 192.168.11.200:53 0.0.0.0:* LISTEN
tcp 0 0 192.168.11.200:53 192.168.11.100:59067 SYN_RECV
tcp 0 0 192.168.11.200:53 192.168.11.100:57997 SYN_RECV
tcp 0 0 192.168.11.200:53 192.168.11.100:58066 SYN_RECV
tcp 0 0 192.168.11.200:53 192.168.11.100:58067 SYN_RECV
tcp 0 0 192.168.11.200:53 192.168.11.100:58994 SYN_RECV
tcp 0 0 192.168.11.200:53 192.168.11.100:58009 SYN_RECV
tcp 1 0 192.168.11.200:53 192.168.11.100:59143 CLOSE_WAIT
tcp 1 0 192.168.11.200:53 192.168.11.100:59145 CLOSE_WAIT
tcp 0 0 192.168.11.200:53 192.168.11.100:58064 ESTABLISHED
tcp 0 0 192.168.11.200:53 192.168.11.100:58008 ESTABLISHED
tcp 1 0 192.168.11.200:53 192.168.11.100:59141 CLOSE_WAIT
tcp 0 0 192.168.11.200:53 192.168.11.100:58068 ESTABLISHED
tcp 0 0 192.168.11.200:53 192.168.11.100:59023 ESTABLISHED
tcp 0 0 192.168.11.200:53 192.168.11.100:58059 ESTABLISHED
tcp 32 0 192.168.11.200:53 192.168.11.100:59147 ESTABLISHED
|
awesome tool!
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.