CentOS 6.0 では、/etc/udev/rules.d/S70-persistent-net.rules の NAME= により、入れ替えを行うことができます。
# 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:a3:8b:6c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a3:8b:6d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
なお、ifcfg-ethX に、HWADDR= を指定することはできるものの、実際の MAC と一致しているかどうかのチェックのみ行うようになっています。/etc/sysconfig/network-scripts/ifup-eth より抜粋します。
...
# bail out, if the MAC does not fit
if [ -n "${HWADDR}" ]; then
FOUNDMACADDR=$(get_hwaddr ${REALDEVICE})
if [ "${FOUNDMACADDR}" != "${HWADDR}" -a "${FOUNDMACADDR}" != "${MACADDR}" ]; then
echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
exit 1
fi
fi
...
上記が CentOS 6.0 の記述内容ですが、CentOS 5 では次のようになっており、rename_device() という関数により入れ替えが行われていました。
...
# remap, if the device is bound with a MAC address and not the right device num
# bail out, if the MAC does not fit
if [ -n "${HWADDR}" ]; then
FOUNDMACADDR=`get_hwaddr ${REALDEVICE}`
if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
curdev=`get_device_by_hwaddr ${HWADDR}`
if [ -n "$curdev" ]; then
rename_device "${REALDEVICE}" "${HWADDR}" "${curdev}" || {
echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
exit 1
}
else
echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
exit 1
fi
fi
fi
...
参考URL:
https://access.redhat.com/kb/docs/DOC-173382011-08-07追記
固定化する方法について、書きましたので、よろしければ参照ください。
CentOS 6.0 で NIC と ethX の対応を固定化する

0 件のコメント:
コメントを投稿