Tags
#!/bin/zsh
# Version 01.0
# Script to test DNS zone propagation across ns1, ns2, and ns3
# Script Name: test_ns_zones.sh

# Variables
NS1="23.88.113.138"
NS2="116.202.112.180"
NS3="95.216.198.140"

# Check if a domain name argument is provided
if [ -z "$1" ]; then
	echo "Usage: $0 <domain.tld>"
	exit 1
fi

DOMAIN=$1

# Function to test a DNS query
function test_ns {
	local NS=$1
	echo "
=== Testing $DOMAIN on $NS ==="
	dig @$NS $DOMAIN SOA +short
echo ""
	echo "MX Record:"
	dig @$NS $DOMAIN MX +short
echo ""
	echo "A Record for mail.$DOMAIN:"
	dig @$NS mail.$DOMAIN A +short
echo ""
}

# Test each nameserver
test_ns $NS1
test_ns $NS2
test_ns $NS3

# Success message
echo "DNS zone test completed for $DOMAIN"