当我这样做时ping google.com
我得到ping: unknown host google.com
但是ping 173.194.67.138
我什么时候才能得到这个:
PING 173.194.67.138 (173.194.67.138) 56(84) bytes of data.
64 bytes from 173.194.67.138: icmp_seq=1 ttl=48 time=5.33 ms
64 bytes from 173.194.67.138: icmp_seq=2 ttl=48 time=5.40 ms
因此,在尝试解析 DNS 时一定出现错误,我能做些什么?
这是来自我的系统日志:
Aug 14 19:55:15 localhost ntpd[1184]: ntpd [email protected] Mon Apr 13 13:39:46 UTC 2015 (1)
Aug 14 19:55:15 localhost ntpd[1185]: proto: precision = 0.102 usec
Aug 14 19:55:15 localhost ntpd[1185]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Aug 14 19:55:15 localhost ntpd[1185]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Aug 14 19:55:15 localhost ntpd[1185]: Listen and drop on 1 v6wildcard :: UDP 123
Aug 14 19:55:15 localhost ntpd[1185]: Listen normally on 2 lo 127.0.0.1 UDP 123
Aug 14 19:55:15 localhost ntpd[1185]: Listen normally on 3 eth0 108.61.209.172 UDP 123
Aug 14 19:55:15 localhost ntpd[1185]: Listen normally on 4 lo ::1 UDP 123
Aug 14 19:55:15 localhost ntpd[1185]: Listen normally on 5 eth0 fe80::5400:ff:fe10:937 UDP 123
Aug 14 19:55:15 localhost ntpd[1185]: peers refreshed
Aug 14 19:55:15 localhost ntpd[1185]: Listening on routing socket on fd #22 for interface updates
Aug 14 19:55:19 localhost ntpd[1185]: ntpd exiting on signal 15
Aug 14 19:55:29 localhost ntpdate[1216]: Can't find host 1.time.constant.com: Name or service not known (-2)
Aug 14 19:55:39 localhost ntpdate[1216]: Can't find host 2.time.constant.com: Name or service not known (-2)
Aug 14 19:55:49 localhost ntpdate[1216]: Can't find host 3.time.constant.com: Name or service not known (-2)
Aug 14 19:55:49 localhost ntpdate[1216]: no servers can be used, exiting
Aug 14 19:55:49 localhost ntpd[1250]: ntpd [email protected] Mon Apr 13 13:39:46 UTC 2015 (1)
Aug 14 19:55:49 localhost ntpd[1251]: proto: precision = 0.122 usec
Aug 14 19:55:49 localhost ntpd[1251]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Aug 14 19:55:49 localhost ntpd[1251]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Aug 14 19:55:49 localhost ntpd[1251]: Listen and drop on 1 v6wildcard :: UDP 123
Aug 14 19:55:49 localhost ntpd[1251]: Listen normally on 2 lo 127.0.0.1 UDP 123
Aug 14 19:55:49 localhost ntpd[1251]: Listen normally on 3 eth0 108.61.209.172 UDP 123
Aug 14 19:55:49 localhost ntpd[1251]: Listen normally on 4 lo ::1 UDP 123
Aug 14 19:55:49 localhost ntpd[1251]: Listen normally on 5 eth0 fe80::5400:ff:fe10:937 UDP 123
Aug 14 19:55:49 localhost ntpd[1251]: peers refreshed
Aug 14 19:55:49 localhost ntpd[1251]: Listening on routing socket on fd #22 for interface updates
Aug 14 19:55:59 localhost ntpd[1251]: Deferring DNS for 1.time.constant.com 1
Aug 14 19:56:09 localhost ntpd[1251]: Deferring DNS for 2.time.constant.com 1
Aug 14 19:56:19 localhost ntpd[1251]: Deferring DNS for 3.time.constant.com 1
Aug 14 19:56:19 localhost ntpd[1255]: signal_no_reset: signal 17 had flags 4000000
Aug 14 19:56:31 localhost ntpd_intres[1255]: host name not found: 1.time.constant.com
Aug 14 19:56:41 localhost ntpd_intres[1255]: host name not found: 2.time.constant.com
Aug 14 19:56:51 localhost ntpd_intres[1255]: host name not found: 3.time.constant.com
答案1
我敢打赌你做不到这一点:
nslookup rtfm.mit.edu
但你可以这样做:
nslookup rtfm.mit.edu 8.8.8.8
如果您检查文件的内容/etc/resolv.conf
,它可能是空的,或者将您的 DNS 解析器指向您的 Ubuntu 无法访问的内容。 /etc/resolv.conf
可以使用任何纯文本编辑器(vim、nano 等)手动配置,或者/etc/network/interfaces
如果您resolvconf
安装了软件包,也可以从中配置。或者,如果您的环境正在使用 DHCP,网络管理器可以管理它并从 DHCP 获取 DNS 服务器信息。您需要弄清楚您的 Ubuntu 使用的是哪种方法,因为手动进行的更正更改/etc/resolv.conf
将在下次重新启动或断开网络时被覆盖resolvconf
,而网络管理器喜欢到处乱涂乱画。
您没有说明这是使用以太网的办公机器、带有 wifi 的家用机器、台式机还是笔记本电脑,以及它具有哪种网络连接。我需要有关这些细节的更多信息才能更具体。具体答案需要您提供更多详细信息。