主域名解析服务器脚本
Posted capf
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了主域名解析服务器脚本相关的知识,希望对你有一定的参考价值。
#!/bin/bash
#dns脚本
#窦艳如
#2019-08-25
read -p "请输入从服务器网址:" dou
read -p "请输入主服务器网址:" yan
read -p "请输入服务器名字:" ru
read -p "正向解析文件:" yun
read -p "反向解析文件:" ji
yum -y install bind &>/dev/null
if [ $? = 0 ]
then
echo "以安装完毕"
else
echo "包以存在"
fi
cat << END > /etc/named.conf
options
directory "/var/named";
;
zone "$ru" IN
type master;
file "$yun";
allow-transfer $dou; ;
;
zone "200.168.192.in-addr.arpa" IN
type master;
file "$ji";
allow-transfer $dou; ;
;
END
cat << END > /var/named/$yun
\$TTL 86400
@ IN SOA $ru. mail.dou.com. (
20190826
1D
1H
1W
1H
)
NS ns1.dou.com.
NS ns2.dou.com.
ns1 A $yan
ns2 A $dou
www A 192.168.200.114
END
cat << END > /var/named/$ji
\$TTL 86400
@ IN SOA $ru. mail.dou.com. (
20190826
1D
1H
1W
1H
)
NS ns1.dou.com.
NS ns2.dou.com.
113 PTR ns1.dou.com.
112 PTR ns2.dou.com.
114 PTR www.dou.com.
END
cat << END >> /etc/resolv.conf
nameserver $yan
nameserver $dou
END
cat << END >> /etc/hosts
$yan ns1.dou.com
$dou ns2.dou.com
END
#dns脚本
#窦艳如
#2019-08-25
read -p "请输入从服务器网址:" dou
read -p "请输入主服务器网址:" yan
read -p "请输入服务器名字:" ru
read -p "正向解析文件:" yun
read -p "反向解析文件:" ji
yum -y install bind &>/dev/null
if [ $? = 0 ]
then
echo "以安装完毕"
else
echo "包以存在"
fi
cat << END > /etc/named.conf
options
directory "/var/named";
;
zone "$ru" IN
type master;
file "$yun";
allow-transfer $dou; ;
;
zone "200.168.192.in-addr.arpa" IN
type master;
file "$ji";
allow-transfer $dou; ;
;
END
cat << END > /var/named/$yun
\$TTL 86400
@ IN SOA $ru. mail.dou.com. (
20190826
1D
1H
1W
1H
)
NS ns1.dou.com.
NS ns2.dou.com.
ns1 A $yan
ns2 A $dou
www A 192.168.200.114
END
cat << END > /var/named/$ji
\$TTL 86400
@ IN SOA $ru. mail.dou.com. (
20190826
1D
1H
1W
1H
)
NS ns1.dou.com.
NS ns2.dou.com.
113 PTR ns1.dou.com.
112 PTR ns2.dou.com.
114 PTR www.dou.com.
END
cat << END >> /etc/resolv.conf
nameserver $yan
nameserver $dou
END
cat << END >> /etc/hosts
$yan ns1.dou.com
$dou ns2.dou.com
END
systemctl start named
systemctl enable named
systemctl enable named
以上是关于主域名解析服务器脚本的主要内容,如果未能解决你的问题,请参考以下文章