一.搭建dns服务器能够对自定义的正向或者反向域完成数据解析查询。
1.配置环境
[root@localhost ~]# yum install bind
[root@localhost ~]#systemctl stop firewalld
[root@localhost ~]#setenforce 0
2.配置DNS主服务器
[root@localhost ~]# vim /etc/named.conf
options {
listen-on port 53 { 192.168.184.128; };
directory "/var/named";
allow-query { any; };};
zone "openlab.com" IN {
type master;
file "named.openlab.com";
};zone"184.168.192.in-addr.arpa" IN {
type master;
file "named.192";
allow-update{ none; };
};
3.正向解析资源记录文件
[root@localhost ~]# vim /var/named/named.openlab.com
$TTL 1D
@ IN SOA @ tjm.qq.com. (
2024110800
1D
1H
1W
3H )
IN NS ns.openlab.com.
ns IN A 192.168.184.128
www IN A 192.168.184.128
wwww IN CNAME www
4.反向解析记录文件
[root@localhost ~]# vim /var/named/named.192
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.openlab.com.128 PTR ns.openlab.com.
128 PTR www.openlab.com
5.解析测试
[root@localhost ~]# nslookup
> server 192.168.184.128
Default server: 192.168.184.128
Address: 192.168.184.128#53
> www.openlab.com
Server: 192.168.184.128
Address: 192.168.184.128#53Non-authoritative answer:
www.openlab.com canonical name = openlab.com.
Name: openlab.com
Address: 3.33.130.190
Name: openlab.com
Address: 15.197.148.33