未绑定存根控制主机选项不能使用/ etc / hosts来parsing

我有unbound作为validation,caching,recursionDNS服务器和nsd3作为权威的域名服务器运行。 似乎两个方面都正常工作,直到我试图解决一个地址应该被转发到nsd3。 我已经将问题缩小到从未绑定转发到nsd3的存根区域,看起来它不能parsing“存根主机”的名称。 根据日志,unbound尝试使用外部dns而不是/ etc / hostsparsing'stub-host'(尽pipe这可能是因为在查找过程中失败)。 我testing了硬编码的nsd3服务器,似乎完美的工作IP地址。

这里是我的unboundconfiguration的相关部分(完整configuration是这里 ):

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 

这里是未绑定的输出,日志级别为3.我运行dig mithril.test.lan @localhost作为testing(当直接查询nsd3时,它可以正确parsing):

 [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 

作为一个方面说明,我在自己的docker容器中运行unbound和nsd3,并将它们链接在一起。 我可以在未绑定的容器内parsingunsd_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 

我已经没有了如何从这里前进的想法。 一些帮助,将不胜感激。

未绑定不使用/ etc / hosts 。 Unbound只能通过向上游转发来parsingstub-name unsd_nsd3 。 您将需要设置local-zonelocal-data来反映您的/ hosts的内容,或使用存根的IP。

为了简化迁移, 源代码包有一个perl脚本, contrib/build-unbound-localzone-from-hosts.pl生成一个包含文件。 在exec之前,需要在脚本中设置本地区域名称