#!/bin/bash
#
yum install bind -y
yum install caching-nameserver -y
echo "Please input your domain:"
read DOMAIN
echo "Please input your network,Usage:[0.168.192]:"
read NET
echo "Please input your IP:"
read IP
LAST=`echo $IP |cut -d"." -f4`
cat >> /etc/named.conf << EOF
options {
directory "/var/named";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "localhost.zone";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
};
zone "$DOMAIN" IN {
type master;
file "$DOMAIN.zone";
};
zone "$NET.in-addr.arpa" IN {
type master;
file "$NET.zone";
};
EOF
chown :named /etc/named.conf
echo "/etc/named.conf created successfully..."
cat >> /var/named/$DOMAIN.zone << EOF
\$TTL 86400
\$ORIGIN $DOMAIN.
@ IN SOA $DOMAIN. root.$DOMAIN. (
`date +%Y%m%d`01
1H
10M
1W
1D )
IN NS ns
IN MX 10 mail
ns IN A $IP
mail IN A $IP
imap IN A $IP
EOF
cat >> /var/named/$NET.zone << EOF
\$TTL 86400
@ IN SOA $DOMAIN. root.$DOMAIN. (
`date +%Y%m%d`01
1H
10M
1W
1D )
IN NS ns.$DOMAIN.
IN MX 10 mail.$DOMAIN.
$LAST IN PTR ns.$DOMAIN.
$LAST IN PTR mail.$DOMAIN.
$LAST IN PTR imap.$DOMAIN.
EOF
chown :named /var/named/$DOMAIN.zone /var/named/$NET.zone
echo "/var/named/$DOMAIN.zone , /var/named/$NET.zone created successfully..."
阅读(1251) | 评论(0) | 转发(0) |