Re: 2 NIC's, assigned in wrong order

2003-12-29 Thread Dean Allen Provins
Jan:

On Mon, Dec 29, 2003 at 12:33:17AM +0100, Jan Minar wrote:
 On Sun, Dec 28, 2003 at 12:56:47PM -0700, Dean Allen Provins wrote:
  I have two Ethernet cards (NICs) in a PII-300.  The first recognized is
  an NE2000 ISA clone at IRQ10, and the second is a PCI at (shared) IRQ
  12.
  
  I would like the second (the PCI) to be assigned as ETH0, and the first
  (ISA) to be ETH1.
 
 I have rather similar problem.  And what is the solution when the cards
 are the same type? -- The closest I got is:
 
 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
Dec 28 19:11:31 ve6wvc nameif: cannot change name of eth0 to eth1: Device or resource 
busy

A typical script was eth0.sh:

#!/bin/sh

#   Set up eth0 as the 3COM card (system sets it to eth1 at boot)

/sbin/nameif -s eth0 00:50:da:08:f0:4a

exit 0

with invocation in interfaces as:

auto eth0 eth1

iface eth0 inet static
  pre-up /etc/network/if-pre-up.d/eth0.sh
  address192.168.0.3
  network192.168.0.0
  netmask255.255.255.0
  broadcast  192.168.0.255
  gateway192.168.0.1

iface eth1 inet static
  pre-up /etc/network/if-pre-up.d/eth1.sh
  address192.168.0.30
  network192.168.0.0
  netmask255.255.255.0
  broadcast  192.168.0.255
  gateway192.168.0.1

Unfortunately it failed as noted above, even though I downed the network
and then restarted it.  Any ideas or insights?

Merry Christmas to you too.

Dean

 Whoopy Xmas.
 Jan.
 
  I've fiddled with the ether= append line for the kernel, and also the
  contents of the interfaces file in /etc/network to no avail.
 
 
 
 -- 
 Jan Minar  Had I any humility, I would be perfect.

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



Re: 2 NIC's, assigned in wrong order

2003-12-29 Thread Jan Minar
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 MinarChvostny Snovy krok. \/\ Whoopy Boo Year.


pgp0.pgp
Description: PGP signature


Re: 2 NIC's, assigned in wrong order: thanks

2003-12-29 Thread Dean Allen Provins
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 MinarChvostny 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]



Re: 2 NIC's, assigned in wrong order

2003-12-29 Thread Laurence J. Lane
On Sun, Dec 28, 2003 at 07:22:04PM -0700, Dean Allen Provins wrote:

[ parts omitted ]

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

[ ... ]

 iface eth0 inet static
   pre-up /etc/network/if-pre-up.d/eth0.sh

As an aside, /etc/network/*.d/ directories are the places to put
scripts that are run automatically, run-parts(8) style. Scripts
run from /etc/network/interfaces should be placed elsewhere.


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



Re: 2 NIC's, assigned in wrong order

2003-12-29 Thread Jan Minar
On Mon, Dec 29, 2003 at 03:41:29PM +0100, Jan Minar wrote:
  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.

This is what Bernd Eckenfels says in [EMAIL PROTECTED],
in a Debian Bug #225256 thread:

| On Mon, Dec 29, 2003 at 03:56:09PM +0100, Jan Minar wrote:
|  BTW: Is nameif's unability to swap names of two existing devices a
|  kernel limitation, or another nameif's bug?
| 
| it is a missing feature in nameif, it will have to rename to a temporary
| name. Hmm.. possibly there are some patches floating around to fix that,
| send them to me if you see them .)

Just if anybody wanted to know.

-- 
Jan MinarChvostny Snovy krok. \/\ Whoopy Boo Year.


pgp0.pgp
Description: PGP signature


2 NIC's, assigned in wrong order

2003-12-28 Thread Dean Allen Provins
Hello:

I have two Ethernet cards (NICs) in a PII-300.  The first recognized is
an NE2000 ISA clone at IRQ10, and the second is a PCI at (shared) IRQ
12.

I would like the second (the PCI) to be assigned as ETH0, and the first
(ISA) to be ETH1.

I've fiddled with the ether= append line for the kernel, and also the
contents of the interfaces file in /etc/network to no avail.

Anyone know how to force the assignment without resorting to ifconfig
and route directly?

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]



Re: 2 NIC's, assigned in wrong order

2003-12-28 Thread vidarlo
On Sun, 28 Dec 2003, Dean Allen Provins wrote:

 Hello:

 I have two Ethernet cards (NICs) in a PII-300.  The first recognized is
 an NE2000 ISA clone at IRQ10, and the second is a PCI at (shared) IRQ
 12.

 I would like the second (the PCI) to be assigned as ETH0, and the first
 (ISA) to be ETH1.

 I've fiddled with the ether= append line for the kernel, and also the
 contents of the interfaces file in /etc/network to no avail.

Simply try swapping in /etc/modules.conf where you for example have a
entry reading:
alias eth0 3c59x
alias eth1 e1000
and swap eth1 and eth0 there...

 Anyone know how to force the assignment without resorting to ifconfig
 and route directly?

 Dean

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




-- 
MVH,
Vidar
In order to make an apple pie from scratch, you must first create the
universe.
-- Carl Sagan, Cosmos


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



Re: 2 NIC's, assigned in wrong order

2003-12-28 Thread Johann Koenig
On Sunday December 28 at 12:56pm
Dean Allen Provins [EMAIL PROTECTED] wrote:

 Anyone know how to force the assignment without resorting to
 ifconfig and route directly?

Go on-site and swap the cables?
-- 
-johann koenig
Now Playing: Miami Sound Machine - Hot Summer Nights : Top Gun
Today is Boomtime, the 70th day of The Aftermath in the YOLD 3169
My public pgp key: http://mental-graffiti.com/pgp/johannkoenig.pgp


pgp0.pgp
Description: PGP signature


Re: 2 NIC's, assigned in wrong order

2003-12-28 Thread Jan Minar
On Sun, Dec 28, 2003 at 12:56:47PM -0700, Dean Allen Provins wrote:
 I have two Ethernet cards (NICs) in a PII-300.  The first recognized is
 an NE2000 ISA clone at IRQ10, and the second is a PCI at (shared) IRQ
 12.
 
 I would like the second (the PCI) to be assigned as ETH0, and the first
 (ISA) to be ETH1.

I have rather similar problem.  And what is the solution when the cards
are the same type? -- The closest I got is:

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.

Whoopy Xmas.
Jan.

 I've fiddled with the ether= append line for the kernel, and also the
 contents of the interfaces file in /etc/network to no avail.



-- 
Jan Minar  Had I any humility, I would be perfect.


pgp0.pgp
Description: PGP signature


Re: 2 NIC's, assigned in wrong order

2003-12-28 Thread Micha Feigin
On Mon, Dec 29, 2003 at 12:33:17AM +0100, Jan Minar wrote:
 On Sun, Dec 28, 2003 at 12:56:47PM -0700, Dean Allen Provins wrote:
  I have two Ethernet cards (NICs) in a PII-300.  The first recognized is
  an NE2000 ISA clone at IRQ10, and the second is a PCI at (shared) IRQ
  12.
  
  I would like the second (the PCI) to be assigned as ETH0, and the first
  (ISA) to be ETH1.
 

First of all, why does the name order matter?

Second, iirc they are named by order of detection, so you could compile
them in as modules and then load the modules in the naming order you
want.
From what you are writing, it is not relevant for this case, but if
they both use the same driver, replacing their physical order in the
slot should do the trick.

 I have rather similar problem.  And what is the solution when the cards
 are the same type? -- The closest I got is:
 
 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.
 
 Whoopy Xmas.
 Jan.
 
  I've fiddled with the ether= append line for the kernel, and also the
  contents of the interfaces file in /etc/network to no avail.
 
 
 
 -- 
 Jan Minar  Had I any humility, I would be perfect.



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