LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-24-2005, 12:31 PM   #1
liutabme
LQ Newbie
 
Registered: Oct 2005
Posts: 26

Rep: Reputation: 15
Want to statically allocate an ethn interface


I configure my wireless card in /etc/rc.d/rc.inet1.conf on a specific interface, currently eth1, but the interface number (eth0, eth1) changes at every boot, sometimes assigning eth0 to the wireless card, sometimes to the ethernet card, so the wireless doesn't work (ping returns Destination Host Unreachable). But it works once I reconfigure the ethernet name.
I believe these interfaces are assigned on the basis of the order in which the kernel loads the drivers. So I have tried to discover ways to control that order. I have discovered that if a driver
is NOT loaded as a module, then one can use the 'ether' and 'reserve' command' in lilo-conf to
to control the allocation of the interface name.
However, both my ethernet and wireless drivers are loaded as modules - the ethernet driver is handled automatically, whereas I do an explicit modprobe in rc.modules for the wireless driver (IPW2200). It would be nice to leave them as modules and find another way to control the allocation of ethn interface names.
I am using Slackware 2.6.13.2.

Thanks for any suggestions.
 
Old 10-24-2005, 01:17 PM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
Make sure one module loads before the other, everytime..

I have compiled my built in NIC into the kernel so it's up first, then the hotplugging takes care of the rest.

There must be a place to auto load modules at boot in Slack, or you can cobble up a script in rc.d to do it.
modprobe 8139too
sleep 3
modprobe via-rhine
sleep 3
modprobe wlan0
 
Old 10-24-2005, 02:14 PM   #3
liutabme
LQ Newbie
 
Registered: Oct 2005
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks for your reply, but as I said above I don't call modprobe for the ethernet card, since the driver was already installed, it is handled automatically. I only call modprobe explicitly for the ipw2200 driver (which I had to download) - so I cannot 'order' them in rc.modules.
 
Old 10-24-2005, 04:13 PM   #4
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
Your system has a boot order..
I am suggesting you get the ethernet card module loaded before it is "automatically" loaded. This should place it first and make sure it's eth0.

Now having said that, I haven't used Slack so I can't recommend where to do this.
Would you like to ask in the Slack Forum?
Or should I move this thread there for you?
 
Old 10-25-2005, 03:09 AM   #5
liutabme
LQ Newbie
 
Registered: Oct 2005
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks again for your reply.

I didn't know that I could preempt the 'automatic' module loading done elsewhere.

Yes please could you transfer this thread to the Slack Forum.
 
Old 10-25-2005, 06:40 AM   #6
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Several options for you in Slackware -
  • Create a file named /etc/rc.d/rc.netdevice and make in executable: chmod +x /etc/rc.d/rc.netdevice . Add this line to that file:
    Code:
    /sbin/modprobe your_network_interface
    where you of course enter the driver for your own wired interface, like e100, or 8139too.
    Slackware will load that module before all others, and this interface will become eth0.
  • Add this line to [B]/etc/modprobe.conf[/B or /etc/modules.conf:
    Code:
    alias eth0 your_network_interface
    This will also have the effect that you connect eth0 to your interface.
 
Old 10-25-2005, 01:48 PM   #7
liutabme
LQ Newbie
 
Registered: Oct 2005
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks for that. The first option worked, however, I'd already tried the second option, which doesn't work for me.

So that I can understand better, I wonder if you or someone might answer the following:

1. Since the ethn interfaces allocated to the ethernet and wireless devices change every time I reboot, I assume the order in which the modules are loaded changes. Is this because the modules are loaded in different threads so timing of the loading can vary?
2.Where then is the 'automatic' loading of modules like my ethernet module done - it's not in rc.modules.

Thanks again.
 
Old 10-25-2005, 01:51 PM   #8
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
It's done by the hotplug system, which runs with /etc/rc.d/rc.hotplug file.
Another way to solve the "problem" of the net cards being swapped is by blacklisting the modules on /etc/hotplug/blacklist so they won't be automatically loaded, and modprobe them in rc.modules with the order you want.
 
Old 10-26-2005, 03:52 AM   #9
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally posted by liutabme
1. Since the ethn interfaces allocated to the ethernet and wireless devices change every time I reboot, I assume the order in which the modules are loaded changes. Is this because the modules are loaded in different threads so timing of the loading can vary?
2.Where then is the 'automatic' loading of modules like my ethernet module done - it's not in rc.modules.
Indeed, the hotplug system loads any modules for the hardware it detects, that are not already loaded by Slackware's init scripts.

Before hotplug runs, the rc.modules script is executed which loads several modules, and executes the /etc/rc.d/rc.netdevice script that I hinted about in an earlier post.
Also before running the hotplug script, Slackware will run the script /etc/rc.d/rc.inet1. This script will configure any network interface that is already present - either because you loaded it's module in rc.modules or rc.netdevice or because you defined an alias for it in /etc/modules.conf (/etc/modprobe.conf for 2.6 kernels).
The hotplug system will run last and configure all remaining interfaces that it detects and for which you provided configuration information in rc.inet1.conf and/or rc.wireless.conf .

So, you do have control over what device gets what interface name, because you can control the order in which the modules for the various network devices get loaded.
Of course, all of this has no effect at all if your network devices are compiled into the Linux kernel instead of being compiled as modules...

Eric
 
Old 10-26-2005, 07:34 AM   #10
liutabme
LQ Newbie
 
Registered: Oct 2005
Posts: 26

Original Poster
Rep: Reputation: 15
Thank you for your very complete reply - that has clarified much.
Yes I realise I do have control over the order, and hence which interface is allocated.

There remains the issue, however, that before I made the above changes, on successive reboots, when nothing had been changed in the configuration to change the order of loading, different ethn interfaces were allocated. So what was responsible then?

Maybe I've missed the point of what has been said. Sorry if I have. But it seems to me that if different ethn interfaces are allocated without any configuration changing, and if the allocation depends on the order of loading (or something else) , then there has to be something affecting that order (like threads for example).

Thanks for any further clarification.
 
Old 10-26-2005, 08:54 AM   #11
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
I would think that the only reasons why your interfaces don't have the same name at all times, are:
  • Your wireless card is PCMCIA and it is not always inserted while booting
  • More than one process is detecting and configuring network interfaces. This should never happen in a default Slackware box. It can happen if you reverse the order of starting rc.hotplug and rc.inet1 in rc.M - or if perhaps you put an ampersand & after the call to any of those scripts in rc.M. Or perhaps you added stuff in rc.local that interferes?

Eric
 
Old 10-26-2005, 01:50 PM   #12
liutabme
LQ Newbie
 
Registered: Oct 2005
Posts: 26

Original Poster
Rep: Reputation: 15
I don't think these possibilities can account for it - I've not touched rc.M, and my wireless card is internal to the laptop (mini PCI). As for rc.local I've only added a line to select the 'ondemand' frequency scaling governor.

Bit of a mystery it seems.

Thanks Eric for all your help
 
Old 10-27-2005, 08:45 AM   #13
PDock
Member
 
Registered: Aug 2004
Distribution: Slack10 & curr. tried numerous
Posts: 189

Rep: Reputation: 37
The backgrounding '&' of a process is not the sole cause of timing issues. sleep 3 is found in a number of rc.xxx scripts and on my laptop is a must for the pcmcia card to be found and then properly configured. To test, try reverting your scripts to the way they were, change rc.hotplug section as shown,

Code:
    start|restart|status)
	sleep 3 #added this
            for RC in /etc/hotplug/*.rc
	do
	    $RC $1
	done
	touch /var/lock/subsys/hotplug
	sleep 3 #added this
            ;;
then see if the eth# continues vary on reboot.

ppd

ps as hotplug can take awhile to start with; the extra sleep statements will make booting that much worse so un-revert above changes.
 
Old 10-28-2005, 02:18 AM   #14
liutabme
LQ Newbie
 
Registered: Oct 2005
Posts: 26

Original Poster
Rep: Reputation: 15
I think that accounts for it - did what you suggested, then rebooted several times and ethn didn't vary on reboot.

Thanks ppd - mystery solved.
 
Old 11-23-2005, 12:41 AM   #15
anuragsha
LQ Newbie
 
Registered: Nov 2005
Location: INDIA
Distribution: Fedora Core 4
Posts: 9

Rep: Reputation: 0
yes, thats useful.
 
  


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
Creating binary RPMS statically! Sunilsbjoshi Linux - Software 2 10-12-2005 12:10 AM
g++ statically link stdc++ problem berty Programming 1 05-16-2005 06:00 PM
Problems statically linking with libsdl jakobf Programming 3 08-27-2004 12:20 AM
What is a statically compiled binary? james_cwy Linux - Newbie 4 11-09-2003 10:51 PM
Can't compile MPlayer statically. Nezzo Linux - Software 3 11-04-2003 06:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:43 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