我希望在我的本地testing服务器(Win XP)上运行example.com。 为此,我能够为example.com设置BIND和configuration区域。 本地的DNS服务器和本地的Apache Web服务器都能正常工作。 但是,当我在浏览器上尝试example.com时,它将原始example.com转换为本地版本。
那么我在这里错过了什么? 为什么不能在Apache中指向本地版本。
example.com的区域logging
$TTL 3h example.com. IN SOA ns1.example.com. ns2.example.com. ( 1 ; Serial 3h ; Refresh after 3 hours 1h ; Retry after 1 hour 1w ; Expire after 1 week 1h ) ; Negative caching TTL of 1 hour ; ; Name servers ; example.com. IN NS ns1.example.com. ; ; Addresses for the canonical names ; localhost IN A 127.0.0.1 ns1 IN A 192.168.1.2
如何使本地example.com工作?
更新:我试过 – nslookup example.com得到了以下回应 –
;; Got recursion not available from 192.168.1.2, trying next server Server: 4.2.2.2 Address: 4.2.2.2#53 Non-authoritative answer: Name: example.com Address: 208.77.188.166
对于nslookup 192.168.1.2我得到了 –
;; Got recursion not available from 192.168.1.2, trying next server ;; Got recursion not available from 192.168.1.2, trying next server Server: 4.2.2.2 Address: 4.2.2.2#53 ** server can't find 2.1.168.192.in-addr.arpa.: NXDOMAIN
对于Dig example.com ,我得到了 –
; <<>> DiG 9.6.1 <<>> example.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 494 ;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; WARNING: recursion requested but not available ;; QUESTION SECTION: ;example.com. IN A ;; AUTHORITY SECTION: example.com. 3600 IN SOA ns1.example.com. ns2.example.com. 1 10800 3600 604800 3600 ;; Query time: 15 msec ;; SERVER: 192.168.1.2#53(192.168.1.2) ;; WHEN: Sat Jul 04 17:05:05 2009 ;; MSG SIZE rcvd: 73
你的networking浏览器可能使用一些代理而不是直接的互联网连接?
可能不会 – 但仍值得问。
当您在使用networking浏览器的计算机上启动时,您的Windows nslookup会说些什么? 是否说192.168.1.2是唯一的DNS服务器? 当你inputexample.com作为查询时会发生什么?
[编辑:我是盲人..这一个应该解决这个问题]添加
@ IN A 91.206.245.2 www IN A 91.206.245.2
到您的绑定区域文件,更改序列号并重新加载绑定。
您刚刚安装和configuration的DNS服务器(BIND)是一个权威的名称服务器。 这很好,但不能用它作为recursion名称服务器,这就是您在“将我的主DNS更改为192.168.1.2”时所做的。 因此,nslookup的尖叫“得到recursion从192.168.1.2不可用,尝试下一个服务器”。
一个权威的域名服务器对某些域名(这里是example.com )是权威的,但不是一个通用的parsing服务器。 为此,您需要recursion名称服务器。
两种解决scheme
使您的本地计算机的BIND名称服务器recursion。 (基本上,这意味着添加recursion yes;在视图中 ,或者确保您的BIND只能侦听本地IP地址)。请注意,名称服务器既是recursion的又是权威性的,但是对于个人计算机只用于testing,这不是什么大不了的事情。
告诉定期recursion,它必须为您的机器转发对example.com请求。 我不能说更多,这取决于谁来pipe理它,它运行什么软件等等。
我同意pQd,你也可以运行诸如wireshark的工具来查看它出错的地方。
如果您正在使用代理服务器,则暂时禁用代理服务器,然后select直接连接到Internet并打开example.com。 (不要打开www.example.com)
如果事情正常工作与直接连接到Internet选项。 然后重新启用代理服务器,把不使用代理
127.0.0.1;localhost;.example.com;
在Firefox或把旁路代理
127.0.0.1 localhost,而*。example.com
在Internet Explorer中。