forked from menandmice-services/dns-monitoring-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test07.sh
executable file
·24 lines (21 loc) · 823 Bytes
/
test07.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# Test 7 - test that all authoritative server for a zone respond on
# TCP/IPv4. Count is tested against the number of delegation
# authoritative servers for the zone.
echo " == #7 - IPv4 (TCP) zone response tests == "
# get TLD for the zone
tld=$(echo ${1} | rev | cut -d'.' -f 1 | rev)
# pick one TLD auth server
tldns=$(dig ns ${1}. +short | tail -1)
# query and count the delegation NS records for the zone
parentnsnum=$(dig @${tldns} ns ${1} +short | wc -l)
# query the authoritative DNS servers for the zone
childnsnum=$(dig -4 ${1} +nssearch +tcp | wc -l)
if [ "${parentnsnum}" -eq "${childnsnum}" ]
then
echo "all authoritative DNS-Server answer"
else
echo "Error: Mismatch"
echo "Auth DNS-Servers in Delegation: ${parentnsnum}"
echo "Auth DNS-Servers in answering: ${childnsnum}"
fi