標籤:
在執行network服務重啟後,出現Device eth0 does not seem to be present 問題,主要是因為系統之前有多個網卡配置,和設定檔不匹配造成的。
解決這種問題,思路是先看系統網卡設定檔中目前的配置情況,然後再在網路設定檔中修改相應的配置
具體現象:
service network restart
Shutting down loopback insterface: [ OK ]
Bringing up loopback insterface: [ OK ]
Bringing up interface eth0: Device eth0 does not seem to be present,delaying initialization. [FAILED]
解決辦法:
1、查看網路設定檔
cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules# program, run by the persistent-net-generator.rules rules file.## You can modify it, as long as you keep each rule on a single# line, and change only the value of the NAME= key.# PCI device 0x8086:0x100f (e1000)SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:6f:02:c2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"# PCI device 0x8086:0x100f (e1000)SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:d0:74:01", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"# PCI device 0x8086:0x100f (e1000)SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:bc:4e:d6", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"# PCI device 0x8086:0x100f (e1000)SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:78:35:ae", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
在使用ifconfig命令執行後,顯示的網卡為最後一個eth3,現在我們不需要eth3,想改回eth0。在/etc/sysconfig/network-scripts/檔案夾中只有ifcfg-eth0
# This file was automatically generated by the /lib/udev/write_net_rules# program, run by the persistent-net-generator.rules rules file.## You can modify it, as long as you keep each rule on a single# line, and change only the value of the NAME= key.# PCI device 0x8086:0x100f (e1000)#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:6f:02:c2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"# PCI device 0x8086:0x100f (e1000)#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:d0:74:01", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"# PCI device 0x8086:0x100f (e1000)#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:bc:4e:d6", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"# PCI device 0x8086:0x100f (e1000)SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:78:35:ae", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
最後條記錄是目前在用的網卡的資料,包括mac地址資訊,需要把最後一條的網卡名稱從eth3,改成eth0,然後修改ifcfg-eth0
DEVICE="eth0"BOOTPROTO="static"HWADDR="00:0c:29:78:35:ae"IPV6INIT="yes"NM_CONTROLLED="yes"ONBOOT="yes"TYPE="Ethernet"NETMASK=255.255.255.0IPADDR=192.168.114.128GATEWAY=192.168.114.1
吧hwaddr改成70-persistent-net.rules檔案中最後一條記錄的mac地址。
重啟修改成功。
注意:
如果沒有關閉NetworkManager,則需要關閉
service NetworkManager stop
chkconfig NetworkManager off
CentOS 下網路報錯 Device eth0 does not seem to be present