二.DNS正反向解析
1.解析要求
NS 192.168.136.135
www.test.com 192.168.136.135
www.test.com 192.168.136.136
mail.test.com 192.168.136.137
ftp 别名 www
2.配置区域文件/etc/named/named.conf添加下面配置
zone
3.配置正向区域数据文件
$TTL 60@ IN SOA ns1.test.com. admin.test.com. ( 2015 5D 5M 1H ) @ IN NS ns1 @ IN MX 10 mail ns1 IN A 192.168.136.135mail IN A 192.168.136.137www IN A 192.168.136.136www IN A 192.168.136.135ftp IN CNAME www
4.配置反向区解析域数据文件
$TTL IN PTR mail.test.com.
5.测试
正向
[root@localhost named]# dig -t NS test.com //测试NS记录 ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> -t NS test.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23944;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1;; QUESTION SECTION: ;test.com. IN NS ;; ANSWER SECTION: test.com. 60 IN NS ns1.test.com. ;; ADDITIONAL SECTION: ns1.test.com. 60 IN A 192.168.136.135;; Query time: 1 msec ;; SERVER:
[root@localhost named]# dig -t A www.test.com //测试www.test.com 的A记录 ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> -t A www.test.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58748 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;www.test.com. IN A ;; ANSWER SECTION: www.test.com. 60 IN A 192.168.136.135 //下一个请求会更换上下顺序,负载均衡 www.test.com. 60 IN A 192.168.136.136;; AUTHORITY SECTION: test.com. 60 IN NS ns1.test.com.
反向
[root@localhost named]# dig -x 192.168.136.135 ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> -x 192.168.136.135 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23414 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;135.136.168.192.in-addr.arpa. IN PTR ;; ANSWER SECTION: 135.136.168.192.in-addr.arpa. 60 IN PTR 135.136.168.192.in-addr.arpa. 60 IN PTR ns1.test.com.
;; AUTHORITY SECTION:136.168.1
注意:配置文件格式一定要写正确,名称也要写正确。