Wireless LAN in Linux
Wireless LAN in Linux
Wireless support in Linux can be pretty shrewd to say the least. Most wireless vendors base their cards on cheap chip sets that have no support for Linux. This can lead to a lot of hassle. However there is a solution.
Ndiswrapper is a utility for Linux that allows you to use Windows wireless drivers on your Linux system. I've used it several times on different computers and had it working perfectly.
Ubuntu: Instead of running commands as root, use sudo before each command (e.g. sudo modprobe ndiswrapper)
This tutorial was written using Kubuntu Feisty (7.04) I do not guarantee that it will work. Some things in this tutorial may be specific to Kubuntu. If you find yourself unable to do something in this tutorial e-mail me and I shall try and fix it.
Before trying Ndiswrapper, it's recommended you have a browse around Google to find native drivers for your card since these will probably work better than Ndiswrapper. If you don't know your device chipset run lspci or lsusb (Depending on what type it is) and it should tell you. If you've come up empty handed or the native driver is a bit iffy, continue.
First of all we need to get Ndiswrapper, we can either compile from source or get a distribution specific package. I recommend finding a distribution specific package rather than compiling from source as it's more likely to work.
From The Internet
If you have internet access through another device run these commands in console.
Debian users (As root):
apt-get install ndiswrapper-common ndiswrapper-utils-1.9
Fedora Core users (As root):
sudo apt-get install ndiswrapper-common ndiswrapper-utils-1.9
Suse users (As root):
yum install kmod-ndiswrapper
yast2 -i ndiswrapper
If you don't have internet access (or if you don't know how to get packages from the repository) you'll need to get packages from somewhere else and transfer them onto your Linux box. Here are a few places you can get packages from:
RPM based distributions (Suse, Fedora Core, Mandrivia):
(Search for ndiswrapper for your distribution)
Debian based distributions (Debian, Ubuntu):
Debian -- Packages
(Search for ndiswrapper-common and ndiswrapper-utils-1.9
If you can't be arsed with all that, you may like to compile from source, a source tarball can be found at the Ndiswrapper Website. It's recommended you use a stable release, not a testing release.
Move to the directory where the tarball is located:
Now take everything out of the archive:
Now run the following commands as root and Ndiswrapper should be installed.
tar -zxvf ndiswrapper-1.44.tar.gz
You're likely to encounter problems here if you don't have GCC installed and all the necessary compile files (Kernel source/headers).
Wrapping The Drivers
If you completed the last section successfully then you should be able to run 'ndiswrapper' in console and get some output without errors. That being the case, lets move on.
Just a brief explanation, the driver for the wireless card will be a .inf file; sometimes there are additional files the .inf file needs to install such as .sys files. Keep these files with the .inf file otherwise you won't be able to use it.
First of all, find the drivers, either on a CD or someone on your hard drive, then run this command as root.
Note that if the driver fails to install you need to remove the broken files; use the following command to list drivers installed:
ndiswrapper -i /path/to/driver.inf
And use this command to remove the driver (as root):
If all that's worked, run 'ndiswrapper -l' and you should see something like this:
ndiswrapper -e driver_name
If you don't see 'device (code) present' then the .inf file doesn't support the card. Also if you see 'alternate driver' you'll need to disable it (assuming it didn't work) read the 'Problems' section at the end for help.
graham@lightside:~$ ndiswrapper -l
bcmwl5 : driver installed
device (14E4:4320) present (alternate driver: bcm43xx)
Loading the Module
Now, we're almost sorted. We need to load the module, to do this run the following (As root):
If you don't see anything errors, then it worked! Your card should be active.
This is important, after this run dmesg to find the device name of the card (Default wlan0) without that you won't be able to setup the card. Also you can use iwconfig (described below) to list wireless devices, like so.
Obviously yours won't yet have an ESSID and key and such.
lo no wireless extensions.
eth0 IEEE 802.11b ESSID:"13cliff"
Mode:Managed Frequency:2.462 GHz Access Point: 00:0D:54:9C:D9:CC
Bit Rate=11 Mb/s Tx-Power:14 dBm
RTS thr=2347 B Fragment thr=2346 B
Link Quality:78/100 Signal level:-46 dBm Noise level:-96 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
Assuming the driver works (Check for lights) then all we need to do is connect to the access point. You can use GUI tools like KNetworkManager to set-up the connection, this is recommended if you're likely to connect to more than one access point. However I'm going to show you IWconfig, IWconfig is part of Wireless Tools for Linux and will let us connect to the access point by running these commands (As root):
So something like:
iwconfig <device name> essid <essid of ap>
iwconfig <device name> key s:”<key>”
Finally, we start DHCP. There are several ways of starting DHCP with different commands, try all of these until you get one that works (As root):
iwconfig eth0 essid 13cliff
iwconfig eth0 key s:“myaccesspoint”
And that should be it. Enjoy your new connection!
dhclient <device name>
dhcpcd <device name>
If you have an alternative driver for the card (that isn't functioning) you need to blacklist it. To do that, open a text editor and edit '/etc/modprobe.d/blacklist' with any non-formatting text editor (kwrite, gedit, nano) (As root):
Add this to the bottom of the file:
# driver blacklisted and replaced by ndiswrapper
Once that's done, save the file and run the following command to unload the module (As root).
modprobe -r <drivername>
And load Ndiswrapper again (As root):
modprobe -r bcm43xx
Problem not here?
E-mail me at graham.a (~at~) 13cliff.co.uk and I'll respond.