安装完Linux系统后,无法上网 ping www.baidu.com 提示Network is unreachable
解决办法:
1、vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 (后缀为本机自动生成)
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=enp0s3 UUID=fadf194d-7c3e-4b65-9ddc-8a0e780fc234 DEVICE=enp0s3 ONBOOT=yes IPADDR=192.168.10.168 NETWORK=192.168.10.1 NETSTAT=255.255.255.0 GATEWAY=192.168.10.1 DNS1=8.8.8.8 DNS2=114.114.114.114
或者:
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=33ae9ef5-0efa-46e6-be79-89dbd135a4b7 DEVICE=ens33 ONBOOT=yes IPADDR=192.168.23.168 PREFIX=24 GATEWAY=192.168.23.2 DNS1=223.5.5.5 IPV6_PRIVACY=no
2、重启网卡 service network restart