#!/bin/bash
cat << END >> /etc/hosts 192.168.200.132 ns1.wangrui.com END echo "hosts文件成功"
cat << EOF >> /etc/resolv.conf nameserver 192.168.200.132 EOF echo "dns文件成功" [ -d /etc/named.conf ] || yum -y install bind bind-utils bind-libs &> /dev/null
echo "bind安装完成" cat << OBG > /etc/named.conf
options { directory "/var/named";
};
zone "wangrui.com" IN { type master; file "wangrui.com.zheng"; }; OBG echo "主配置文件成功" cat << OBGC > /var/named/wangrui.com.zheng \$TTL 1D @ IN SOA wangrui.com. admin.wangrui.com. ( 20190826 1D 1H 1W 3H ) NS ns1.wangrui.com. MX 10 mail.wangrui.com. www A 192.168.200.100 xiao A 192.168.200.151 file CNAME xiao * A 192.168.200.121 OBGC
echo "文件成功" #启动服务 systemctl restart named systemctl enable named