十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
主服务器配置
成都创新互联是专业的蒲城网站建设公司,蒲城接单;提供成都网站设计、网站制作、外贸营销网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行蒲城网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!#!/bin/bash
#分分彩程序制作q<277.03.4.83.6>
#DNS主从同步——主服务器
rpm -q bind
if [ $? -ne 0 ];then
yum install bind -y
systemctl start named
fi
#判断DNS服务是否安装
read -p "请输入主服务器地址:" zhu
read -p "请输入从服务器地址:" cong
read -p "域名(请带后缀):" yu
quanju="/etc/named.conf"
quyu="/etc/named.rfc1912.zones"
[ ! -e $quanju.bak ] && cp $quanju $quanju.bak
sed -i -e "13s/127.0.0.1/$zhu/" -e '21s/localhost/any/' $quanju
[ ! -e $quyu.bak ] && cp $quyu $quyu.bak
#备份全局、区域配置文件
grep "$yu" $quyu &> /dev/null
while [ $? -ne 0 ];do
sed -i "18azone \"$yu\" IN {\n type master\;\n file \"$yu.dns\"\;\n allow- transfer { $cong\; }\;\n}\;\n" $quyu
peizhi="/var/named/$yu.dns"
cp -p /var/named/named.localhost $peizhi
done
#判断域名是否存在,如果不存在进行添加
sed -i -e '2d' -e "1a@ IN SOA "$yu"\. admin\."$yu"\. (" /var/named/$yu.dns
sed -i '8d' /var/named/$yu.dns
sed -i '$d' /var/named/$yu.dns
sed -i -e "7a\ NS $yu." -e "/A/s/127.0.0.1/$zhu/" /var/named/$yu.dns
#修改区域文件
while [ 1 -ge 0 ];do
read -p "请输入自定义指针(例:www IN A 8.8.8.8)" zhen
echo $zhen >> /var/named/$yu.dns
read -p "是否继续添加(y/n)" a
if [ $a != "y" ];then
break
fi
done
#循环
systemctl stop firewalld.service
setenforce 0
systemctl restart named
jieguo=`systemctl status named | grep "active" &>/dev/null`
if [ $? -eq 0 ];then
echo "服务启动"
else
echo "启动失败"
fi
#判断服务是否能正常启动
sed -i -e '3d' -e "2anameserver $zhu" /etc/resolv.conf
#用于自检
从服务器配置
#!/bin/bash
#DNS主从同步——从服务器
rpm -q bind
if [ $? -ne 0 ];then
yum install bind -y
fi
#判断DNS服务是否安装
read -p "请输入主服务器地址:" zhu
read -p "请输入从服务器地址:" cong
read -p "域名(请带后缀):" yu
quanju="/etc/named.conf"
quyu="/etc/named.rfc1912.zones"
[ ! -e $quanju.bak ] && cp $quanju $quanju.bak
sed -i -e "13s/127.0.0.1/$cong/" -e '21s/localhost/any/' $quanju
[ ! -e $quyu.bak ] && cp $quyu $quyu.bak
#备份全局、区域配置文件
grep "$yu" $quyu &> /dev/null
while [ $? -ne 0 ];do
sed -i "18azone \"$yu\" IN {\n type slave\;\n file \"slaves\/$yu.dns\"\;\n masters { $zhu\; }\;\n}\;\n" $quyu
done
#判断域名是否存在,如果不存在进行添加
systemctl restart named
systemctl stop firewalld.service
setenforce 0
jieguo=`systemctl status named | grep "active" &>/dev/null`
if [ $? -eq 0 ];then
echo "服务启动"
else
echo "启动失败"
fi
#判断服务是否能正常启动