部署正向解析DNS脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了部署正向解析DNS脚本相关的知识,希望对你有一定的参考价值。
#!/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脚本的主要内容,如果未能解决你的问题,请参考以下文章