NDIS Wrapper

From LQWiki
Jump to navigation Jump to search

NdisWrapper is an open source product to get Network cards with only Microsoft drivers to work with Linux. (NDIS stands for Microsoft's Network Drive Interface Specification).

Ndiswrapper has a few shortcomings, and you should use a native driver if you can. It is still a work in progress and doesn't allow some common wireless network functionality (e.g. for the majority of cards it will not give an accurate, or sane, measurement of the signal strength, various wireless sniffer tools will not function with ndiswrapper, no monitor or master mode).

If you have a wireless network card that does not have a native Linux driver, then there is a good chance that you can get it to work by using ndiswrapper. Most distributions don't include ndiswrapper by default, and those that do, like Mandrake, bundle older versions.

Using ndiswrapper

These are generic/non-distribution-specific instructions. Visit the ndiswrapper installation wiki for up to date and distibution specific help. You would be advised to print the page out where possible unless you have ready access to the internet whilst installing ndiswrapper.

Check if you have it already

First check if you already have ndiswrapper. If you have an old version, then upgrading to a newer one is up to you. To check if you have ndiswrapper installed, try the following:

 # find /lib/modules/$(uname -r) -name "*ndiswrapper*"

You should see something like the following which indicates that ndiswrapper is a loadable kernel module:

 # /lib/modules/2.6.3-7mdk/misc/ndiswrapper.ko

Also check for the ndiswrapper program:

 # ndiswrapper

You should see some usage info, and not something like "command not found".

If ndiswrapper appears to be installed fine, then your next step is to install the appropriate Windows driver for your card. If not then you will need to download and install ndiswrapper.

Downloading & Installing ndiswrapper

First make sure you have the appropriate kernel sources installed. If you don't, ndiswrapper will ask where it is (it will say specify KSRC). Make sure the sources match the kernel you're running. Download the latest ndiswrapper .tar.gz from sourceforge. For example, say you downloaded ndiswrapper-1.1.tar.gz . As root run:

 # tar -xzf ndiswrapper-1.1.tar.gz
 # cd ndiswrapper-1.1
 # make
 # make install

If you didn't get any errors ndiswrapper should now be installed properly. Time to add Windows drivers.

Alternate Method for Installing ndiswrapper and Kernel Driver

The ndiswrapper source contains Makefile targets for producing RPM and DEB packages. This makes it convenient to produce an ndiswrapper or kernel-module-ndiswrapper package and to install it as you would any packaged program. If you perform an online security update of the kernel, for example, you will need to produce a new ndiswrapper.ko module. To produce the rpm packages, you can do so as root very simply:

 # cp ndiswrapper-1.1.tar.gz /usr/src/redhat/SOURCES/
 # cd /usr/src/redhat/SOURCES/
 # rpmbuild -tb ndiswrapper-1.1.tar.gz

The RPMs will be located under /usr/src/redhat/RPMS/<arch>/, where <arch> might be i586 or x86_64. When installing ndiswrapper for the first time you can instead use the -ti option:

 # rpmbuild -ti ndiswrapper-1.1.tar.gz

This will install ndiswrapper and the kernel module from source.

Installing Windows Drivers

Use this [1] to look up the right driver. The drivers that came with the card on a cd do not always work and may cause crashes. The cabextract tool will help to decompress some drivers. Once you have all the driver files ready, look for the right .inf file (bcmwl5a.inf for example). Then use the ndiswrapper command to install it:

 # ndiswrapper -i bcmwl5a.inf

And check the status:

 # ndiswrapper -l

When you insert the card and run the above command you should see:

 Installed ndis drivers:
 bcmwl5a driver present, hardware present

And now you load the module.

Loading the ndiswrapper module

To load simply run:

 # modprobe ndiswrapper

If there are no errors, some cards will light up and a new wlanN (most likely wlan0) interface should appear when you run iwconfig. You can then configure it like you would any other driver.

Common Problems encountered

1. Kernel-source files are not installed. These can be installed from your cd using an install manager such as rpmdrake (use the the search term "kernel-source") for rpm-based distributions such as mandrake and suse.

2. Non-compliant driver being used. Check the ndiswrapper card list to make sure you are using a driver that has been tested and works with ndiswrapper. This will not necessarily be the latest version from your manufacturers site.

External links