Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I never have completely understood how modules work, even though I've been dealing with several, and I think now is the time to learn. I understand that modprobe takes care of actually loading the module, but how is modprobe run at startup? I installed ndiswrapper (to get my wireless card to work), and followed the instructions to add "alias wlan0 ndiswrapper" to my /etc/modules.conf file. However, if I reboot, the module isn't loaded. What does this alias line do, how are modules normally loaded automatically at startup, and what to I have to do to get "modprobe ndiswrapper" done every time (other than adding that line to rc.local which doesn't seem like that right way... or is it?).
Also, after the module is loaded, the following commands need to be typed to get the interface up:
Do I just add these commands to rc.local, or is there a more "official" way to bring up the wireless interface everytime I start up?
EDIT:
*smiles* I always seem to answer my question right after I ask it. I was taking a look around the rc.d folder and found rc.modules. Now my question is... I issued a command that supposedly "wrote the correct modprobe settings to load ndiswrapper automatically," but it didn't put anything in rc.modules, so should that alias be doing it by itself? And I still don't know about the second part of my question (bringing up the interface). Thanks again.
Any ideas on this? I'd still like to know what the alias command does, if I need to still manually add it to rc.modules (even though it said it wrote the settings so it automatically starts), and what needs to be done to execute those ifconfig/iwconfig commands. Thanks!
About your network thing:
Look at /etc/rc.d/init.d
There should be a file called network or net or similar, depends on your distro.
In that file your network is going to be initialised. You may find a line like 'ifconfig eth0' or similar, change that to your iwconfig commands.
If you dont have a network file in init.d try something like that:
Code:
#!/bin/sh
case "$1" in
start)
iwconfig wlan0 mode Managed
iwconfig wlan0 essid ESSID
ifconfig wlan0 up
;;
stop)
ifconfig wlan0 down
;;
esac
You should really use your network file, if you already have one
Hmm... I looked around my rc.d folder and can't find exactly what you described, but I do have a section like what you typed out above in rc.inet1. Here's the section:
Code:
case "$1" in
'start') # "start" brings up all available interfaces:
lo_up
eth_up 0
eth_up 1
eth_up 2
eth_up 3
gateway_up
;;
'stop') # "stop" takes down all existing interfaces:
gateway_down
eth_down 3
eth_down 2
eth_down 1
eth_down 0
lo_down
;;
*) # The default is to bring up all interfaces:
lo_up
eth_up 0
eth_up 1
eth_up 2
eth_up 3
gateway_up
esac
I was a little confused at first but now I see those are calls to functions defined earlier in the script. I'd just stick those ifconfig and iwconfig lines in the appropriate sections, but the functions in that file have a whole bunch of checking things before that command is actually executed, so do I need to make a wlan0 function and figure that all out? The function checks for the modules and then does a whole bunch of things with dhcp (which I do need). I'd think the wireless driver would give me a little more information about what exactly to do here. Finally, I'm still curious about that alias line and the proper procedure for loading that module. Thanks!
Actually looking through rc.inet1, it looks like that is where the various network interfaces are supposed to be brought up. It also looks as if those functions with all the dhcp setup would also be required for wlan0. I'm sure people use wireless cards, how am I supposed to go about doing this? I'm still looking for an answer about the alias line as well, since I need that module before I can do anything else. Thanks again.
Hi jrdioko,
The alias line in the modules.conf tells the kernel that when it needs the wlan0 device, it needs to load the "ndiswrapper" module.
In the slackware distribution you'fl always find the "/etc/rc.d/rc.modules" with a set of modprobes you need to load permanently. This file predates the auto loading of modules. Yes, there was a time the kernel couldn't load modules on the fly.
Normally you could put the "user things" in the "/etc/rc.d/rc.local". But this file is executed in the end of the startup and also all the time you change the run level. So, if you need your wlan device to start up to get an ip address to your machine, the right place to put it is "/etc/rc.d/rc.inet1". May be you can find some scripts in the contrib directory of your distro. If you don't have the cds or the cd doesnŽ t has anything, you can look at www.slackware.com. If you can't find anything, it's time to hands on. You can put your command lines in the rc.inet1.
Hmm... so the rc.modules file isn't used normally for loading modules? I guess I don't know much about them in the first place . So, if I understand you correctly, once I type an iwconfig or ifconfig command the module will be loaded at that time once the kernel sees I'm trying to do something with wlan0? I can probably copy the eth0 functions and substitute wlan0, but I'm still confused as to why the wireless driver didn't come with information about how to set this up or that the information isn't widely available (starting up wireless on bootup can't be that rare ). I guess I'll play with rc.inet1 and see if I can get something to work. I just want to confirm that I understood you correctly about that alias line. Thanks!
Yes, you did it. Wireless is a new thing. I never see any. Just read about it. There are zillions of pcs in the world which never needed wireless things. Soon, we will forget the time when all computers were connected using cables between then.
Heh, ok. One more question... that alias line doesn't seem to be working that way. I manually type "iwconfig wlan0 mode Managed" and I get "Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; No such device." Also, "ifconfig wlan0 up" gives me "wlan0: unknown interface: No such device." They'll only work correctly if I manually modprobe the driver. How can I get that alias to work?
EDIT:
I take that back. Now it won't work even if I do a manual modprobe. I guess my problem isn't with the alias line. This has happened before (it only works part of the time), so I'll look into getting a new wireless card. Thanks all anyway for your help.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.