CentOS开机eth0网络设备不启动

新装一个CentOS系统,开机发现没有网络,于是ifconfig一下发现eth0设备网络没有启动

1
2
3
4
5
6
7
8
9
[root@lee ~]# ifconfig 
lo        Link encap:Local Loopback   
inet addr:127.0.0.1  Mask:255.0.0.0 
inet6 addr: ::1/128 Scope:Host 
UP LOOPBACK RUNNING  MTU:16436  Metric:1 
RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 
collisions:0 txqueuelen:0  
RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

直接重启网络服务

1
2
3
[root@lee ~]# service network restart 
关闭环回接口:                                             [确定] 
弹出环回接口:                                             [确定]

发现提示命令中并没有,并没有开启eth0的提示。直接找到脚本

1
[root@lee ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

ONBOOT=yes 确认已经打开!

reboot重启系统,还是不管用。每次都要手动开启设备

1
[root@lee ~]# ifup eth0

于是在 /etc/rc.local 里加入  /sbin/ifup eth0 ,问题暂时解决了。