LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-27-2004, 11:43 PM   #1
haxcess
LQ Newbie
 
Registered: Apr 2004
Location: Peterborough, Ontario, Canada
Distribution: Slackware 9 & 10
Posts: 13

Rep: Reputation: 0
eth0 and eth1 switch cards at run time!


Short version: eth0 is now called eth1, and eth1 is now called eth0. WTF!!?!?

Long version:
Here is the architecture:

INTERNET --> College Network --> VOIP Phone (2 port switch) --> My firewall laptop --> My network

On my laptop (slackware as a firewall), I have two PCMCIA ethernet cards. For about a month, the card in the top slot was eth0 (internal network) and the bottom slot was eth1 (college network). Then, yesterday at about 08:00 GMT (03:00 local) something happened. I'm not sure what, but these are the symptoms:

I couln't resolve any host names.
All traffic to and from the college (including Internet bound) stopped.
I was recieving arp traffic on the external card, so I wasn't unplugged
The phone still worked.
The internal network still worked. (SAMBA & broadcast audio)

I saw it happen. Data just stopped going out to the Internet, and stopped comming in to the Intranet.

This resulted in me panicking, because I couldn't access the Internet.
It seemed that I could not renew my external IP (dhcpcd -d -l 10 eth1). I worked all day on the assumtion that they got pissed off with me and denied access from my machine. I was changing MAC addresses and trying different ports but nothing was working.

Long story short, eth0 is now called eth1, and eth1 is now called eth0. This of course screws with the routing tables, IPTABLES rules, servers told to only run on one specific interface, and my brain!!!

I can see that the interfaces might get screwed up during boot (They never did before, but I'm guessing it could happen). But swapping interface names in run time? How the hell did that happen, and why are they not switching back? If I reboot, the interfaces STAY switched.

Is there a way I can force PCMCIA slot 0 to always be eth0, and slot 1 is always eth1?

I hate computers, still.
 
Old 09-28-2004, 01:44 AM   #2
symen
Member
 
Registered: Sep 2004
Location: Dublin
Distribution: Debian 3
Posts: 61

Rep: Reputation: 15
Maybe a stupid question, but can I suppose you didn't physically swap your cards during the troubleshooting process?
 
Old 09-28-2004, 10:30 AM   #3
haxcess
LQ Newbie
 
Registered: Apr 2004
Location: Peterborough, Ontario, Canada
Distribution: Slackware 9 & 10
Posts: 13

Original Poster
Rep: Reputation: 0
rofl

hah! I wish I swapped the cards. Now I gotta re-write all my config files and scripts. I suppose I shold set environment variables from now on so that this process becomes a whole lot easier to fix.
 
Old 12-07-2005, 11:35 AM   #4
slayer17
LQ Newbie
 
Registered: Nov 2005
Location: Lewisville Texas
Posts: 4

Rep: Reputation: 0
I had the same thing happen.... everything looked fine and then it switched cards. Did you find a reason for this?
 
Old 12-08-2005, 06:25 AM   #5
symen
Member
 
Registered: Sep 2004
Location: Dublin
Distribution: Debian 3
Posts: 61

Rep: Reputation: 15
The naming of your network interfaces is controller by the order in which you load their modules.
This is configured in the file /etc/modules.
depending on your distro their can be other ways to load these modules at boot, so don't panic if yours aren't in this file yet.

example: if you had a 3com card and an intel e100 card and the 3c59x module loaded first, the 3com card would become eth0
if you wanted this to be different you'd write /etc/modules as follows:

e100
3c59x

simple as that.

two notes:
-this doesnt count if your network drivers are compiled into the kernel of course.
-depending on your distro, this /etc/modules could be something else.

hope this helps,
Symen
 
Old 12-08-2005, 12:10 PM   #6
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by symen
example: if you had a 3com card and an intel e100 card and the 3c59x module loaded first, the 3com card would become eth0
so how does it work if you have two network cards with the same chipset?? cuz you'd only need to modprobe once... i assume it would be determined by the order the cards are in as far as the PCI bus is concerned (physically), right?? in that case, how would you go about changing the logical order without changing the physical order?? i'm just curious, cuz with that info it might be easier to find-out why the logical names flipped for haxcess and slayer17...
 
Old 12-09-2005, 11:38 PM   #7
zen0n
LQ Newbie
 
Registered: Jul 2004
Location: Winnipeg
Distribution: debian
Posts: 22

Rep: Reputation: 15
You could use /sbin/nameif to set the name of devices after you boot. This is what i did for my wireless nic. You create a file /etc/mactab with the mac adress' of the 2 cards and the names you want to call them. Of course I don't have my laptop on me, but just check the man pages or search your apt for nameif. I *think* it was the network-tools or something package in debian.

If you want to set this permanently you will have to modify your /etc/init.d/networking script to add the call to /sbin/nameif BEFORE the script brings up all the interfaces or it won't work.

Ryan
 
Old 12-10-2005, 12:05 AM   #8
winsnomore
Member
 
Registered: May 2004
Location: USA
Distribution: #1 PCLinuxOS -- for laughs -> Ubuntu, Suse, Mepis
Posts: 315

Rep: Reputation: 31
you can also edit modules.conf file ..
and switch the eth0/eth1 device names.

It's stupid but the way it works is explained above .. there is NO logic to this argument, simple thing is that install scripts call them eth0/eth1 but the booted kernel ends up flipping them.

I had the same issue with Suse .. on the same hardware Knoppix/Debian/Mepis never had a problem!!
 
Old 12-12-2005, 04:17 PM   #9
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
Usually with the same driver for several cards, the acpi system would boot the card with the lowest pci bus number first.. which makes it quite reliable.

With hotplug systems, it would also use the pci order for the cards, but the pnp BIOS could interfere with this, so forcing acpi is a good choice.

I still prefer to use a slow 10Mbit NIC for the intenet connection and compile that driver into the kernel to make sure it gets eth0 first.
Of course if you're on a 10MBit backbone you could use a faster NIC..

Last edited by peter_robb; 12-12-2005 at 04:18 PM.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i assign/switch eth0 & eth1 the-sloth Linux - Networking 10 02-05-2011 12:48 PM
Mandrake is switching the eth1 and eth0 interfaces... how can I switch them back? LaptopLinux Mandriva 3 03-28-2005 09:23 PM
Suse 9.2 - How is determined which network cards becomes eth0 and which eth1 doublemax Linux - Networking 5 02-04-2005 10:25 AM
How do you switch the default ethernet adapter (eth0 to eth1)? scoobdoobery Linux - Networking 3 09-05-2004 01:29 PM
eth1 added, mysql connections FROM this machine are from eth1. Need bound to eth0??? kreese Linux - Networking 9 03-31-2004 12:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration