本文共 3229 字,大约阅读时间需要 10 分钟。
workstation.lab.example.com 192.168.1.22
[root@workstation ~]# yum install -y bind bind-utils
close firewalld and selinux
[root@workstation ~]# systemctl stop firewalld
[root@workstation ~]# systemctl disable firewalld[root@workstation ~]# setenforce 0
将本机的dns指向自己
[root@workstation named]# vi /etc/resolv.conf
# Generated by NetworkManagersearch lab.example.comnameserver 192.168.1.22
Modify configure
[root@workstation ~]# vi /etc/named.conf
options { listen-on port 53 { any; }; allow-query { any; };
[root@workstation ~]# vi /etc/named.rfc1912.zones
zone "lab.example.com" IN { type master; file "workstation.zone"; allow-update { none; };};zone "1.168.192.in-addr.arpa" IN { type master; file "192.zone"; allow-update { none; };};
[root@workstation named]# cd /var/named/
[root@workstation named]# cp -p named.localhost workstation.zone[root@workstation named]# cp -p named.loopback 192.zone
添加正向解析
[root@workstation named]# vi workstation.zone
$TTL 1D@ IN SOA workstation.lab.example.com. root( 2017 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum@ IN NS workstation.lab.example.com. A 127.0.0.1 AAAA ::1workstation IN A 192.168.1.22servera IN A 192.168.1.23serverb IN A 192.168.1.24
添加反向解析
[root@workstation named]# vi 192.zone
$TTL 1D@ IN SOA workstation.lab.example.com. root( 2017 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum@ IN NS workstation.lab.example.com. A 127.0.0.1 AAAA ::122 PTR workstation.lab.example.com.23 PTR servera.lab.example.com.24 PTR serverb.lab.example.com.
检查配置有无问题
[root@workstation named]# named-checkconf
[root@workstation named]# named-checkzone workstation.lab.example.com workstation.zone[root@workstation named]# named-checkzone 1.168.192.in-addr.arpa 192.zone
开启服务
[root@workstation named]# systemctl start named
[root@workstation named]# systemctl enable named注释
$TTL 1D @ IN SOA workstation.lab.example.com. root( ---DNS服务器的名称 2017 ; serial 仅作为序列号而已 1D ; refresh 服务器的更新时间 1H ; retry 重新更新时间间隔 1W ; expire 多久之后宣布失败 3H ) ; minimum 相当于缓存记忆时间 @ IN NS workstation.lab.example.com. 管理这个领域的服务器主机名字 @ IN MX 5 mail.lab.example.com. 接收邮件服务器的主机名(5为优先级别) A 127.0.0.1 AAAA ::1 workstation IN A 192.168.1.22 www IN A 192.168.1.22 mail IN A 192.168.1.22
转载于:https://blog.51cto.com/11732619/2044617