虚拟机只能ping通当前主机或者其他虚拟机,不能ping通百度

目录

    • 问题描述:虚拟机不能ping通百度等网站,但是可以ping通当前主机或者其他虚拟机
    • 解决办法(已解决)

问题描述:虚拟机不能ping通百度等网站,但是可以ping通当前主机或者其他虚拟机

[yiduoyun@localhost ~]$ service network restart
Restarting network (via systemctl):                        [  确定  ]
[yiduoyun@localhost ~]$ ping www.baidu.com
ping: unknown host www.baidu.com

[yiduoyun@localhost ~]$ ping 192.168.11.252
PING 192.168.11.252 (192.168.11.252) 56(84) bytes of data.
64 bytes from 192.168.11.252: icmp_seq=1 ttl=64 time=0.949 ms
64 bytes from 192.168.11.252: icmp_seq=2 ttl=64 time=1.52 ms
^Z
[1]+  已停止               ping 192.168.11.252
[yiduoyun@localhost ~]$ ping 192.168.11.250
PING 192.168.11.250 (192.168.11.250) 56(84) bytes of data.
From 192.168.11.101 icmp_seq=1 Destination Host Unreachable
From 192.168.11.101 icmp_seq=2 Destination Host Unreachable
From 192.168.11.101 icmp_seq=3 Destination Host Unreachable
From 192.168.11.101 icmp_seq=4 Destination Host Unreachable
^Z
[2]+  已停止               ping 192.168.11.250


解决办法(已解决)

在/etc/resolv.conf 文件中添加 nameserver xxx.xxx.xxx.xxx。
如8.8.8.8或者4.4.4.4,保存退出

[yiduoyun@localhost etc]$ vim resolv.conf 
[yiduoyun@localhost etc]$ su
密码:
[root@localhost etc]# vim resolv.conf 
[root@localhost etc]# service network restart
Restarting network (via systemctl):                        [  确定  ]
[root@localhost etc]# ping www.baidu.com
PING www.wshifen.com (103.235.46.40) 56(84) bytes of data.
64 bytes from 103.235.46.40: icmp_seq=3 ttl=128 time=82.0 ms
64 bytes from 103.235.46.40: icmp_seq=4 ttl=128 time=112 ms
^Z
[1]+  已停止               ping www.baidu.com
[root@localhost etc]# 

你可能感兴趣的:(报错,dubbo)