我的 AWS VPC 网络中设置了一个内部 DNS 设置,我刚刚创建了一个内部负载均衡器并向该负载均衡器添加了 CNAME 记录,但它不起作用。
DNS CNAME 条目:
db1 IN CNAME internal-DB1-1579653487.us-east-1.elb.amazonaws.com.
nslookup 看起来不错:
epf-mac:~ erico$ nslookup -q=CNAME db1
Server: 10.0.200.4
Address: 10.0.200.4#53
db1.example.com canonical name = internal-DB1-1579653487.us-east-1.elb.amazonaws.com.
负载均衡器主机名指向 2 个 IP(负载均衡器在两个子网中工作)。
epf-mac:~ erico$ nslookup internal-DB1-1579653487.us-east-1.elb.amazonaws.com.
Server: 10.0.200.4
Address: 10.0.200.4#53
Non-authoritative answer:
Name: internal-DB1-1579653487.us-east-1.elb.amazonaws.com
Address: 10.0.211.228
Name: internal-DB1-1579653487.us-east-1.elb.amazonaws.com
Address: 10.0.200.65
但实际名字不起作用:
epf-mac:~ erico$ ping db1
ping: cannot resolve db1: Unknown host
epf-mac:~ erico$ dig db1
; <<>> DiG 9.8.3-P1 <<>> db1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 39452
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;db1. IN A
;; AUTHORITY SECTION:
. 9456 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2014100901 1800 900 604800 86400
;; Query time: 165 msec
;; SERVER: 10.0.200.4#53(10.0.200.4)
;; WHEN: Thu Oct 9 21:10:30 2014
;; MSG SIZE rcvd: 96
----- 编辑(已修复)-----
我不知道它到底是什么,但该条目无需进行任何其他更改就可以开始工作,可能是一些 DNS 缓存。
答案1
这不是任何类型的负面缓存。再看一下执行的实际查询:
;; QUESTION SECTION:
;db1. IN A
尾随的点表示查询的是 FQDN db.
(请注意尾随的点),并且您的搜索后缀 example.com 未自动添加后缀。dig 命令不会自动附加 中指定的搜索后缀/etc/resolv.conf
。来自联机帮助页:
+[no]search Use [do not use] the search list defined by the searchlist or domain directive in resolv.conf (if any). The search list is not used by default.