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 "Is 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 "Is 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:"
Read-p "Is 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 "Is 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
The DNS installation configuration for shell scripts