42 bind-正反向区域配置
程序员文章站
2022-05-11 23:13:17
...
dns配置流程
- 1.配置区域
- 2.配置区域数据库文件
- 3.服务重载
正向解析
1.配置解析一个正向区域
vim /etc/named.rfc1912.zones
zone "leicc.com" IN {
type master;
file "leicc.com.zone";
};
2.建立区域数据文件
vim /var/named/leicc.com.zone
$TTL 3600
@ IN SOA @ ADMIN1.leicc.com (
20180812
1H
10M
3D
1D)
IN NS ns1
IN A 192.168.113.129 #匹配不输入www
ns1 IN A 192.168.113.128
www IN A 192.168.113.129
www IN A 192.168.113.128
web IN CNAME www
* IN A 192.168.113.149 #匹配默认
3.检查语法
- named-checkconf
- named-checkzone leicc.com /var/named/leicc.com.zone
- rndc reload
4.测试
dig -t A web.leizhichao.com @192.168.113.128
; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7 <<>> -t A web.leizhichao.com @192.168.113.128
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 2
====
反向解析
1.定义区域
zone "113.168.192.in-addr.arpa" IN { 、
type master;
file "leicc.com.zone";
};
2.定义数据库文件
vim /var/named/leicc.com.zone
$TTL 3600
@ IN SOA ns1.leicc.com. ADMIN1.leicc.com. (
20180812
1H
10M
3D
1D )
IN NS ns1.leicc.com.
128 IN PTR ns1.leicc.com.
127 IN PTR mx1.leicc.com.
126 IN PTR bbs.leicc.com.
3. 验证结果
dig -x 192.168.113.128
;