The change of the adapter to a preset hardware address with ifconfig prior to calling DHCP works great for me. I tested it with a Compaq Netelligent Ethernet and an IBM Auto Token Ring adapter. My version of DHCP does not seem to work for Token Ring, but that's another story and does not have anything to do with the address change.
I tweaked David's network script (many thanks to David for discussing the stuff and giving hints) a little and added a new variable NEW_HWADDR to network.config and here we are. If network.opts sets this variable, the network script will try to change the adapters address to NEW_HWADDR. The version of David's scrip is: # network 1.63 2000/02/09 03:12:42 (David Hinds)
And here are the changes I made (this is an excerpt, showing only the changes I made to the "start" part of "case $ACTION in"):
>'start') > > test "$IF_PORT" && /sbin/ifport $DEVICE $IF_PORT > > cp $RESOLV $RESOLV.pcmcia.save > ># Begin adddition by Andreas Hotz > if [ "$NEW_HWADDR" ] ; then > case "$DEVICE" in > eth*) > IFDEVICE="ether" > ;; > tr*) > IFDEVICE="tr" > ;; > *) > logger "Device not recognized. Adress will not be overwritten" > IFDEVICE="" > ;; > esac > if [ "$IFDEVICE" ] ; then > logger "New device address will be set to" $NEW_HWADDR > /sbin/ifconfig $DEVICE hw $IFDEVICE $NEW_HWADDR > fi > fi ># End adddition by Andreas Hotz >
The logger entries are for showing me anything that may go wrong. I have only Token Ring and Ethernet devices available, so I could not test whether the address change would work for other device types lile Arcnet. So I don't deal with other devices and give a "device not recognized" message back.
Could anybody else test whether this stuff works for him/her? And I think one could do the scripting better. I'm new to shell scripts and not an old linux/unix hacker (coming from OS/2 and REXX). So please feel free to make things better.