在 Linux OS 上 ping www.google.com 时,我收到错误“网络无法访问”

I get the error `network is unreachable` when ping www.google.com on Linux OS

我在 Linux OS

上 ping www.google.com 时收到错误 network is unreachable
--- 127.0.0.1 ping statistics --- 
248 packets transmitted, 240 received, 8% packet loss, time 23925
rtt min/avg/max/mdev = 0.037/8.109/8.359/8.848 ms
[root@localhost
~ ]#
^C
[root@localhost
~I# ping www.google.com
connect: Network is unreachable
[root@localhost
~ ]#
  1. 首先你需要进入network-scripts目录
cd /etc/sysconfig/network-scripts/ 

  1. 然后你需要编辑文件ifcfg-ens3
vi ifcfg-ens3
  1. 你需要改变ONBOOT=yes
IPUG_DEFROUTE=yes
IPVE_FAILURE_FATAL=no
IPUG_ADDR_GEN_MODE=stable-privacu
NAME=ens33
UUID=643b3dd2-79ef-4cd7-8117-7e7b3ab79e18
DEVICE=ens33
ONBOOT=yes
  1. 最后重启服务
service network restart