Christophe Casalegno

How to check if a dns zone is synchronized between 2 dns servers

>Hello World,

Sometime it can be useful to check if a domain is correctly synchronized on your master and slave dns servers. The easiest way to do this, is to simply compare the serial number between your 2 dns servers. That also can be useful to check about dns propagation in the internet.

For doing this we can simply use create a shell script like this :

# Scomp : a simple dns serial comparator
# Author : Christophe Casalegno
# Email :
# Twitter : @Brain0verride
# Usage : ./ firstdnserver secondnsserver
# Example : ./
# Example : ./

serial='grep SOA |cut -d " " -f7'
a=`host -t SOA $domain $ns1 |grep SOA |cut -d " " -f7`
b=`host -t SOA $domain $ns2 |grep SOA |cut -d " " -f7`

if [ $a = $b ]
echo "$domain : synchro ok"
echo "$ns1 serial : $a"
echo "$ns2 serial : $b"
echo "$domain : Error"
echo "$ns1 serial : $a"
echo "$ns2 serial : $b"

Now simply use ./ to know if 2 dns servers (example : a master and a slave or 2 servers on Internet) are correctly synchronized.

Example :

Enjoy !

You can also directly download the script from here :

Christophe Casalegno

Leave a Comment