# yum install epel-release
# yum install wget net-tools telnet tree nmap sysstat lrzsz dos2unix bind-utils -y
hdss7-11上
~]# yum install bind -y
~]# vi /etc/named.conf
listen-on port 53 { 10.4.7.11; }; //bind监听地址
allow-query { any; }; //允许任何主机使用该dns
forwarders { 10.4.7.254; }; //上级网关
dnssec-enable no;
dnssec-validation no;
recursion yes; //递归的方式查询
~]# named-checkconf //检查配置
/etc/named.rfc1912.zones
zone "host.com" IN {
type master;
file "host.com.zone";
allow-update { 10.4.7.11; };
};
zone "od.com" IN {
type master;
file "od.com.zone";
allow-update { 10.4.7.11; };
};
/var/named/host.com.zone
$ORIGIN host.com.
$TTL 600 ; 10 minutes
@ IN SOA dns.host.com. dnsadmin.host.com. (
2019111001 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS dns.host.com.
$TTL 60 ; 1 minute
dns A 172.16.10.13
HDSS7-11 A 172.16.10.13
HDSS7-12 A 172.16.10.14
HDSS7-21 A 172.16.10.15
HDSS7-22 A 172.16.10.16
HDSS7-200 A 172.16.10.12
/var/named/od.com.zone
$ORIGIN od.com.
$TTL 600 ; 10 minutes
@ IN SOA dns.od.com. dnsadmin.od.com. (
2019111001 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS dns.od.com.
$TTL 60 ; 1 minute
dns A 172.16.10.13
systemctl start named
systemctl enable named
修改客户端网卡配置文件,将dns指向172.16.10.13
修改主机名: hostnamectl set-hostname hdss7-11.host.com
检查是否配置完成:
dig -t A hdss7-11.host.com @172.16.10.13 +short
dig -t A dns.od.com @172.16.10.13 +short