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.
Distribution Notes
Ubuntu: Instead of running commands as root, use
sudo before each command (e.g.
sudo modprobe ndiswrapper)
Caution
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.
Native Drivers
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.
Getting Ndiswrapper
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):
Code:
apt-get install ndiswrapper-common ndiswrapper-utils-1.9
Ubuntu users:
Code:
sudo apt-get install ndiswrapper-common ndiswrapper-utils-1.9
Fedora Core users (As root):
Code:
yum install kmod-ndiswrapper
Suse users (As root):
Code:
yast2 -i ndiswrapper
Offline Install
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):
RPM Search
(Search for ndiswrapper for your distribution)
Debian based distributions (Debian, Ubuntu):
Debian -- Packages Ubuntu packages
(Search for ndiswrapper-common and ndiswrapper-utils-1.9
From Source
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:
Code:
cd /path/to/directory
Now take everything out of the archive:
Code:
tar -zxvf ndiswrapper-1.44.tar.gz
Now run the following commands as root and Ndiswrapper should be installed.
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.
Which one?
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.
Lets Go!
First of all, find the drivers, either on a CD or someone on your hard drive, then run this command as root.
Code:
ndiswrapper -i /path/to/driver.inf
Note that if the driver fails to install you need to remove the broken files; use the following command to list drivers installed:
And use this command to remove the driver (as root):
Code:
ndiswrapper -e driver_name
If all that's worked, run 'ndiswrapper -l' and you should see something like this:
Code:
graham@lightside:~$ ndiswrapper -l
bcmwl5 : driver installed
device (14E4:4320) present (alternate driver: bcm43xx) 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.
Loading the Module
Now, we're almost sorted. We need to load the module, to do this run the following (As root):
modprobe ndiswrapper
If you don't see anything errors, then it worked! Your card should be active.
Device name
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.
Code:
graham@lightside:~$ iwconfig
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
Power Management:off
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 Obviously yours won't yet have an ESSID and key and such.
Connecting
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):
Code:
iwconfig <device name> essid <essid of ap>
iwconfig <device name> key s:”<key>”
So something like:
Code:
iwconfig eth0 essid 13cliff
iwconfig eth0 key s:“myaccesspoint”
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):
Code:
dhclient <device name>
dhcpcd <device name>
And that should be it. Enjoy your new connection!
Problems Alternative Driver
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):
Code:
nano /etc/modprobe.d/blacklist
Add this to the bottom of the file:
Code:
# driver blacklisted and replaced by ndiswrapper
blacklist <drivername>
E.G.:
Once that's done, save the file and run the following command to unload the module (As root).
Code:
modprobe -r <drivername>
E.G.:
Code:
modprobe -r bcm43xx
And load Ndiswrapper again (As root):
Code:
modprobe ndiswrapper
Problem not here?
E-mail me at graham.a (~at~) 13cliff.co.uk and I'll respond.