ping不通localhost但是可以ping通ip地址
Posted jpr-ok
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ping不通localhost但是可以ping通ip地址相关的知识,希望对你有一定的参考价值。
进到目录:/ect/
找到hosts文件,为:hosts.txt,去掉后缀txt,就可以ping通了
(base) localhost:~ ligaijiang$ ping localhost
ping: cannot resolve localhost: Unknown host
(base) localhost:~ ligaijiang$ ncat 172.31.50.245 9999
Hello I am William‘s server~
Hello I am William‘s client~
bye~
Ncat: Broken pipe.
(base) localhost:~ ligaijiang$
(base) localhost:~ ligaijiang$ ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.063 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.074 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.065 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.204 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.073 ms
^C
--- localhost ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.063/0.096/0.204/0.054 ms
(base) localhost:~ ligaijiang$
以上是关于ping不通localhost但是可以ping通ip地址的主要内容,如果未能解决你的问题,请参考以下文章
虚拟机ping不通主机,但是主机可以ping通虚拟机(转载)
防火墙设置:虚拟机ping不通主机,但是主机可以ping通虚拟机(转载)