#!/bin/bash # Script Version: 02 # Description: Periodically verify consistency between ns1, ns2, and Google nameserver DNS records for a specific domain. # Set Variables # ======== NS1="23.88.113.138" NS2="116.202.112.180" GOOGLE_NS="8.8.8.8" DOMAIN="es1.dynproxy.net" LOG_FILE="/var/log/dns_health_check.log" # Main Process # ======== IP_NS1=$(dig @$NS1 $DOMAIN A +short) IP_NS2=$(dig @$NS2 $DOMAIN A +short) IP_GOOGLE=$(dig @$GOOGLE_NS $DOMAIN A +short) if [ "$IP_NS1" == "$IP_NS2" ] && [ "$IP_NS1" == "$IP_GOOGLE" ]; then echo "[$(date)] DNS records are consistent across all nameservers: $IP_NS1" >> "$LOG_FILE" else echo "[$(date)] DNS inconsistency detected!" >> "$LOG_FILE" echo "[$(date)] ns1: $IP_NS1, ns2: $IP_NS2, Google: $IP_GOOGLE" >> "$LOG_FILE" fi