我使用dns.resolveAny
功能检查某些域的DNS信息。
我发现有一点奇怪的是,对于某些域,dns.resolveAny
返回一个空数组而nslookup
命令没有。
以下是一个例子:
// node.js version >= 9.2 is required
const dns = require('dns')
dns.resolveAny('www.ifshop.com.tw', (err, ret) => {
if (err) {
console.log(`err: ${err}`)
} else {
console.log(`ret: ${JSON.stringify(ret)}`) // JSON.stringify(ret) == [] here
}
})
resolveAny
返回[]
。但是nslookup
成功返回了www.ifshop.com.tw
的CNAME记录。
> nslookup www.ifshop.com.tw
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
www.ifshop.com.tw canonical name = s1759.dname.91app.io.
s1759.dname.91app.io canonical name = proxy.letssl.91app.io.
proxy.letssl.91app.io canonical name = proxy-letssl-91app-io-196811564.ap-northeast-1.elb.amazonaws.com.
Name: proxy-letssl-91app-io-196811564.ap-northeast-1.elb.amazonaws.com
Address: 54.178.248.57
Name: proxy-letssl-91app-io-196811564.ap-northeast-1.elb.amazonaws.com
Address: 52.196.80.17
为什么会这样?
这是resolveAny
的错误吗?
或者www.ifshop.com.tw
的DNS配置是否存在问题?
我还发现dns.resolveCname
成功返回CNAME。
// node.js version >= 9.2 is required
const dns = require('dns')
dns.resolveCname('www.ifshop.com.tw', (err, ret) => {
if (err) {
console.log(`err: ${err}`)
} else {
console.log(`ret: ${JSON.stringify(ret)}`)
}
})
此处JSON.stringify(ret)
等于["s1759.dname.91app.io"]
。
答案 0 :(得分:1)
我将nslookup
的类型设置为any
。然后我找到了以下信息。
nslookup
> set type=any
> www.ifshop.com.tw
Server: 10.11.1.5
Address: 10.11.1.5#53
Non-authoritative answer:
www.ifshop.com.tw hinfo = "ANY obsoleted" "See draft-ietf-dnsop-refuse-any"
Authoritative answers can be found from:
根据上述信息,我们可以推断DNS提供商拒绝回复any
类型的查询。