LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   eth0 and eth1 switch cards at run time! (https://www.linuxquestions.org/questions/linux-networking-3/eth0-and-eth1-switch-cards-at-run-time-236059/)

haxcess 09-27-2004 11:43 PM

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.

symen 09-28-2004 01:44 AM

Maybe a stupid question, but can I suppose you didn't physically swap your cards during the troubleshooting process?

haxcess 09-28-2004 10:30 AM

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.

slayer17 12-07-2005 11:35 AM

I had the same thing happen.... everything looked fine and then it switched cards. Did you find a reason for this?

symen 12-08-2005 06:25 AM

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

win32sux 12-08-2005 12:10 PM

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

zen0n 12-09-2005 11:38 PM

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

winsnomore 12-10-2005 12:05 AM

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

peter_robb 12-12-2005 04:17 PM

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


All times are GMT -5. The time now is 11:51 PM.