我有作为验证,缓存,递归DNS服务器和nsd3作为权威名称服务器运行的未绑定运行.在我尝试解析应转发给nsd3的地址之前,似乎两者的每个方面都正常工作.我已将问题缩小到从未绑定转发到nsd3的存根区域,看起来它没有解析’stub-host’名称.根据日志,unbound正在尝试使用外部dns而不是/ etc / hosts来解析’stub-host'(尽管这可能是因为它在查找期间以某种方式失败).我已经测试了硬编码nsd3服务器的ip,它看起来效果很好.
这是我的未绑定配置的相关部分(完整配置是Here):
private-domain: "test.lan" local-zone: "0.0.10.in-addr.arpa." nodefault stub-zone: name: "test.lan" stub-host: unsd_nsd3 forward-zone: name: "." forward-addr: 8.8.8.8 # Google Public DNS forward-addr: 74.82.42.42 # Hurricane Electric forward-addr: 4.2.2.4 # Level3 Verizon
这是unbound的输出,日志级别为3.我运行dig mithril.test.lan @localhost作为测试(当直接查询nsd3时它正确解析):
[1448909203] unbound[1:0] debug: validator[module 0] operate: extstate:module_state_initial event:module_event_moddone [1448909203] unbound[1:0] info: validator operate: query unsd_nsd3. A IN [1448909203] unbound[1:0] debug: iterator[module 1] operate: extstate:module_wait_subquery event:module_event_pass [1448909203] unbound[1:0] info: iterator operate: query mithril.test.lan. A IN [1448909203] unbound[1:0] info: processQueryTargets: mithril.test.lan. A IN [1448909203] unbound[1:0] info: new pside target unsd_nsd3. A IN [1448909203] unbound[1:0] debug: iterator[module 1] operate: extstate:module_state_initial event:module_event_pass [1448909203] unbound[1:0] info: iterator operate: query unsd_nsd3. A IN [1448909203] unbound[1:0] info: resolving unsd_nsd3. A IN [1448909203] unbound[1:0] info: processQueryTargets: unsd_nsd3. A IN [1448909203] unbound[1:0] info: sending query: unsd_nsd3. A IN [1448909203] unbound[1:0] debug: sending to target: <.> 74.82.42.42#53 [1448909203] unbound[1:0] debug: cache memory msg=132347 rrset=132399 infra=5449 val=132392 [1448909203] unbound[1:0] debug: iterator[module 1] operate: extstate:module_wait_reply event:module_event_reply [1448909203] unbound[1:0] info: iterator operate: query unsd_nsd3. A IN [1448909203] unbound[1:0] info: response for unsd_nsd3. A IN [1448909203] unbound[1:0] info: reply from <.> 74.82.42.42#53 [1448909203] unbound[1:0] info: query response was NXDOMAIN ANSWER [1448909203] unbound[1:0] info: finishing processing for unsd_nsd3. A IN [1448909203] unbound[1:0] debug: validator[module 0] operate: extstate:module_state_initial event:module_event_moddone [1448909203] unbound[1:0] info: validator operate: query unsd_nsd3. A IN [1448909203] unbound[1:0] debug: iterator[module 1] operate: extstate:module_wait_subquery event:module_event_pass [1448909203] unbound[1:0] info: iterator operate: query mithril.test.lan. A IN [1448909203] unbound[1:0] info: processQueryTargets: mithril.test.lan. A IN [1448909203] unbound[1:0] debug: out of query targets -- returning SERVFAIL [1448909203] unbound[1:0] debug: return error response SERVFAIL [1448909203] unbound[1:0] debug: validator[module 0] operate: extstate:module_wait_module event:module_event_moddone [1448909203] unbound[1:0] info: validator operate: query mithril.test.lan. A IN [1448909203] unbound[1:0] debug: cache memory msg=132557 rrset=132624 infra=5449 val=132392
作为旁注,我在debian基本映像中的自己的docker容器中运行unbound和nsd3,并将它们链接在一起.我可以在未绑定的容器中解析unsd_nsd3.这是未绑定容器中的/ etc / hosts:
172.17.0.6 a79a91df9ec5 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 172.17.0.5 docker_nsd3 89a74b365c88 unsd_nsd3 172.17.0.5 unsd_nsd3 89a74b365c88
我已经没有关于如何从这里前进的想法.一些帮助将不胜感激.
解决方法
Unbound不使用/ etc / hosts. Unbound只能通过上游转发来解析stub-name unsd_nsd3.您需要设置local-zone和local-data以反映/ hosts的内容,或者使用IP作为存根.
为了简化迁移,source tarball有一个perl脚本,contrib / build-unbound-localzone-from-hosts.pl,用于生成包含文件.需要在exec之前的脚本内设置本地区域名称