CentOS7无法上网
原创
©著作权归作者所有:来自51CTO博客作者yitahutu79的原创作品,请联系作者获取转载授权,否则将追究法律责任
未连接网络,ping不通
[lj@localhost ~]$ su
密码:
[root@localhost lj]# ping www.baidu.com
ping: www.baidu.com: 未知的名称或服务
还原网络设置
选择NAT模式
修改网络配置文件
vi /etc/sysconfig/network-scripts/ifcfg-eth0
重启网络
尝试ping百度,成功
[root@localhost lj]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost lj]# service network restart
Restarting network (via systemctl): [ 确定 ]
[root@localhost lj]# ping www.baidu.com
PING www.a.shifen.com (39.156.66.14) 56(84) bytes of data.
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=1 ttl=128 time=19.1 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=2 ttl=128 time=208 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=3 ttl=128 time=18.4 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=4 ttl=128 time=21.4 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=5 ttl=128 time=20.9 ms
^C
--- www.a.shifen.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 13046ms