无法ping hostname.local


1

如下所示,给定的主机名目前无法ping。

19:42:43/lib $hostname
mellyrn.local
19:42:55/lib $ping mellyrn.local
ping: cannot resolve mellyrn.local: Unknown host

请注意,互联网可以访问:

19:43:02/lib $ping www.oracle.com
PING e7075.x.akamaiedge.net (23.59.198.140): 56 data bytes
64 bytes from 23.59.198.140: icmp_seq=0 ttl=57 time=5.872 ms
64 bytes from 23.59.198.140: icmp_seq=1 ttl=57 time=5.735 ms
64 bytes from 23.59.198.140: icmp_seq=2 ttl=57 time=5.824 ms
^C
--- e7075.x.akamaiedge.net ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 5.735/5.810/5.872/0.057 ms

我们来看看net配置:

19:44:54/lib $ifconfig -a
    .. 
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether b8:f6:b1:15:dd:bf
    inet 192.168.255.170 netmask 0xfffffc00 broadcast 192.168.255.255
    media: autoselect
    status: active

你能发布的内容吗? /etc/hosts 文件
Kannan Mohan

@javadba请在您的问题中添加Mac OS X的系统版本
klanomath

Answers:


1

我没有回答为什么会出现这种情况。但是,重新启动网络可以解决问题:

 $sudo ifconfig en0 down
 $sudo ifconfig en0 up

1

我相信他的问题是因为他给他的电脑分配了一个主机名:mellyrn.local。应该发生的事情是他给他的电脑分配了mellyrn的主机名。您将“.local”附加到ping.hostname命令并ping:mellyrn.local

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.