shell指令碼之dns安裝配置

來源:互聯網
上載者:User

標籤:please   domain   master   file   

conf="/var/named/chroot/etc/named.conf"

datadir="/var/named/chroot/var/named"

rpm -q bind &> /dev/null

if [ $? -ne 0 ];then

yum -y install bind bind-chroot caching*

echo "

options {

directory \"/var/named\";

};

" > $conf

fi

read -p "please input domain:" domain

grep $domain $conf &> /dev/null

if [ $? -ne 0 ];then

echo "

zone \"$domain\" in {

type master;

file \"$domain\";

};

" >> $conf

echo "

\$ttl 86400

@insoa$domain.root.$domain. (

2014010101

3h

15m

1w

1d

)

" > $datadir/$domain

fi


while true

do

read -p "please type of record:(ns/a/mx/cname)" type

case $type in

ns)

read -p "head of FQDN:" head

read -p "ip address:" ip

read -p "Are you sure?(yes/no)" yn

if [ $yn != yes ];then

continue

fi


echo "

@inns$head

$headina$ip

" >> $datadir/$domain

;;

a)

read -p "head of FQDN:" head

read -p "ip address:" ip

read -p "Are you sure?(yes/no)" yn

if [ $yn != yes ];then

continue

fi

echo "

$headina$ip

" >> $datadir/$domain

;;

mx)

read -p "head of FQDN:" head

read -p "ip address:" ip

read -p "priority:" priority

read -p "Are you sure?(yes/no)" yn

if [ $yn != yes ];then

continue

fi

echo "

@inmx$priority$head

$headina$ip

" >> $datadir/$domain


;;

cname)

read -p "aliase of FQDN:" aliase

read -p "hostname:" hostname

read -p "Are you sure?(yes/no)" yn

if [ $yn != yes ];then

continue

fi

echo "

$aliaseincname$hostname

" >> $datadir/$domain

;;

*)

echo "usage: type of record (ns/a/mx/cname)"

esac

read -p "continue to do?(yes/no)" yn

if [ $yn != yes ];then

break

fi

done

service named restart


shell指令碼之dns安裝配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.