无法解析本地主机 [英] cannot resolve localhost

查看:96
本文介绍了无法解析本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在localhost上执行ping操作时,出现"ping:无法解析localhost:未知主机".在127.0.0.1上执行ping正常工作.因此,我检查了主机文件,到目前为止一切正常:

When I do a ping on localhost, I get "ping: cannot resolve localhost: Unknown host". A ping on 127.0.0.1 does work. So I checked my hosts file and everything looks so far correctly:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

#Added by XAMPP Control
127.0.0.1 mkn.local

#Added by XAMPP Control
127.0.0.1 mkn.local

我也做了一个"dscacheutil -flushcache",但是我仍然不能ping"localhost".问题是现在我无法在eclipse中调试,因为eclipse会联系localhost(并且现在localhost无法解析为127.0.0.1).

I also did a "dscacheutil -flushcache" but I still can't ping "localhost". The problem is that right now I can't debug anymore in eclipse because eclipse contacts localhost (and right now localhost cannot be resolved to 127.0.0.1).

非常感谢您提前提供的帮助!

Many thanks for any help in advance!

P.S.我有OSX 10.7.2(Lion OS)

P.S. I have OSX 10.7.2 (Lion OS)

推荐答案

我从较旧的备份中还原了主机文件.我的备份主机文件和当前文件之间没有任何区别.但是,它现在可以工作了....魔术

I restored the hosts file from an older backup. I don't see any differences between my backuped hosts file and the current file. However, it works now .... magic

这篇关于无法解析本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆