1

我真的在为 dnsmasq 设置而苦苦挣扎。

我的 dnsmasq 配置包含(除其他外),以​​下

address=/local/127.0.0.1
listen-address=127.0.0.1
domain=local

我的网络管理器 conf 和 resolve conf 肯定包括 127.0.0.1 作为第一个名称服务器。

如果我跑

dig mysite.local

我明白了

; <<>> DiG 9.8.1-P1 <<>> mysite.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61359
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;mysite.local.          IN  A

;; ANSWER SECTION:
mysite.local.       0   IN  A   127.0.0.1

;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Dec 17 10:33:40 2013
;; MSG SIZE  rcvd: 46

(是的,mysite.local 是一个监听 80 端口的 apache 虚拟主机)。

但是,如果我浏览或 wget 到 mysite.local,我会得到:

--2013-12-17 10:35:49--  http://mysite.local/
Resolving mysite.local (mysite.local)... failed: Name or service not known.
wget: unable to resolve host address `mysite.local'

运行 Ubuntu 12.04。使用 dnsmasq 调试跟踪 syslog 的输出表明 wget 或浏览器都不会查询 dnsmasq 的 .local 域,但在 .local 域上运行 dig 工作正常。

任何想法都非常感谢。

4

1 回答 1

2

认为一位同事可能已经找到了答案。

看起来(尽管很高兴对此进行更正)Linux 将“.local”读作“localhost”的同义词。这似乎是导致绕过 dnsmasq 的原因。

解决方案是选择一个不同的假顶级域。最后我选择了“.dev”,一切正常!

于 2013-12-20T12:22:08.700 回答