# ifdown eth0
# ifconfig eth0 hw ether 12:34:56:78:90:12???
?(修改的MAC地址跟原來(lái)的地址不同)
# ifup eth0
?(修改成功)
后,用# ifconfig 查看,MAC地址改變了,但之后輸入#service network restart 或ifdown eth0命令時(shí),會(huì)出現(xiàn)如下錯(cuò)語(yǔ)信息:
Device eth0 has MAC address 12:34:56:78:90:12, instead of configured address 00:0C:29:CA:B5:7D. Ignoring.
所以此時(shí)無(wú)法通過(guò)修改/etc/sysconfig/network-scripts/ifcfg-eth0文件來(lái)改變IP地址等相關(guān)信息,因?yàn)?service network restart無(wú)法使其生效,不過(guò)用ifconfig eth0可以臨時(shí)改變其IP地址,重啟后打回原型。
現(xiàn)在解決
“Device eth0 has MAC address 12:34:56:78:90:12, instead of configured address 00:0C:29:CA:B5:7D. Ignoring.”的問(wèn)題:
出現(xiàn)此問(wèn)題的其原因是配置文件:/etc/sysconfig/network-scripts/ifcfg-eth0里頭的 MACADDR=00:0C:29:CA:B5:7D地址與12:34:56:78:90:12不同而造成,可以將 MACADDR=00:0C:29:CA:B5:7D修改為12:34:56:78:90:12,則錯(cuò)誤就消除了,可以用#service network restart 了,但重啟后,MAC地址又打回原型,解決辦法是:
在/etc/rc.d/rc.local里加上這三句
ifconfig eth0 down
ifconfig eth0 hw ether 12:34:56:78:90:12
ifconfig eth0 up
同時(shí)將還要將/etc/sysconfig/network-scripts/ifcfg-eth0里頭的MACADDR=00:0C:29:CA:B5:7D地址改為12:34:56:78:90:12
這樣重新reboot后就不怕MAC復(fù)原,并且#service network restart也不會(huì)出現(xiàn)錯(cuò)語(yǔ)了。
此外,出現(xiàn)mac沖突或者不一致的情況
rm -rf /etc/udev/rules.d/70-persistent-net.rules
reboot