1) unload ndiswrapper (let's first see if this works without it); with root privileges,
If the native module is not loaded, load it now.
2) see if the card works, assuming it's 'wlan0' (change if needed); with root privileges,
This either tells you that interface doesn't support scanning (means: driver doesn't work, you probably do need ndiswrapper) or that there are no networks available (exactly what it says) or lists some Cells (networks it detected) along with some information.
3_1) If it did find networks (at least the one in your house), you can use
Code:
iwconfig wlan0 <options>
to configure the device.
3_2) If it told you that interface doesn't support scanning (and you were sure that the native driver was loaded, as it probably was -- modprobe it if it wasn't and retry), chances are you do need ndiswrapper. In this case load ndiswrapper and unload (blacklist for easiness) the native driver;
two drivers loaded at the same time may/will interfere with each other and cause a connection failure. So, with root privileges,
Code:
rmmod <native driver name here>
modprobe ndiswrapper
Make sure that the wireless radio is powered on (a light lit up somewhere?) if you have a switch for it, and now re-try with 'iwlist wlan0 scan' - when the
driver works, this should give something else than 'interface doesn't support scanning', despite your configuration. If you still get 'doesn't support...' message, you need to work with the driver.
4) Once driver works (scanning works ok), use ifconfig to connect to a network with no password or with WEP encryption. For networks with WPA encryption (AES/TKIP/...), you need to use wpa_supplicant. It's just as simple as using ndiswrapper, though it's said to be "difficult". Here's how it basically works (with root privileges):
Code:
wpa_passphrase ssid-of-the-network passphrase-of-the-network >> /etc/wpa_supplicant.conf
That creates an encrypted key information for your network, and '>>' forwards it to the configuration file (two '>'s because the file might already have something inside, that we don't want to lose). Now, with root privileges, open the /etc/wpa_supplicant.conf with a text editor. You should not need to edit the file if you're using a native driver (hopefully not, that is), but with ndiswrapper you usually have to make (at least) one change: ap_scan from 1 to 2. So if you are using ndiswrapper, change this line:
to this:
If I remember correctly, this causes the access point scanning/something to be done by ndiswrapper driver, not wpa_supplicant's. Something like that anyway. The ctrl_interface line should be
Code:
ctrl_interface=/var/run/wpa_supplicant
as far as I can tell, but the other options shouldn't matter. You can try the wpa connection right after changing (or even before) the ap_scan line, and if it doesn't work, change the configuration and re-try until it works. For me the only change I had to do to the file was changing ap_scan and that was because I used ndiswrapper and not the native driver for my card (which didn't work without the windows driver anyway).
If you wonder, here's how the wpa_passphrase-generated part of the configuration file,
network=, looks like (if I'm right, again, this is all you need and you might not need all this either:
Code:
network={
scan_ssid=0
ssid="networkssid"
proto=WPA
key_mgmt=WPA-PSK
#psk="passphrasewithoutencryption" (you may delete this line; it's commented anyway)
psk=encryptedpassphrasewhichisalonglineofnumbersandcharacters
}
So play around with ap_scan and the options in the network section if you like; I'd start off with ap_scan=2 and unedited network-section.
5) You start wpa_supplicant like this, with root privileges:
Code:
/usr/sbin/wpa_supplicant -i wlan0 -D wext -c /etc/wpa_supplicant.conf -B
dhcpcd wlan0
That says: run wpa_supplicant, use interface wlan0, use driver 'wext' (note: this is the default and is used even with ndiswrapper!), use configuration file /etc/wpa_supplicant.conf, and (-B) daemonize in the end. Second line tells to try and fetch your ip information via DHCP;
use dhcpcd or dhclient depending on which one you have installed in your distribution - ubuntu used dhclient, slackware dhcpcd, and others what they've chosen.
6) If and when you need to quit wpa_supplicant = kill the connection, you do it like this (with root privileges):
Code:
killall -q wpa_supplicant
killall -q dhcpcd
So, in short:
- find out what driver to use, load it and unload/blacklist other drivers present
- try 'iwlist' to see if the
driver works
- use 'iwconfig' to configure a non-secure or WEP connection
- use wpa_supplicant to configure (only once needed) a WPA-encrypted connection, just like step 4 explains
- start wpa connection like step 5 explains (you can do a script of this!)
- stop wpa connection like step 6 explains
Note that wpa_supplicant can handle other connections than WPA too: even wired ones. So you can use that for all your connections if I'm right..refer to the man-pages for information on how you do that. Nothing difficult there.
wpa_supplicant
configuration is a one-time job and the most difficult at the time on Linux wireless configurations. Still it's easy as what when you get how it goes: one command to generate the key, then maybe visit the config file to modify it where needed, and that's it. 'iwlist' is handy for detecting if your driver works or not (so until it works you have to work with your driver loadings, and that only), and once it's working, you only have to work with your wpa_supplicant configuration (or 'iwconfig' if you use badly secured networks).
Hope it helps at all. Feel free to ask more, here or by IM.
EDIT:
module blacklisting means adding a 'blacklist <modulename>' line to your modprobe configuration file or blacklist file, and essentially it tells your system not to load the given kernel module during boot time. It's needed if there's a native driver that doesn't work and you want to use ndiswrapper. Easy distribution-specific (or general) instructions are on the web to locate the configuration file where you write the line. Another thing is that after installing the driver, with ndiswrapper for example, it is possible that you need to
reboot the machine once to make it work all right. I had to, that is.