Ming-Ching Tiew wrote:
> "M" <notspam@spam7_14a.com> wrote in message news:YzV5g.1812$g01.523@trnddc01...
>
>>/etc/sysconfig/network-scripts/ifcfg-eth0 and ifcfg-eth1
>>have an option field called HWADDR, while your linux machine
>>is up, look at ifconfig eth0 and ifconfig eth1 commands output
>>to get what the card's hardware addresses are, then put
>>those addresses in the particular ifcfg-eth0 or ifcfg-eth1
>>file you want that card to be.
>>
>>Reference:
>>https://lists.sdsc.edu/pipermail/npa...ly/006814.html
>>
>
> I have read the reference you mentioned but I am finding it strange
> how this is possible. Surely, if this is at all possible, redhat
> must be using some tools which could map ethx to a particular
> physical mac address. And this is my question, what is the tool
> which make this possible. Surely this is not a matter of shell
> script.
>
> Thanks for the info.
I think it is done by shell scripts but it also uses
a command line program or two (ip, nameif), quoting this from
/etc/sysconfig/network-scripts/ifup-eth:
# 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 }"`
if [ -n "$curdev" ]; then
rename_device "${REALDEVICE}" "${HWADDR}" "${curdev}" || {
echo $"Device ${DEVICE} has different MAC address than
expected, ignoring."
exit 1
}
fi
fi
fi
=========
rename_device uses /sbin/nameif to actually assign the interface
to address relationship (see man nameif )
I've got a SBS Technologies VR-9 board at work running Fedora 4 that
has two identical Intel e1000 ports for eth0 and eth1 and I looked in
/etc/sysconfig/network-scripts and the ifcfg-eth0 and ifcfg-eth1
files were autoconfigured at install time to have the two
unique HWADDR entries in there for the two i/f's. I don't use
the eth1 and have it deactivated by putting alias eth1 off in the
modprobe.conf file but the OS never has incorrectly put the
eth0 on the wrong port.
Mark