hosts解析出错

chenxiaohua 2016-05-28 04:04:37
我在hosts文件配置如下
[root@snd ~]# cat /etc/hosts
127.0.0.1 localhost
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

我在命令行上ping locahost,本来应该显示127.0.0.1的,但是显示确实如下的结果,显示网卡上某个ip地址返回的信息
[root@snd ~]#ping localhost
PING localhost (220.250.64.225) 56(84) bytes of data.
64 bytes from 220.250.64.225: icmp_seq=1 ttl=247 time=30.3 ms
64 bytes from 220.250.64.225: icmp_seq=2 ttl=247 time=30.3 ms
64 bytes from 220.250.64.225: icmp_seq=3 ttl=247 time=30.5 ms
64 bytes from 220.250.64.225: icmp_seq=4 ttl=247 time=30.2 ms
64 bytes from 220.250.64.225: icmp_seq=5 ttl=247 time=30.3 ms
64 bytes from 220.250.64.225: icmp_seq=6 ttl=247 time=30.2 ms
这导致我的tomcat启动没法成功。

本来应该返回如下的结果,这样就没问题
[root@snd ~]# ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.040 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.036 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.035 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.031 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.033 ms

host.conf 内容如下
[root@snd ~]#cat /etc/host.conf
multi on

各位高手,帮我看看,按照我的hosts的配置,ping localhost,返回的为啥不是127.0.0.1啊,快救救我啊



...全文
352 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
renwotao2009 2016-05-30
  • 打赏
  • 举报
回复
重启网卡试试
 Ubuntu: $sudo /etc/init.d/networking restart
alinly 2016-05-30
  • 打赏
  • 举报
回复
只要这一行: 127.0.0.1 localhost
常书 2016-05-28
  • 打赏
  • 举报
回复
参考下我的 cat /etc/host.conf # The "order" line is only used by old versions of the C library. order hosts,bind multi on 你加下order hosts,bind看看
renwotao2009 2016-05-28
  • 打赏
  • 举报
回复
感觉的hosts文件没有被使用或没生效,最后走的是dns
chenxiaohua 2016-05-28
  • 打赏
  • 举报
回复
我描述错了,我ping localhost的时候,居然返回的是一台不知名主机的地址 [root@snd ~]#ping localhost PING localhost (220.250.64.225) 56(84) bytes of data. 64 bytes from 220.250.64.225: icmp_seq=1 ttl=247 time=30.3 ms 64 bytes from 220.250.64.225: icmp_seq=2 ttl=247 time=30.3 ms 64 bytes from 220.250.64.225: icmp_seq=3 ttl=247 time=30.5 ms 64 bytes from 220.250.64.225: icmp_seq=4 ttl=247 time=30.2 ms 64 bytes from 220.250.64.225: icmp_seq=5 ttl=247 time=30.3 ms 64 bytes from 220.250.64.225: icmp_seq=6 ttl=247 time=30.2 ms

19,612

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧