Microsoft

Configure wireless support in Mandriva Linux with ndiswrapper

If there is one area in Linux that still persists in falling under the category of "black magic," it's wireless networking. Due to the differences in wireless network cards, rebranding, slightly changed specs, security differences between WEP, WPA, WPA2, and so forth, it can be very difficult to get wireless networking set up quickly and can often be an exercise in frustration. Are there available Linux drivers? Windows drivers wrapped in a Linux driver? 32-bit or 64-bit drivers? The combinations in configuration can be daunting.

Set up wireless via the Mandriva Control Center

Many distributions provide their own tools to configure wireless networking, and all work with varying degrees of success. The tool provided in Mandriva Linux 2007.1 Spring is the same as previous versions but with added support for more devices. The tool, drakconnect, works very well and supports the configuration of most wireless network cards thrown at it.

If you have installed Mandriva Linux 2007.1 and did not set up wireless during the install, it can easily be done by taking a trip to the Mandriva Control Center (MCC).

To get to the MCC, go to the Applications menu (or Start menu) and navigate to System | Configuration | Configure Your Computer. You will need to provide the root user's password to start the program. Once inside the MCC, select the Network & Internet tab and then select the Set Up A New Network Interface option. Choose the Wireless Connection option, then MCC will prompt you for what to configure. This is where things can become interesting.

If there are Linux drivers for your wireless interface, they will be listed here, and you would configure them as usual. With some network interfaces, notably the Broadcom chipsets, you may need to provide the firmware for the card in order to use the native bcm43xx driver.

Using ndiswrapper in Mandriva

While using a native driver may be preferable, it can also be more complicated. I've found that using ndiswrapper, which is a kernel module that wraps around a Windows driver, is much simpler.

At this stage, MCC will give you the option of using ndiswrapper as well. In order to proceed, MCC will ask for the Windows driver (.INF file). If this is a dual-boot system, simply navigate to where the Windows partition is mounted and search there. For instance, a likely path for a wireless driver may be /mnt/windows/WINDOWS/system32/; of course, this depends on which version of Windows is installed.

The best way to find the driver is to boot into Windows and determine the name of the driver by visiting the Device Manager from the System option in the Windows Control Panel. From there, open the properties of the wireless network device, click the Driver tab, and then view Driver Details. This will give you the name of the Windows driver, although this is not the file you want to use (you will see something like BCMWL6.SYS, and while this file is important, it is not what you need for ndiswrapper; instead, the file to use with ndiswrapper would be BCMWL6.INF).

Once you have this information, reboot back into Linux and execute on the command line:

$ find /mnt/windows -name 'bcm*.inf'

and then point MCC to any results that come up.

Driver tips and configuration

If you do not have Windows currently installed, you will need to obtain the Windows driver online, via the wireless network card manufacturer's Web site or the manufacturer of the computer.

Once you've provided MCC with the network card driver, it will install any required software (such as the ndiswrapper package itself), bring the interface up, and start scanning for any wireless networks in range. At this point, you simply need to select the wireless network and provide any authentication credentials required to connect.

There is one caveat with ndiswrapper, however. If you are using a 64-bit Linux distribution, you will have to provide a 64-bit Windows driver. Likewise, a 32-bit Linux distribution will require a 32-bit Windows driver to work with ndiswrapper. If you cannot find a 64-bit driver, you may have to install the 32-bit version of your Linux distribution if you wish to use the wireless network card.

You can verify the installation via the ndiswrapper command-line tool:

# ndiswrapper -l
Installed drivers:
bcmwl6          driver installed, hardware present

You can also perform the installation of the driver completely via ndiswrapper, which may be useful for distributions that don't have the nice management interface that Mandriva does. For instance, to install the driver and then to write the appropriate module information for modprobe, use:

# ndiswrapper -i /mnt/windows/Program Files/Broadcom/Broadcom 802.11/Driver/bcmwl6.inf
# ndiswrapper -m

This will get ndiswrapper to install the driver. Now all that needs to be done is to configure the wireless interface. However, using a GUI tool for this — such as the MCC, YaST in SUSE, or similar tools in other distributions — is likely preferable to lengthy and cryptic command-line arguments to the various wireless tool programs.

If you wish to remove the Windows driver from the system, use ndiswrapper to remove it:

# ndiswrapper -e bcmwl6

This will remove the bcmwl6 driver.

Some of the command-line tools used to configure the wireless interfaces, while somewhat brutal for the uninitiated, remain good informational tools. For instance, the iwconfig program, when invoked with no arguments, will provide information on any wireless network cards and their present configuration. If you provide a network interface, such as wlan0, it will provide information on just that device:

# iwconfig wlan0
wlan0     IEEE 802.11g  ESSID:"WIRELESS"  Nickname:"tablet.host.com"
          Mode:Managed  Frequency:2.442 GHz  Access Point: 00:1B:62:2A:65:4D  
          Bit Rate=54 Mb/s   Tx-Power:32 dBm  
          RTS thr=2347 B   Fragment thr=2346 B  
          Encryption key:C95F-7C26-5EA7-D34C-BF7E-D623-4BAF-640C   Security mode:open
          Power Management:off
          Link Quality:100/100  Signal level:-29 dBm  Noise level:-256 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Here you can obtain information on which wireless network you're connected to, the type of encryption, the speed, link quality, and so forth.

If finding drivers for the wireless network card in your computer is problematic, look on the ndiswrapper home page (click on Documents/Wiki and then see List Of Cards Known To Work). On this site, you'll also find more documentation and information on using and configuring ndiswrapper.

While some wireless network devices come with Linux drivers, the majority do not. As a result, ndiswrapper is often the only way to get wireless working on many laptops or computers with wireless support. Ndiswrapper is a great tool that has been around for quite a while and does the job admirably; in some cases even better than native drivers.

Related resources on TechRepublic

Delivered each Tuesday, TechRepublic's free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!

About

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

Editor's Picks