#! /bin/bash
#这是正向解析DNS的shell脚本
echo "安装软件包"
yum -y install bind &> /dev/null
echo "编辑主配置文件"
cat << EOF > /etc/named.conf
options {
directory "/var/named";
};
zone "crushlinux.com" IN {
type master;
file "crushlinux.lan";
};
EOF
echo "编辑crushlinux.lan文件"
cat << EOF > /var/named/crushlinux.lan
$TTL 1D
@ IN SOA crushlinux.com. root.ns1.crushlinux.com. (
20190824
1D
1H
1W
3H
)
NS ns1.crushlinux.com.
MX 10 mail.crushlinux.com.
ns1 A 192.168.200.111
www A 192.168.200.112
EOF
echo "修改属主成功"
chgrp named /var/named/crushlinux.lan
echo "修改配置文件"
echo "nameuserver 192.168.200.111" > /etc/resolv.conf
echo "192.168.200.111 ns1.crushlinux.com" >> /etc/hosts
echo "开启服务"
systemctl start named
systemctl enable named