今天做实验需要用到两个Linux系统,于是就把原有的CentOS6.6_64系统克隆了一份,启动克隆的系统配置好IP地址后,重启网络服务(service network restart),提示eth0不存在。而明明eth0文件是有存在滴。
1、修改克隆的CentOS6.6_64系统的网卡配置文件ifcfg-eth0,把HWADDR和UUID的行删除,参考如下:
[root@ilinuxPackages]#vim/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 TYPE=Ethernet IPADDR=192.168.80.201 NETMASK=255.255.255.0 BROADCAST=192.168.80.255 GATEWAY=192.168.80.254 DNS1=218.85.152.99 DNS2=222.222.222.222 ONBOOT=yes#开机自启动网络,很重要哦; NM_CONTROLLED=yes
2、修改克隆的CentOS6.6_64系统的70-persistent-net.rules配置文件,把文件里面未注释的行都删除或都注释掉(听说也可把此配置文件直接删除,想知道就自己实验下吧!)
[root@ilinuxPackages]#vim/etc/udev/rules.d/70-persistent-net.rules #Thisfilewasautomaticallygeneratedbythe/lib/udev/write_net_rules #program,runbythepersistent-net-generator.rulesrulesfile. # #Youcanmodifyit,aslongasyoukeepeachruleonasingle #line,andchangeonlythevalueoftheNAME=key. #PCIdevice0x8086:0x100f(e1000) #PCIdevice0x8086:0x100f(e1000) #PCIdevice0x8086:0x100f(e1000) #PCIdevice0x8086:0x100f(e1000) SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="00:0c:29:8d:3f:84",ATTR{type}=="1",KERNEL=="eth*",NAME="eth0"
3、重启系统,只要你把网卡配置对了就OK了,ifconfig下吧,eth0出现了。