另外,还可以参考ifup脚本中关于HWADDR和MACADDR的处理:
# 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=`ip -o link | awk -F ':' -vIGNORECASE=1 '/$HWADDR/ { print
$2 }'`
rename_device "${REALDEVICE}" "${HWADDR}" "${curdev}" || {
echo $"Device ${DEVICE} has different MAC address than expected,
ignoring."
exit 1
}
fi
fi
# this isn't the same as the MAC in the configuration filename. It
is
# available as a configuration option in the config file, forcing
the kernel
# to think an ethernet card has a different MAC address than it
really has.
if [ -n "${MACADDR}" ]; then
ip link set dev ${DEVICE} address ${MACADDR}
fi
再看下nameif的man文档:
nameif looks for the interface with the given MAC address and
renames it to the name given.