ping: www.baidu.com: 未知的名称或服务


在执行ping www.baidu.com命令时,出现如下错误:

 

[root@qwe bhu_123]# ping www.baidu.com
ping: www.baidu.com: 未知的名称或服务

 

一、找到自己电脑ip地址

先确定登录的身份是否为root用户,如果不是,最好切换为root身份

ping: www.baidu.com: 未知的名称或服务

 

 

选择VMnet8,找到子网IP

ping: www.baidu.com: 未知的名称或服务

 

 

编辑自己ip地址:

使用下面命令进入vi编辑器,编辑自己ip等相关信息。

[root@qwe bhu_123]# vim  /etc/sysconfig/network-scripts/ifcfg-ens33

ping: www.baidu.com: 未知的名称或服务

 

查看网卡ip是不是你设置的ip

[root@qwe bhu_123]# ifconfig

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.213.130 netmask 255.255.255.0 broadcast 192.168.213.255
inet6 fe80::87e7:f1d:9b02:636a prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:a2:1b:7d txqueuelen 1000 (Ethernet)
RX packets 466 bytes 51275 (50.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 414 bytes 47925 (46.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 473 bytes 38305 (37.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 473 bytes 38305 (37.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:8a:14:61 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

如果是自己的设置的ip就对了

 

设置完毕,执行以下的命令重启network 服务

systemctl restart network

 

重启网络service network restart

 

如果NetworkManager没有运行,则可以通过简单运行来启动它。 # systemctl start NetworkManager

 

然后去ping   www.baidu.com 就可以了

 

[root@qwe bhu_123]# ping www.baidu.com
PING www.a.shifen.com (163.177.151.110) 56(84) bytes of data.
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=1 ttl=128 time=39.3 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=2 ttl=128 time=35.6 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=3 ttl=128 time=79.3 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=4 ttl=128 time=37.6 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=5 ttl=128 time=39.5 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=6 ttl=128 time=71.8 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=7 ttl=128 time=69.1 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=8 ttl=128 time=69.3 ms
64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=9 ttl=128 time=62.3 ms
^X64 bytes from 163.177.151.110 (163.177.151.110): icmp_seq=10 ttl=128 time=59.1 ms

 

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/288872.html

(0)
上一篇 2022年9月11日
下一篇 2022年9月11日

相关推荐

发表回复

登录后才能评论