配置正反向解析服务
1 主机
- dns服务器 10.1.1.5
2 安装dns服务
[root@server01 ~]# yum -y install bind
3 配置主配置文件定义监听方式
[root@server01 ~]# vim /etc/named.conf
1.png
4 配置子配置文件定义正向与反向域文件
[root@server01 ~]# vim /etc/named.rfc1912.zones
2.png
5 配置正向解析域文件
[root@server01 lib]# cd /var/named/
3.png
[root@server01 named]# cp -a named.localhost lizhip.cn.zone
[root@server01 named]# vim lizhip.cn.zone
4.png
6 配置反向解析域文件
[root@server01 named]# cp -a named.loopback 172.16.100.zone
[root@server01 named]# vim 172.16.100.zone
5.png
7 指定dns服务器ip
[root@server01 named]# echo nameserver 10.1.1.5 > /etc/resolv.conf
8 语法检测,不报错就ok.
[root@server01 named]# named-checkconf /etc/named.conf
[root@server01 named]# named-checkconf /etc/named.rfc1912.zones
[root@server01 named]# named-checkzone ./lizhip.cn.zone ./lizhip.cn.zone
[root@server01 named]# named-checkzone ./172.16.100.zone ./172.16.100.zone
9 启动服务
[root@server01 named]# systemctl start named
[root@server01 named]# netstat -tnlp | grep named
tcp 0 0 10.1.1.5:53 0.0.0.0:* LISTEN 6147/named
tcp 0 0 10.2.2.5:53 0.0.0.0:* LISTEN 6147/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 6147/named
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 6147/named
tcp6 0 0 ::1:53 :::* LISTEN 6147/named
tcp6 0 0 ::1:953 :::* LISTEN 6147/named
10 nslookup测试解析
正向的解析测试:
[root@server01 named]# nslookup nginx.lizhip.cn
Server: 10.1.1.5
Address: 10.1.1.5#53
Name: nginx.lizhip.cn
Address: 172.16.100.31
[root@server01 named]# nslookup nfs.lizhip.cn
Server: 10.1.1.5
Address: 10.1.1.5#53
Name: nfs.lizhip.cn
Address: 172.16.100.32
反向的解析测试:
[root@server01 named]# nslookup 172.16.100.33
Server: 10.1.1.5
Address: 10.1.1.5#53
33.100.16.172.in-addr.arpa name = zabbix.lizhip.cn.
[root@server01 named]# nslookup 172.16.100.250
Server: 10.1.1.5
Address: 10.1.1.5#53
250.100.16.172.in-addr.arpa name = dns.lizhip.cn.










网友评论