Ubuntu 11.10
nslookup
DNS 与配合良好dig
sr@sr-ThinkPad-R52:~$ nslookup ocelot.rmg.local
Server: 192.168.0.100
Address: 192.168.0.100#53
Name: ocelot.rmg.local
Address: 192.168.0.100
sr@sr-ThinkPad-R52:~$ dig ocelot.rmg.local
; <<>> DiG 9.7.3 <<>> ocelot.rmg.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7831
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;ocelot.rmg.local. IN A
;; ANSWER SECTION:
ocelot.rmg.local. 10800 IN A 192.168.0.100
;; AUTHORITY SECTION:
ocelot.rmg.local. 10800 IN NS ocelot.rmg.local.
;; Query time: 4 msec
;; SERVER: 192.168.0.100#53(192.168.0.100)
;; WHEN: Sun Jan 15 17:14:41 2012
;; MSG SIZE rcvd: 64
并且curl
可以直接连接主机
sr@sr-ThinkPad-R52:~$ curl -I http://192.168.0.100/
HTTP/1.1 200 OK
Date: Sun, 15 Jan 2012 17:15:45 GMT
Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8k PHP/5.3.0
Last-Modified: Sat, 25 Jul 2009 05:17:17 GMT
ETag: "31bdb-13e6-46f80d59a5140"
Accept-Ranges: bytes
Content-Length: 5094
Cache-Control: max-age=60
Expires: Sun, 15 Jan 2012 17:16:45 GMT
MS-Author-Via: DAV
X-Frame-Options: SameOrigin
Content-Type: text/html
但没有任何工具(Firefox、Curl 等)能让我通过 DNS 连接到主机
sr@sr-ThinkPad-R52:~$ curl -I http://ocelot.rmg.local/
curl: (6) Couldn't resolve host 'ocelot.rmg.local'
sr@sr-ThinkPad-R52:~$ curl -I http://google.co.uk/
curl: (6) Couldn't resolve host 'google.co.uk'
因此nslookup
,可以dig
正确解析域名,但其他任何事情都无法解决。首先,DNS 在网络上的其他地方都可以正常工作。
sr@sr-ThinkPad-R52:~$ sudo cat /etc/resolv.conf
[sudo] password for sr:
# Generated by NetworkManager
nameserver 192.168.0.100
sr@sr-ThinkPad-R52:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:41:15:f5:a9
inet addr:192.168.0.51 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::216:41ff:fe15:f5a9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:928 errors:0 dropped:0 overruns:0 frame:0
TX packets:550 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:97057 (97.0 KB) TX bytes:74362 (74.3 KB)
Interrupt:16
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
按照要求
sr@sr-ThinkPad-R52:~$ dig ipv6.google.com
; <<>> DiG 9.7.3 <<>> ipv6.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3009
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;ipv6.google.com. IN A
;; ANSWER SECTION:
ipv6.google.com. 604308 IN CNAME ipv6.l.google.com.
;; Query time: 311 msec
;; SERVER: 192.168.0.100#53(192.168.0.100)
;; WHEN: Mon Jan 16 16:21:21 2012
;; MSG SIZE rcvd: 54
sr@sr-ThinkPad-R52:~$ dig ipv6.l.google.com
; <<>> DiG 9.7.3 <<>> ipv6.l.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57474
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;ipv6.l.google.com. IN A
;; Query time: 124 msec
;; SERVER: 192.168.0.100#53(192.168.0.100)
;; WHEN: Mon Jan 16 16:22:00 2012
;; MSG SIZE rcvd: 35
不在 IPV6 网络上,所以curl
无论如何都行不通
答案1
你试过其他软件吗?比如 ping、telnet、ssh?
例如,你可以给出输出
strace ping google.co.uk