码迷,mamicode.com
首页 > 其他好文 > 详细

部署正向解析DNS脚本

时间:2018-11-22 02:34:09      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:init.d   脚本   soa   invalid   config   sysconfig   sys   reboot   tar   

#!/bin/bash

#This is DNS server script
#Make KingApple Li
#tel 1501032****

#change hostname and network
sed -i ‘2c HOSTNAME=ns.duanyufei.org‘ /etc/sysconfig/network
sed -i ‘$a DNS1=192.168.10.10‘ /etc/sysconfig/network-scripts/ifcfg-eth0 
/etc/init.d/network restart

#mount and install DNS server
mount /dev/sr0/ /mnt/
yum -y install bind bind-utils
cp /etc/named.conf /etc/named.conf.bak

#change DNS configuration file
sed -i ‘11 s/127.0.0.1/192.168.10.10/‘ /etc/named.conf
sed -i ‘12 s/^/#/‘ /etc/named.conf
sed -i ‘17 s/^/#/‘ /etc/named.conf
sed -i ‘20,21 s/yes/no/‘ /etc/named.conf
sed -i ‘37 s/\./duanyufei.org/‘ /etc/named.conf
sed -i ‘38 s/hint/master/‘ /etc/named.conf
sed -i ‘39 s/named.ca/duanyufei.org.zone/‘ /etc/named.conf

#change DNS zone configuration file
cp /var/named/named.empty /var/named/duanyufei.org.zone
sed -i ‘2d‘ /var/named/duanyufei.org.zone
sed -i ‘1a @       IN SOA  duanyufei.org. rname.invalid. (‘ /var/named/duanyufei.org.zone
sed -i ‘8 s/@/ns.duanyufei.org./‘ /var/named/duanyufei.org.zone
sed -i ‘8a ns      A       192.168.10.10‘ /var/named/duanyufei.org.zone
sed -i ‘10 s/A/MX  10/‘ /var/named/duanyufei.org.zone
sed -i ‘10 s/127.0.0.1/mail.duanyufei.org./‘ /var/named/duanyufei.org.zone
sed -i ‘10a mail    A       192.168.10.10‘ /var/named/duanyufei.org.zone
sed -i ‘$d‘ /var/named/duanyufei.org.zone
sed -i ‘$a www     A       192.168.10.20‘ /var/named/duanyufei.org.zone
sed -i ‘$a @       A       192.168.10.10‘ /var/named/duanyufei.org.zone

#change file slave
chown named:named /var/named/duanyufei.org.zone

#reboot server
/etc/init.d/named start

部署正向解析DNS脚本

标签:init.d   脚本   soa   invalid   config   sysconfig   sys   reboot   tar   

原文地址:http://blog.51cto.com/14013608/2320243

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!