我无法浏览任何网站。请查看以下错误:
karthick@karthick:~$ ping www.google.com
ping: unknown host www.google.com
更新资料
karthick@karthick:~$ dig www.google.com
; <<>> DiG 9.7.1-P2 <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26402
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;www.google.com. IN A
;; ANSWER SECTION:
www.google.com. 238583 IN CNAME www.l.google.com.
www.l.google.com. 97 IN A 74.125.236.50
www.l.google.com. 97 IN A 74.125.236.48
www.l.google.com. 97 IN A 74.125.236.52
www.l.google.com. 97 IN A 74.125.236.49
www.l.google.com. 97 IN A 74.125.236.51
;; AUTHORITY SECTION:
google.com. 146866 IN NS ns3.google.com.
google.com. 146866 IN NS ns2.google.com.
google.com. 146866 IN NS ns1.google.com.
google.com. 146866 IN NS ns4.google.com.
;; ADDITIONAL SECTION:
ns2.google.com. 317814 IN A 216.239.34.10
ns1.google.com. 317814 IN A 216.239.32.10
ns3.google.com. 317814 IN A 216.239.36.10
ns4.google.com. 317814 IN A 216.239.38.10
;; Query time: 5 msec
;; SERVER: 172.29.39.212#53(172.29.39.212)
;; WHEN: Wed Aug 3 15:30:38 2011
;; MSG SIZE rcvd: 268
输出:
karthick@karthick:~$ ifconfig
eth0 Link encap:Ethernet HWaddr bc:30:5b:c4:fd:dc
inet addr:172.29.XX.XX Bcast:172.29.XX.XXX Mask:255.255.255.0
inet6 addr: fe80::be30:5bff:fec4:fddc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1757954 errors:0 dropped:0 overruns:0 frame:0
TX packets:1422948 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1329324192 (1.3 GB) TX bytes:1231317787 (1.2 GB)
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:10528 errors:0 dropped:0 overruns:0 frame:0
TX packets:10528 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:768164 (768.1 KB) TX bytes:768164 (768.1 KB)
karthick@karthick:~$ sudo iptables -nvL
[sudo] password for karthick:
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
/etc/nsswitch.conf
特别是在开始的工作中是hosts:
什么?您应该dns
在那条线上。
dig
,host
并且nslookup
不使用名称服务转换器(因为它们不需要考虑其他的名称服务机制比DNS)。大多数其他软件都使用它。它是libc的一部分,man nsswitch.conf
在命令行上将为您提供基本原理和概述。