Skip to content

Commit

Permalink
✨ enable also TCP based DNS queries by appending '-T' to DNS server IP
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmerz committed Feb 14, 2024
1 parent a865575 commit 9eae325
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion 01_dnsping.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cd ~/dev/dnspingtest_rrd/ || exit 1
PING=/usr/bin/dnsping
COUNT=4 # higher count = smoother / finer "loss" scale; lower count = less caching effects
DEADLINE=1 # even 1s (1000ms) is much too long to wait for!
tcp=''

# ---
# inspired by: https://github.com/gitthangbaby/dnsperftest/blob/patch-1/dnstest_random#L28-L35
Expand Down Expand Up @@ -38,7 +39,7 @@ dnsping_host() {
domain=${domain:=heise.de}
fi
echo "querying $domain for $1"
output="$($PING -q -c $COUNT -w $DEADLINE -s "$1" "$domain" 2>&1)"
output="$($PING "$tcp" -q -c $COUNT -w $DEADLINE -s "$1" "$domain" 2>&1)"
# notice $output is quoted to preserve newlines
temp=$(echo "$output"| awk '
BEGIN {pl=100; rtt=0.1}
Expand Down Expand Up @@ -73,6 +74,11 @@ fi
resolverlist="$(grep -v ^\# dnsresolvers.list)"
[ -z "$resolverlist" ] && exit 1
for resolver in $resolverlist; do
if echo "$resolver"|grep -q 'T'; then
resolver="$(echo "$resolver"|cut -d "-" -f1)"
tcp="-T"
echo $resolver $tcp
fi
# create rrd-file from scratch if not existing:
if ! [ -f data/dnsping_"${resolver}".rrd ]; then
/usr/bin/rrdtool create data/dnsping_"${resolver}".rrd \
Expand Down
4 changes: 4 additions & 0 deletions 02_dnsping-graph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ resolverlist="$(grep -v ^\# dnsresolvers.list)"
[ -z "$resolverlist" ] && exit 1
for resolver in $resolverlist; do

if echo "$resolver"|grep -q 'T'; then
resolver="$(echo "$resolver"|cut -d "-" -f1)"
fi

# create html-file from "template" if not existing:
for file in index_"$resolver"*.html; do
if [ ! -e "$file" ]; then
Expand Down
4 changes: 2 additions & 2 deletions dnsresolvers.list
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@
193.110.81.0
193.110.81.9
185.253.5.9
76.76.2.38
76.76.2.39
76.76.2.38-T
76.76.2.39-T

0 comments on commit 9eae325

Please sign in to comment.