Installation of ndiswrapper

Table of Contents

Prerequisites
Installation

These are the steps I used to install and configure ndiswrapper on a Dell Inspiron 4000 laptop, (I know, it's old, but it was free) using Mandriva LE2005 (10.2). Other distributions may have some differences.

Prerequisites

Make sure your wireless card is inserted before starting. You can also configure your card with ESSID, mode and encryption beforehand, using the GUI. That is what I did.

You need a recent kernel, at least a 2.6.6 or 2.4.26, with source. Use urpmq to find the kernel-source packages available and urpmi to install the package for your kernel.

    urpmq kernel-source
    urpmi kernel-source<kernel-version>

Make sure there is a link to the kernel source from the module directory. /lib/modules/VERSION/build should be a link to the kernel source, where VERSION is the version of the kernel you are running. If there is no link, you'll get an error at the make install step. To create a link, assuming the kernel sources are present, use the command:

    ln -s /usr/src/linux-<kernel-version> /lib/modules/VERSION/build

If you have a version of ndiswrapper that shipped with your distro, uninstall it and get the latest version from http://sourceforge.net/projects/ndiswrapper. Download the tarball and extract it with:

    tar zxvf ndiswrapper-VERSION.tar.gz.

This will create ndiswrapper-VERSION directory.

Installation

1. Compile and install

You should already have changed to root user. Change into the ndiswrapper directory you just created.

    cd ndiswrapper-VERSION

Run:

    make distclean

then run:

    make

then:

    make install

This should compile and install both the kernel module and userspace utilities.

2. Install your Windows driver

Important: Do NOT use the drivers on the CD for your wireless card. They may work, but you may get kernel crashes or other problems, if the drivers on the CD have not been tested.

Instead, you need to download the appropriate Windows driver for your wireless card from the List at ndiswrapper.sourceforge.net. To identify the driver that you need, first you need to identify the card you have with:

    lspci

Note the first column, such as 00:00.0, for your card. For example, mine has a line:

    06:00.0 Ethernet Controller: RealTekSemiconductor yadda,yadda,yadda

Then look for the line "06:00.0" in the output of:

    lspci -n

Mine has the line:

    06:00.0 Class 0200: 10ec:8180 (rev20)

For my card, RealTek8180 is the chipset. Go to the List, and find your card by brand name, model number, and chipset. read any notes there that may pertain. There should be a link to a download site for the appropriate drivers.

Unpack the Windows driver with unzip/cabextract/unshield tools and find the INF (or inf) file, i.e., the files with .INF (or .inf) extension. Please note: some drivers are installed using the .INF file, some with the .SYS file. If there are no notes about this, try one then the other.

Now use the 'ndiswrapper' tool to install the Windows driver:

    ndiswrapper -i <filename.inf>

This copies all necessary files to /etc/ndiswrapper and creates the config files for your card. After installing, you can run:

    ndiswrapper -l

to see the status of your installed drivers. If you have installed the correct driver, you should see something like:

    Installed ndis drivers

    net8180 driver present, hardware present

Where 'present' means that you have a card that can be used with the driver that you installed. In this case, the net8180 driver is used. If you see 'cannot locate lspci. Unable to see if hardware is present', you need to install the pciutils package.

3. Load Module

To load the module, type:

    modprobe ndiswrapper

If you get no error, the driver should now be loaded. You can verify this by checking the system log produced by dmesg. If the driver successfully loaded, you should see a message somewhere in the system log, probably toward the end. Type:

    dmesg

Somewhere in this log, you should see a message like this:

    ndiswrapper version V loaded

Make sure the version V here matches the version of ndiswrapper package you downloaded and installed. If lyou get a different version, you probably have an old version, which you should uninstall and go back to step 1.

If you successfully installed Windows drivers earlier with ndiswrapper -i file.inf, the ndiswrapper will load them all. You should see the following messages in the system log:

    ndiswrapper: driver driver1 added

for each of the drivers. If you don't see these messages, and you need all the other drivers, it usually means that there are no usable drivers installed in /etc/ndiswrapper directory. Check if the /etc/ndiswrapper directory has one sub-directory for each driver and if in each driver's directory there are .inf, .sys, and conf files. Otherwise, you may need to repeat step 2.

If this does not bring up the lights on the card, try ejecting it and re-inserting it.

If the system had a card that works with one of the loaded drivers, you should see the following message in the system log:

    wlan0: ndiswrapper ethernet device xx:xx:xx:xx:xx:xx

4. Configure interface

Use iwconfig to configure your wireless network interface. This tool most likely shipped with your distribution. If not, you should install the Wireless Tools package. First, see if the interface is available with:

    iwconfig

This will print the wireless interface, e.g. wlan0. In the examples below, I use wlan0. If your interface is wlan1, use that in its place. The wireless configuration to be used should match what your Access Point AP uses. First, find out if you can see your AP with:

    iwlist wlan0 scan

If this lists your AP, you can continue. Issue the command:

    iwconfig wlan0

Check that the ESSID is correct. If not, your card is not associated with the AP. Try to reset it using the GUI, or:

    iwconfig wlan0 essid ESSID

where ESSID is the network name used by your AP.

Now use network tools to bring up the interface:

    ifconfig wlan0 up

or:

    dhclient wlan0

or:

    dhcpcd wlan0

This command will vary from distribution to distribution.

Remember, if you have a firewall, to let it know that wlan0 is an external interface and allow it to pass traffic, otherwise you won't even be able to ping your AP.

5. Automate

Once everything works fine, you can write the correct modprobe settings to load ndiswrapper automatically when wlan0 is used by running:

    ndiswrapper -m

Note that this doesn't automatically load the ndiswrapper module at boot time. To do this, you have to configure your module setup, which depends on the distribution. Most distributions load all modules listed in /etc/modules at boot time. Mandriva 10.x uses /etc/modprobe.preload. Add this line to this file (I added the line to both files):

    ndiswrapper

Now on reboot, with your card inserted, ndiswrapper should load, you should see all lights on your card, and you should have connectivity.




much of the information on this page was learned from the installation wiki at ndiswrapper.sourceforge.net