#!/bin/bash
if [ -z $1 ]
then
SERVER=8.8.8.8
else
SERVER=$1
fi
for dom in $(cat domains_to_slave.txt)
do
SOA=$(dig +short soa ${dom} \@${SERVER} | cut -f1 -d ' ')
if [ ! -z ${SOA} ]
then
GET_NS=$(dig +short ns ${dom} \@${SOA})
GET_IP=$(dig +short a ${GET_NS} \@${SERVER})
master_ip=$(echo ${GET_IP} | sed 's/ /; /g')
file=$(echo ${dom} | idn --quiet -u)
cat << EOF
zone "${dom}" IN {
type slave;
file "slave/${file}.slave";
masters { ${master_ip}; };
};
EOF
fi
sleep 2
done
# ./gen_slave.sh > /var/named/slave/external.conf
# grep extern /etc/named.conf
include "slave/external.conf";
# rm -f /var/named/slave/*.slave
# service named restart
Запись опубликована в рубрике
IT,
Stuff с метками
bind,
Centos,
named. Добавьте в закладки
постоянную ссылку.