Jan:

On Mon, Dec 29, 2003 at 03:41:29PM +0100, Jan Minar wrote:
> Morning!
> 
> Please don't CC me, I'm subscribed.

Sorry about the CC, when I hit "Reply", you were there first and I
failed to delete you.  Shouldn't happen this time...

> 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>

Before finding this Email on the list, I experimented with exactly your
idea.  Of course it worked.  I stuck the following 3 lines in front of
the "ifup -a" in "/etc/init.d/networking":

        /sbin/nameif -s eth2 00:50:da:08:f0:4a  # 3COM:    set to eth2
        /sbin/nameif -s eth1 00:40:05:45:19:22  # Linksys: set to eth1
        /sbin/nameif -s eth0 00:50:da:08:f0:4a  # 3COM:    set to eth0

To the list readers/responders who suggested using the module interface,
thankyou.  I'm sure that such a procedure wold also work.  I just
happened to have both NIC's built into the kernel already - hence the
request.

> 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.

Dean

-- 
                                Dean Provins 
                            50.950333,-114.037916
                          [EMAIL PROTECTED]
                  KeyID at at pgpkeys.mit.edu:11371: 0x9643AE65


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to