From: Rahul on
I have 2 different eth cards in a bunch of machines: a 1Gig and a 10Gig.
Each is a different vendor. How can I always make the 1 Gig come up as eth0
and the 10Gig as a eth2?

The MACs are of course all different, but the first 4 places of each vendor
are unique. i.e. Vendor1's cards (the 1GigE's) start with 00:26 and the
Vendor2's (10 Gig) with 00:07.

Normally I net install the machines automatially using PXE+Kickstart. I am
using CentOS 5.4.

Is udev the correct solution? I tried adding to /etc/udev/rules.d a file
havin the line:

KERNEL="eth*" ATTR{address}=="00:07:*" NAME="eth2"

but it didn't seem to work. Are there any other solutions? Or maybe I am
doing something wrong?

--
Rahul
From: Lew Pitcher on
On May 10, 2010 18:17, in comp.os.linux.misc, nospam(a)invalid.invalid wrote:

> I have 2 different eth cards in a bunch of machines: a 1Gig and a 10Gig.
> Each is a different vendor. How can I always make the 1 Gig come up as
> eth0 and the 10Gig as a eth2?
>
> The MACs are of course all different, but the first 4 places of each
> vendor
> are unique. i.e. Vendor1's cards (the 1GigE's) start with 00:26 and the
> Vendor2's (10 Gig) with 00:07.
>
> Normally I net install the machines automatially using PXE+Kickstart. I am
> using CentOS 5.4.
>
> Is udev the correct solution? I tried adding to /etc/udev/rules.d a file
> havin the line:
>
> KERNEL="eth*" ATTR{address}=="00:07:*" NAME="eth2"
>
> but it didn't seem to work. Are there any other solutions? Or maybe I am
> doing something wrong?

I use Slackware myself, and don't know CentOS, so your config /might/ be
different from mine. Having said that, I have a similar setup; a system
with two different ethernet cards in it, and I wanted to force a specific
card to eth0.

In /etc/udev/rules.d, I created a file called 70-persistent-net.rules, and
made it world-readable (a=r)

In 70-persistent-net.rules, I coded two rules, one for each NIC:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
ATTR{address}=="00:13:ff:fa:fc:fd", ATTR{type}=="1", KERNEL=="eth*", \
NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
ATTR{address}=="00:10:01:02:03:04", ATTR{type}=="1", KERNEL=="eth*", \
NAME="eth1"

where 00:13:ff:fa:fc:fd and 00:10:01:02:03:04 were the MAC addresses of the
two NICs in question.

With the next reboot (actually, the next udev refresh), my NICs were in the
right place.

Perhaps you can do something similar.

HTH
--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
---------- Slackware - Because I know what I'm doing. ------


From: Robert Heller on
At Mon, 10 May 2010 22:17:34 +0000 (UTC) Rahul <nospam(a)invalid.invalid> wrote:

>
> I have 2 different eth cards in a bunch of machines: a 1Gig and a 10Gig.
> Each is a different vendor. How can I always make the 1 Gig come up as eth0
> and the 10Gig as a eth2?
>
> The MACs are of course all different, but the first 4 places of each vendor
> are unique. i.e. Vendor1's cards (the 1GigE's) start with 00:26 and the
> Vendor2's (10 Gig) with 00:07.
>
> Normally I net install the machines automatially using PXE+Kickstart. I am
> using CentOS 5.4.
>
> Is udev the correct solution? I tried adding to /etc/udev/rules.d a file
> havin the line:
>
> KERNEL="eth*" ATTR{address}=="00:07:*" NAME="eth2"
>
> but it didn't seem to work. Are there any other solutions? Or maybe I am
> doing something wrong?

With CentOS (or any *RedHat* flavored distro, include RHEL itself or
Fedora Core), you 'bind' the device name (ethX) with the MAC address in
the ifcfg-ethX file in /etc/sysconfig/network-scripts/:

On my IBM Thinkpad X31 laptop (running CentOS 5.4):

/etc/sysconfig/network-scripts/ifcfg-eth0:
# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile)
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0D:60:CC:82:03
IPV6INIT=yes
IPV6_AUTOCONF=yes
ONBOOT=yes
DHCP_HOSTNAME=gollum.deepsoft.com

/etc/sysconfig/network-scripts/ifcfg-eth1:
# Intel Corporation PRO/Wireless LAN 2100 3B Mini PCI Adapter
DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes
HWADDR=00:04:23:72:b4:49



>

--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller(a)deepsoft.com -- Contract Programming: C/C++, Tcl/Tk


From: unruh on
On 2010-05-11, Robert Heller <heller(a)deepsoft.com> wrote:
> At Mon, 10 May 2010 22:17:34 +0000 (UTC) Rahul <nospam(a)invalid.invalid> wrote:
>
>>
>> I have 2 different eth cards in a bunch of machines: a 1Gig and a 10Gig.
>> Each is a different vendor. How can I always make the 1 Gig come up as eth0
>> and the 10Gig as a eth2?
>>
>> The MACs are of course all different, but the first 4 places of each vendor
>> are unique. i.e. Vendor1's cards (the 1GigE's) start with 00:26 and the
>> Vendor2's (10 Gig) with 00:07.
>>
>> Normally I net install the machines automatially using PXE+Kickstart. I am
>> using CentOS 5.4.
>>
>> Is udev the correct solution? I tried adding to /etc/udev/rules.d a file
>> havin the line:
>>
>> KERNEL="eth*" ATTR{address}=="00:07:*" NAME="eth2"
>>
>> but it didn't seem to work. Are there any other solutions? Or maybe I am
>> doing something wrong?
>
> With CentOS (or any *RedHat* flavored distro, include RHEL itself or
> Fedora Core), you 'bind' the device name (ethX) with the MAC address in
> the ifcfg-ethX file in /etc/sysconfig/network-scripts/:
>
> On my IBM Thinkpad X31 laptop (running CentOS 5.4):
>
> /etc/sysconfig/network-scripts/ifcfg-eth0:
> # Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile)
> DEVICE=eth0
> BOOTPROTO=dhcp
> HWADDR=00:0D:60:CC:82:03
> IPV6INIT=yes
> IPV6_AUTOCONF=yes
> ONBOOT=yes
> DHCP_HOSTNAME=gollum.deepsoft.com
>
> /etc/sysconfig/network-scripts/ifcfg-eth1:
> # Intel Corporation PRO/Wireless LAN 2100 3B Mini PCI Adapter
> DEVICE=eth1
> BOOTPROTO=dhcp
> ONBOOT=yes
> HWADDR=00:04:23:72:b4:49

Unfortunately I do not think that works. By the time the network scripts
are run, the system has already assigned the network card names. I think
that it has to be done in the udev rules. (Note that your naming
convetion is wha tthe system would naturally assign, and thus you might
not have realised that it was not working. Ie, try switching the two
files so you assing eth0 to your wlan.)

>
>
>
>>
>
From: Rahul on
Robert Heller <heller(a)deepsoft.com> wrote in
news:E4WdnafSeNbDA3XWnZ2dnUVZ_sidnZ2d(a)posted.localnet:

> With CentOS (or any *RedHat* flavored distro, include RHEL itself or
> Fedora Core), you 'bind' the device name (ethX) with the MAC address in
> the ifcfg-ethX file in /etc/sysconfig/network-scripts/:
>

The other problem with this approach is that I don't think it takes
wildcards. I won't know beforehand what exact MAC address needs to be eth0.
But I do know that it is vendor broadcom that needs to be the eth0 (1
GigE) and also that all their addresses are 00:26:*.

Luckily, at least in theory, udev has a facility of wildcarding MACs.
Unfortunately it doesn't seem to work as I thought it would. Yet. There is
also a way to use vendor names as per the udev documentation.
Unfortunatley, if I run udevinfo on the network cards this feild seems to
come out empty.

--
Rahul