Unix Technical Forum

Sometimes eth0 & eth1 swap in Fedora

This is a discussion on Sometimes eth0 & eth1 swap in Fedora within the Linux Operating System forums, part of the Unix Operating Systems category; --> "Allen McIntosh" <nospam@mouse-potato.com> wrote in message news:11esg.512$Rj3.36@fe11.lga... >>> You are lucky. Try changing the order of those and see ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 01-18-2008, 07:13 PM
Nico Kadel-Garcia
 
Posts: n/a
Default Re: Sometimes eth0 & eth1 swap in Fedora


"Allen McIntosh" <nospam@mouse-potato.com> wrote in message
news:11esg.512$Rj3.36@fe11.lga...
>>> You are lucky. Try changing the order of those and see what happens. Ie,
>>> alias eth0 e1000
>>> alias eth1 e100
>>> alias eth2 e1000
>>>

>> eth0 and eth1 cannot be changed as they are 1 GBit ethernet interfaces on
>> my
>> motherboard. eth2 is a 100 Megabit NIC. So i cannot move them around.

>
> nameif might do this for you. I've never actually tried it, but I've had
> it mess up the order in modules.conf so many times that it's got to be
> able to do this :-)


And you have my sympathies. I've only had to deal with, ohhhhh, let's see.
Several thousand machines where some far-too-clever person decided that
simply labeling the machines was not the right thing to do, and started
playing weird games with putting one network module as a built-in module and
the other network deliberately as a different network card, to assure that
eth0 and eth1 didn't get swapped.

The HWADDRESS in the RedHat /etc/sysconfig/ifcfg-* scripts are pretty useful
to avoid this, but they can seriously screw things up if you start swapping
in and out various network devices.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 01-18-2008, 07:13 PM
Jean-David Beyer
 
Posts: n/a
Default Re: Sometimes eth0 & eth1 swap in Fedora

Unruh wrote:
> Jean-David Beyer <jeandavid8@verizon.net> writes:
>
>> Unruh wrote:
>>> Jean-David Beyer <jeandavid8@verizon.net> writes:
>>>
>>>> Allen Kistler wrote:
>>>>> I saw this occasionally in FC3 when booting, but I think I see it
>>>>> more often in FC5. My relevant modprobe.conf lines are as follows
>>>>> ...
>>>>>
>>>>> alias eth0 tg3 alias eth1 ipw2200
>>>>>
>>>>> Yet sometimes ipw2200 gets assigned to eth0 and tg3 gets assigned to
>>>>> eth0. ifconfig and iwconfig say so.
>>>>>
>>>> Is this a new "feature" in Fedora? Because in RHEL3 this does not
>>>> happen:
>>>> [/etc]$ cat modules.conf alias eth0 e1000 alias eth1 e1000 alias eth2
>>>> e100
>>>
>>>> This never messes up.
>>> You are lucky. Try changing the order of those and see what happens. Ie,
>>> alias eth0 e1000
>>> alias eth1 e100
>>> alias eth2 e1000
>>>

>> eth0 and eth1 cannot be changed as they are 1 GBit ethernet interfaces on my
>> motherboard. eth2 is a 100 Megabit NIC. So i cannot move them around.

>
> Move them around? It is the names that we are concerned with. As I said to
> you, you are lucky that your system does not change names. Note that if you
> look at teh two e1000 interfaces, I suspect that the ordering is
> undetermined-- sometimes the one card is eth0 and sometimes the other.
>

It has never happened. Since eth0 and eth1 are on different networks,
sending to machines on one or the other would not work if the two interfaces
switched around whimsically.

--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ PGP-Key: 9A2FC99A Registered Machine 241939.
/( )\ Shrewsbury, New Jersey http://counter.li.org
^^-^^ 08:20:01 up 90 days, 21:53, 4 users, load average: 4.33, 4.19, 4.07
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 01-18-2008, 07:13 PM
Jean-David Beyer
 
Posts: n/a
Default Re: Sometimes eth0 & eth1 swap in Fedora

Unruh wrote:
> Jean-David Beyer <jeandavid8@verizon.net> writes:
>
>> Unruh wrote:
>>> Jean-David Beyer <jeandavid8@verizon.net> writes:
>>>
>>>> Allen Kistler wrote:
>>>>> I saw this occasionally in FC3 when booting, but I think I see it
>>>>> more often in FC5. My relevant modprobe.conf lines are as follows
>>>>> ...
>>>>>
>>>>> alias eth0 tg3 alias eth1 ipw2200
>>>>>
>>>>> Yet sometimes ipw2200 gets assigned to eth0 and tg3 gets assigned to
>>>>> eth0. ifconfig and iwconfig say so.
>>>>>
>>>> Is this a new "feature" in Fedora? Because in RHEL3 this does not
>>>> happen:
>>>> [/etc]$ cat modules.conf alias eth0 e1000 alias eth1 e1000 alias eth2
>>>> e100
>>>
>>>> This never messes up.
>>> You are lucky. Try changing the order of those and see what happens. Ie,
>>> alias eth0 e1000
>>> alias eth1 e100
>>> alias eth2 e1000
>>>

>> eth0 and eth1 cannot be changed as they are 1 GBit ethernet interfaces on my
>> motherboard. eth2 is a 100 Megabit NIC. So i cannot move them around.

>
> Move them around? It is the names that we are concerned with. As I said to
> you, you are lucky that your system does not change names. Note that if you
> look at teh two e1000 interfaces, I suspect that the ordering is
> undetermined-- sometimes the one card is eth0 and sometimes the other.
>

Why is it luck? In /etc/sysconfig/network-scripts are two files:

[/etc/sysconfig/network-scripts]$ cat ifcfg-eth0
# Intel Corp.|82546EB Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.1.255
HWADDR=01:32:43:24:1D:5E
IPADDR=192.168.1.251
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
PEERDNS=no
[/etc/sysconfig/network-scripts]$ cat ifcfg-eth1
# Intel Corp.|82546EB Gigabit Ethernet Controller (Copper)
DEVICE=eth1
BOOTPROTO=none
BROADCAST=192.168.2.255
HWADDR=01:32:43:24:1D:5F
IPADDR=192.168.2.251
NETMASK=255.255.255.0
NETWORK=192.168.2.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
PEERDNS=no

Do these not make the system always use the same NI for the same hardware
and same LAN port? Not luck?


--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ PGP-Key: 9A2FC99A Registered Machine 241939.
/( )\ Shrewsbury, New Jersey http://counter.li.org
^^-^^ 10:10:01 up 90 days, 23:43, 5 users, load average: 4.57, 4.46, 4.34
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 01-18-2008, 07:13 PM
Unruh
 
Posts: n/a
Default Re: Sometimes eth0 & eth1 swap in Fedora

Jean-David Beyer <jeandavid8@verizon.net> writes:

>Unruh wrote:
>> Jean-David Beyer <jeandavid8@verizon.net> writes:
>>
>>> Unruh wrote:
>>>> Jean-David Beyer <jeandavid8@verizon.net> writes:
>>>>
>>>>> Allen Kistler wrote:
>>>>>> I saw this occasionally in FC3 when booting, but I think I see it
>>>>>> more often in FC5. My relevant modprobe.conf lines are as follows
>>>>>> ...
>>>>>>
>>>>>> alias eth0 tg3 alias eth1 ipw2200
>>>>>>
>>>>>> Yet sometimes ipw2200 gets assigned to eth0 and tg3 gets assigned to
>>>>>> eth0. ifconfig and iwconfig say so.
>>>>>>
>>>>> Is this a new "feature" in Fedora? Because in RHEL3 this does not
>>>>> happen:
>>>>> [/etc]$ cat modules.conf alias eth0 e1000 alias eth1 e1000 alias eth2
>>>>> e100
>>>>
>>>>> This never messes up.
>>>> You are lucky. Try changing the order of those and see what happens. Ie,
>>>> alias eth0 e1000
>>>> alias eth1 e100
>>>> alias eth2 e1000
>>>>
>>> eth0 and eth1 cannot be changed as they are 1 GBit ethernet interfaces on my
>>> motherboard. eth2 is a 100 Megabit NIC. So i cannot move them around.

>>
>> Move them around? It is the names that we are concerned with. As I said to
>> you, you are lucky that your system does not change names. Note that if you
>> look at teh two e1000 interfaces, I suspect that the ordering is
>> undetermined-- sometimes the one card is eth0 and sometimes the other.
>>

>It has never happened. Since eth0 and eth1 are on different networks,
>sending to machines on one or the other would not work if the two interfaces
>switched around whimsically.


I am glad. It has happened to me.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 01-18-2008, 07:13 PM
Scott Lurndal
 
Posts: n/a
Default Re: Sometimes eth0 & eth1 swap in Fedora

"Nico Kadel-Garcia" <nkadel@comcast.net> writes:
>
>"Allen McIntosh" <nospam@mouse-potato.com> wrote in message
>news:11esg.512$Rj3.36@fe11.lga...
>>>> You are lucky. Try changing the order of those and see what happens. Ie,
>>>> alias eth0 e1000
>>>> alias eth1 e100
>>>> alias eth2 e1000
>>>>
>>> eth0 and eth1 cannot be changed as they are 1 GBit ethernet interfaces on
>>> my
>>> motherboard. eth2 is a 100 Megabit NIC. So i cannot move them around.

>>
>> nameif might do this for you. I've never actually tried it, but I've had
>> it mess up the order in modules.conf so many times that it's got to be
>> able to do this :-)

>
>And you have my sympathies. I've only had to deal with, ohhhhh, let's see.
>Several thousand machines where some far-too-clever person decided that
>simply labeling the machines was not the right thing to do, and started
>playing weird games with putting one network module as a built-in module and
>the other network deliberately as a different network card, to assure that
>eth0 and eth1 didn't get swapped.
>
>The HWADDRESS in the RedHat /etc/sysconfig/ifcfg-* scripts are pretty useful
>to avoid this, but they can seriously screw things up if you start swapping
>in and out various network devices.


The HWADDRESS that kudzu puts in the /etc/sysconfig/network-scripts/ifcfg*
scripts is worse than useless.

However, if you want a particular port to always be known by a given name
regardless of module load order or static vs. dynamic kernel drivers with
RHEL4 systems, use 'udev' to name your network devices. Here's a sample
udev config file that I use. Note that this file (installed in /etc/udev/rules.d)
will change the names from 'eth*' to 'lan*' (as there are some bugs in
RHEL4 udev when _re_naming eth*). Adjust the pci bus addresses to match your
hardware.

scott

/etc/udev/rules.d/20-ethrename:
#
# Rules to assign fixed names to the @#$*& ethernet ports
#
KERNEL="eth*", BUS="pci", ID="0000:04:04.0", NAME="lan0"
KERNEL="eth*", BUS="pci", ID="0000:04:04.1", NAME="lan1"
KERNEL="eth*", BUS="pci", ID="0000:0d:04.0", NAME="lan2"
KERNEL="eth*", BUS="pci", ID="0000:22:04.0", NAME="lan3"
KERNEL="eth*", BUS="pci", ID="0000:11:04.0", NAME="lan4"
KERNEL="eth*", BUS="pci", ID="0000:11:04.1", NAME="lan5"
KERNEL="eth*", BUS="pci", ID="0000:13:04.0", NAME="lan6"
KERNEL="eth*", BUS="pci", ID="0000:13:04.1", NAME="lan7"
KERNEL="eth*", BUS="pci", ID="0000:08:04.0", NAME="lan8"
KERNEL="eth*", BUS="pci", ID="0000:08:04.1", NAME="lan9"
KERNEL="eth*", BUS="pci", ID="0000:0a:04.0", NAME="lan10"
KERNEL="eth*", BUS="pci", ID="0000:0a:04.1", NAME="lan11"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 01-18-2008, 07:13 PM
Scott Lurndal
 
Posts: n/a
Default Re: Sometimes eth0 & eth1 swap in Fedora

Jean-David Beyer <jeandavid8@verizon.net> writes:
>Unruh wrote:
>> Jean-David Beyer <jeandavid8@verizon.net> writes:
>>
>>> Unruh wrote:
>>>> Jean-David Beyer <jeandavid8@verizon.net> writes:
>>>>
>>>>> Allen Kistler wrote:
>>>>>> I saw this occasionally in FC3 when booting, but I think I see it
>>>>>> more often in FC5. My relevant modprobe.conf lines are as follows
>>>>>> ...
>>>>>>
>>>>>> alias eth0 tg3 alias eth1 ipw2200
>>>>>>
>>>>>> Yet sometimes ipw2200 gets assigned to eth0 and tg3 gets assigned to
>>>>>> eth0. ifconfig and iwconfig say so.
>>>>>>
>>>>> Is this a new "feature" in Fedora? Because in RHEL3 this does not
>>>>> happen:
>>>>> [/etc]$ cat modules.conf alias eth0 e1000 alias eth1 e1000 alias eth2
>>>>> e100
>>>>
>>>>> This never messes up.
>>>> You are lucky. Try changing the order of those and see what happens. Ie,
>>>> alias eth0 e1000
>>>> alias eth1 e100
>>>> alias eth2 e1000
>>>>
>>> eth0 and eth1 cannot be changed as they are 1 GBit ethernet interfaces on my
>>> motherboard. eth2 is a 100 Megabit NIC. So i cannot move them around.

>>
>> Move them around? It is the names that we are concerned with. As I said to
>> you, you are lucky that your system does not change names. Note that if you
>> look at teh two e1000 interfaces, I suspect that the ordering is
>> undetermined-- sometimes the one card is eth0 and sometimes the other.
>>

>It has never happened. Since eth0 and eth1 are on different networks,
>sending to machines on one or the other would not work if the two interfaces
>switched around whimsically.


The ordering is determined by the PCI bus scan order. With motherboard
resident interfaces (and if both interfaces use the same driver), the
order is deterministic. If, however, you subsequently install a NIC in
a vacant PCI, PCI-X, or PCIe slot, the scan order _may_ change, and you
may find that eth1 is no longer the motherboard NIC, eth2 is and eth1 is
the newly installed NIC, in which case your /etc/sysconfig/network-scripts/ifcfg*
will no longer provide the required configuration.

scott
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 01-18-2008, 07:13 PM
Baho Utot
 
Posts: n/a
Default Re: Sometimes eth0 & eth1 swap in Fedora

Allen Kistler wrote:

>
>
> I saw this occasionally in FC3 when booting, but I think I see it more
> often in FC5. My relevant modprobe.conf lines are as follows ...
>
> alias eth0 tg3
> alias eth1 ipw2200
>
> Yet sometimes ipw2200 gets assigned to eth0 and tg3 gets assigned to
> eth0. ifconfig and iwconfig say so.
>
> My suspicion is that ipw2200 finishes loading first (sometimes) and just
> grabs eth0 as the first available ethX designation. Then tg3 grabs the
> next one.
>
> Why don't the modules obey modprobe.conf when they load? I can unload
> and load them manually in the right order, but it ought to happen
> automatically.
>
> Is there any way to force the modules to obey what exists in
> modprobe.conf? (which really seems to me like a silly question, except
> that they don't already)
>
> Thanks in advance for any info.


Coming late into this thread I would like to add this to the discussion.
If it is not relevant the please disregard.


7.4.3.7. Device naming order changes randomly after rebooting

This is due to the fact that Udev, by design, handles uevents and loads
modules in parallel, and thus in an unpredictable order. This will never
be “fixed”. You should not rely upon the kernel device names being stable.
Instead, create your own rules that make symlinks with stable names based
on some stable attributes of the device, such as a serial number or the
output of various *_id utilities installed by Udev. See also the network
interface renaming example in Section 7.12, “Configuring the network
Script”.

7.12.1. Creating stable names for network interfaces

Instructions in this section are optional if you have only one network
card.
With Udev and modular network drivers, the network interface numbering is
not persistent across reboots by default, because the drivers are loaded in
parallel and, thus, in random order. For example, on a computer having two
network cards made by Intel and Realtek, the network card manufactured by
Intel may become eth0 and the Realtek card becomes eth1. In some cases,
after a reboot the cards get renumbered the other way around. To avoid
this, create Udev rules that assign stable names to network cards based on
their MAC addresses.
First, find out the MAC addresses of your network cards:
grep -H . /sys/class/net/*/address

For each network card (but not for the loopback interface), invent a
descriptive name, such as “realtek”, and create Udev rules similar to the
following:
cat > /etc/udev/rules.d/26-network.rules << "EOF"
ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="52:54:00:12:34:56",
NAME="realtek"
ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="00:a0:c9:78:9a:bc",
NAME="intel"
EOF

These rules will always rename the network cards to “realtek” and “intel”,
independently of the original numbering provided by the kernel. Use these
names instead of “eth0” in the network interface configuration files
created below.
Note
Persistent names must be different from the default network interface names
assigned by the kernel.



--
Dancin' in the ruins tonight
mail: echo onub-hgbg@pbyhzohf.ee.pbz | perl -pe 'y/a-z/n-za-m/'
Tayo'y Mga Pinoy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:16 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com