Linux 脚本----DNS脚本
#!/bin/bash
#zxs
#安装dns
if
[ $(rpm -q bind)="bind" ]
then
echo "安装"
else
yum -y install bind
echo "安装完成"
fi
#配置
echo "nameserver 192.168.221.8" >> /etc/resolv.conf
echo "192.168.221.8 ns.zxs.com" >> /etc/hosts
cat << EOF > /etc/named.conf
options {
directory "/var/named";
};
zone "zxs.com" IN {
type master;
file "zxs.zheng";
};
EOF
cat << EOF > /var/named/zxs.zheng
\$TTL 86400
@ IN SOA zxs.com. admin.zxs.com. (
111
3H
15M
1W
1D
)
IN NS ns.zxs.com.
IN MX 10 mail.zxs.com.
ns IN A 192.168.221.8
www IN A 192.168.221.8
mail IN A 192.168.221.9
EOF
#改组
chown :named /var/named/zxs.zheng
systemctl stop firewalld
iptables -F
setenforce 0
systemctl start named
if [ $? -eq 0 ]
then
echo "完成"
else
echo "重做"
fi