1,現象
[c:\~]$ nslookup
默認服務器: UnKnown
Address: 10.1.1.1
> server 172.30.0.1
DNS request timed out.
timeout was 2 seconds.
默認服務器: [172.30.0.1]
Address: 172.30.0.1
> uat.bacic.com
*** 請求 [172.30.0.1] 超時
服務器: [172.30.0.1]
Address: 172.30.0.1
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
2,直接設置server 172.30.1.1 解析是超時的,應該就是本地安裝的dns解析失敗了,一直都沒有解析到
3,檢查配置
cat /etc/named.rfc1912.zones // named.rfc1912.zones: // // Provided by Red Hat caching-nameserver package // // ISC BIND named zone configuration for zones recommended by // RFC 1912 section 4.1 : localhost TLDs and address zones // and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt // (c)2007 R W Franks // // See /usr/share/doc/bind*/sample/ for example named configuration files. // zone "localhost.localdomain" IN { type master; file "named.localhost"; allow-update { none; }; }; zone "localhost" IN { type master; file "named.localhost"; allow-update { none; }; }; zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN { type master; file "named.loopback"; allow-update { none; }; }; zone "1.0.0.127.in-addr.arpa" IN { type master; file "named.loopback"; allow-update { none; }; }; zone "0.in-addr.arpa" IN { type master; file "named.empty"; allow-update { none; }; };
配置里面沒有bacic.com.zone 的配置文件
增加如下配置
zone "bacic.com" IN { type master; file "bacic.com.zone"; allow-update { none; }; };
在/var/named 增加bacic.com.zone的文件
$TTL 1D $ORIGIN bacic.com. @ IN SOA cbsv.bacic5i5j.com. admin.com. ( 20170526; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum bacic.com. IN NS ns1.bacic.com. ns1 IN A 172.30.1.22 harbor IN A 172.30.1.64 pinpoint IN A 172.30.1.53 grafana IN A 172.30.1.42 uat IN A 172.30.1.22
4,systemctl restart named 重啟
5,常用命令
dig uat.bacic.com @172.30.1.1 直接解析dns
no errror 表示解析正確,查詢成功
nxdomain 表示服務器提示不存在這樣的名稱
servfail 表示服務器停機或者dnssec響應驗證失敗
refused dns拒絕回答(也許是出於訪問控制的原因)
nslookup uat.bacic.com 解析dns
nslookup
sever 172.30.1.1 指定dns
uat.bacic.com
rndc reload 可以直接生效dns配置