Morning!
Please don't CC me, I'm subscribed.
On Sun, Dec 28, 2003 at 07:22:04PM -0700, Dean Allen Provins wrote:
> > nameif (8) - name network interfaces based on MAC addresses
> >
> > But I couldn't find nameif called from anywhere--so I guess the right
> > thing to do would be to call it from /etc/init.d/networking or
> > /etc/networking/interfaces.
>
> That seemed like such a good suggestion. I created scripts to assign
> the desired names to the desired MAC addresses and placed them in
> /etc/network/if-pre-up.d/, and then added invocation in the interfaces
> file, but I keep getting the messages (in syslog):
>
> Dec 28 19:11:31 ve6wvc nameif: cannot change name of eth1 to eth0: File exists
The `file' here is the network device `eth0' -- ``ifconfig -a'' will
show both eth1 and eth0 are there, waiting to be upped. This looks like
a kernel limitation.
The workaround is something like:
# nameif foo <HWADDR1>
# nameif eth0 <HWADDR0>
# nameif eth1 <HWADDR1>
So I when there is an interface bar that (1) is down, and (2) has a name
we want, we just give bar a random name foo. If (2) is not true, we
just proceed ourselves, and when (1) is not true, we die screaming
aloud. Loosely:
# HWADDR_TO_RENAME="$(ip -l | grep -A1 eth0 | tail -n1 | awk '{print $2}')"
# [ -n "$HWADDR_TO_RENAME" ] && nameif foo "$HWADDR_TO_RENAME"
in both the scripts, _before_ the real naming.
> Dec 28 19:11:31 ve6wvc nameif: cannot change name of eth0 to eth1: Device or resource busy
Then, the eth1 is UP (busy). You might want to go to singleuser mode,
put the network down, and experiment a bit, just to grasp what's going
on.
> A typical script was "eth0.sh":
<snip>
The scripts are OK.
> Merry Christmas to you too.
:-)
--
Jan Minar Chvostny Snovy krok. \/\ Whoopy Boo Year.
Attachment:
pgpqFDzJl48F0.pgp
Description: PGP signature