Gentoo Forums
Gentoo Forums
Quick Search: in
eth0 and eth1 exchanged on reboot [solved]
View unanswered posts
View posts from last 24 hours

rackathon
 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
daemonflower
Apprentice
Apprentice


Joined: 17 Jul 2004
Posts: 267

PostPosted: Fri Jun 16, 2006 8:41 am    Post subject: eth0 and eth1 exchanged on reboot [solved] Reply with quote

Every few reboots my eth0 and eth1 are exchanged.

I don't need to tell you that this sucks, but just to mention it: This sucks.

Does anybody know this problem? How can I tell the system once and for all which NIC is eth0 and which one is eth1?

TIA,

Helge
_________________
If you like this thought, try some more: http://hyperspace-travel.de/blog


Last edited by daemonflower on Tue Jul 11, 2006 9:27 am; edited 1 time in total
Back to top
View user's profile Send private message
guduri
Apprentice
Apprentice


Joined: 04 Apr 2005
Posts: 230
Location: Ann Arbor, Michigan

PostPosted: Fri Jun 16, 2006 8:52 am    Post subject: Reply with quote

It used to happen to me with my dvd devices. /dev/dvd used to link to /dev/hdc sometimes and /dev/hdd other times. Fixed this by adding custom udev rules (Maybe you could do something similar). Here is the wiki

http://gentoo-wiki.com/HOWTO_Customizing_UDEV
_________________
Power is about what you can control. Freedom is about what you can unleash.
Back to top
View user's profile Send private message
Clansman
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2004
Posts: 140

PostPosted: Fri Jun 16, 2006 9:06 am    Post subject: Reply with quote

Hi,

This can be solved with nameif (don't remember to which package it belongs, but it's a base ebuild one so you probably have it installed).

nameif associates mac addresses with network interface names. avoid at all costs using "standard" names like eth0, eth1 and such (it won't work). Use instead ethLAN, ethWAN, ethUPLINK, ethDMZ, etc.

configure your associations in /etc/mactab and all that's left is running nameif before starting network interfaces:
Code:

# /etc/mactab
ethLAN AA:BB:CC:DD:EE:FF


create a nameif init.d script just to run the nameif program on boot (rc-update add nameif boot) *BEFORE* attempting to even probe network devices.
update your init scripts to reflect new interface names and you're done. you can now glue some stickers/post-its with names on the cards themselves because no matter where (slot) they are, they will allways correspond to the same network interface name.

i'd appreciate some comments, because I'm not sure if there's a more clever way of achieving this goal.

Cheers,
_________________
http://www.pjvenda.org
Back to top
View user's profile Send private message
Clansman
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2004
Posts: 140

PostPosted: Fri Jun 16, 2006 9:09 am    Post subject: Reply with quote

whoops! just found it. The referred link about udev shows just how it can be done:

Code:

KERNEL=="eth*", SYSFS{address}=="00:52:8b:d5:04:48", NAME="lan"


all that's left is figuring the syntax of the beast and I can get rid of the nameif startup script.

Cheers,
_________________
http://www.pjvenda.org
Back to top
View user's profile Send private message
thepustule
Apprentice
Apprentice


Joined: 22 Feb 2004
Posts: 208
Location: Toronto, Canada

PostPosted: Fri Jun 16, 2006 11:49 am    Post subject: Reply with quote

If your problem is only with two interfaces, just build the driver for your your eth0 interface directly into the kernel and do your eth1 driver as a module. That will guarantee that the eth0 driver is always loaded first. For three or more interfaces, this won't work, bur for two it should be a slam-dunk.

I mean, who wants to go through every flaming config file in their /etc just to change all the interface names in every config for every service, because you had to rename the interface with nameif?
Back to top
View user's profile Send private message
Clansman
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2004
Posts: 140

PostPosted: Fri Jun 16, 2006 2:56 pm    Post subject: Reply with quote

erm... sed?
_________________
http://www.pjvenda.org
Back to top
View user's profile Send private message
kbps
n00b
n00b


Joined: 06 Mar 2006
Posts: 38
Location: Vladivostok, Russia

PostPosted: Mon Jul 03, 2006 8:51 pm    Post subject: Reply with quote

see my last post http://forums.gentoo.org/viewtopic-t-451044-highlight-eth0+eth1+randomly.html
Back to top
View user's profile Send private message
feld
Guru
Guru


Joined: 29 Aug 2004
Posts: 593
Location: WI, USA

PostPosted: Tue Jul 04, 2006 11:18 am    Post subject: Reply with quote

make them both modules and then in /etc/modules-autoload.d/kernel-2.6 list them in the order you want them to be in........
_________________
< bmg505> I think the first line in reiserfsck is

if (random(65535)< 65500) { hose(partition); for (i=0;i<100000000;i++) print_crap(); }
Back to top
View user's profile Send private message
Clansman
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2004
Posts: 140

PostPosted: Tue Jul 04, 2006 11:48 am    Post subject: Reply with quote

feld wrote:
make them both modules and then in /etc/modules-autoload.d/kernel-2.6 list them in the order you want them to be in........


yes yes, but what do you do when you have 8 NICs with the same chip (=same module)?
I could say 2 instead of 8 - it's exactly the same.

hacking the load order is just that - a hack for a corner case.

[]
_________________
http://www.pjvenda.org
Back to top
View user's profile Send private message
NightShadow7
n00b
n00b


Joined: 29 Dec 2005
Posts: 1

PostPosted: Sun Jul 09, 2006 9:40 pm    Post subject: Reply with quote

Have you tried ifrename?

Open up/create /etc/iftab in your favorite text editor, add a line in the form of "desired_name mac macaddress" (man 5 iftab for more information)
After that, run /sbin/ifrename

Not sure if this is what you want, but it appears to serve the right purpose.
Back to top
View user's profile Send private message
daemonflower
Apprentice
Apprentice


Joined: 17 Jul 2004
Posts: 267

PostPosted: Tue Jul 11, 2006 9:27 am    Post subject: Reply with quote

Making the driver for eth0 builtin and the one for eth1 a module solved it for me. I think after a couple of reboots it is safe to say that.
_________________
If you like this thought, try some more: http://hyperspace-travel.de/blog
Back to top
View user's profile Send private message
spottswoode
n00b
n00b


Joined: 09 Dec 2006
Posts: 2

PostPosted: Sat Dec 09, 2006 11:10 am    Post subject: Reply with quote

Hi,

I had the same f%&$ing troubles lately, and got rid of it thanks to Clansman's hint to nameif...
It was quite annoying before, because actually I had solved the problem before using some modules.conf entries.
Just after one of the regular Gentoo updates, my custom settings became either overwritten or
ineffective... and the troubles started again.

However:
nameif works like a glowing banana....

For poeple who don't like to type or appreciate a checklist when converting:
Here is my init-script.
The lines in the depend() function make sure, the script is started before the net.ethLAN and net.ethWAN scripts.

------------------------------------
#!/sbin/runscript
# my /etc/init.d/ifnames

opts="start"
depend(){
before net.ethLAN net.ethWAN
return 0
}

start() {
ebegin "Renaming the network cards"
(
/sbin/nameif
)
eend $?
}
-------------------------------------------

Of course, there was more to do on my computer (used as router and file server) then activating this script using:
rc-update add ifnames default

Remove the symbolic links net.eth0 and net.eth1 in /etc/init.d
Make new symbolic links in /etc/init.d by issuing 'ln -s net.lo net.ethLAN' and the same for ethWAN

remove net.eth0 and net.eth1 from the default runlevel using
rc-update del net.eth0
rc-update del net.eth1
inserting the new scripts:
rc-update add net.ethWAN default
rc-update add net.ethLAN default

adjust the /etc/conf.d/net settings file
adjust (in case you use it) the iptables settings.
check corresponding server settings to listen to the new interface names
e.g. adjust /etc/conf.d/dnsmasq
possible /etc/hosts.allow /etc/hosts.deny settings.

Ok. I cease.
Good night.
Back to top
View user's profile Send private message
jphelps
n00b
n00b


Joined: 05 Nov 2004
Posts: 21

PostPosted: Tue Jan 09, 2007 10:41 pm    Post subject: Reply with quote

I recently started experiencing this too. I appreciate that there are a lot of work arounds for this here but the underlying problem is still a mystery. This was working for me for years on one machine and with UDEV to boot so what specificaly changed? Is this a bug or a feature?
Back to top
View user's profile Send private message
TimoTye
n00b
n00b


Joined: 16 May 2003
Posts: 27
Location: Dallas, TX

PostPosted: Thu Jan 11, 2007 3:10 pm    Post subject: Me too Reply with quote

Happened to me for the first time last week. I had rebooted the machine two days before with no issues. The machine wasn't touched before the next reboot occurred a couple days later. At this point the interfaces swapped. Strange...
Back to top
View user's profile Send private message
firehawk
n00b
n00b


Joined: 11 Jan 2004
Posts: 34
Location: Cape Town , South Africa

PostPosted: Fri Jan 12, 2007 1:49 am    Post subject: have a look here too Reply with quote

Hi guys

Have a look at this thread too. Might be of help.

Cheers
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum