...making Linux just a little more fun!

Wireless Configuration for Desktops

By Muthaiah Ramanathan

"Anyone who has never made a mistake has never tried anything new."
 -- Albert Einstein 

Introduction

Let me start with pointers to the two most valuable (in my personal view) resources that I constantly referred to prior to deciding which PCI wireless card would be the best fit for my home system running Fedora Core 5.

URL A: Madwifi Compatible Cards from Netgear
URL B: Comprehensive List of cards from all vendors

Buying a USB-based wireless card, however, was not on my list; after much deliberation, I decided to buy NETGEAR's WG311 card. In hindsight, I do agree that I should have been careful to check (at the above URLs) whether this model/product from NETGEAR had the necessary drivers for the GNU/Linux space. Since it didn't, I ended up having to make it work by using "ndiswrapper".

What is ndiswrapper?

From the project page, http://ndiswrapper.sourceforge.net:

"Many vendors do not release specifications of the hardware or provide a Linux driver for their wireless network cards. This project implements Windows kernel API and NDIS API within Linux. A Windows driver for wireless network card is then linked to this implementation so that the driver runs natively, as though it is in Windows, without binary emulation."

Why did I buy PCI wireless card? Why not USB?

Nothing against USB wireless cards... but I needed to hook my desktop system to the broadband. Given the physical distance separating the desktop and the broadband tap provided by the local ISP, I did not want to spoil the beauty of our home with internal wiring exposed all over the place. Who would want to do that?

Mad about wifi

What is madwifi? And why madwifi?

From the project page of madwifi, http://www.madwifi.org:

madwifi.org is [...] a team of volunteer developers working on Linux Kernel drivers for Wireless LAN devices with Atheros chipsets. We currently provide two drivers, MadWifi and ath5k.

Well, that's direct - and I should have realized that madwifi drivers support Atheros chipsets but not the chipsets (from Marvell) that come with NETGEAR's WG311 PCI wireless card. It did occur to me - as soon as I started having trouble while configuring the wireless card.

As soon as I got the PCI wireless card, I started with configuration tasks after ensuring it was physically installed in the PCI slot.

Starting from http://madwifi.org, I downloaded the sources of 0.9.4 (latest version as of this article) and followed the steps available at the Madwifi Newbie Doc. The first part was typical of installing software from sources:

[root@thinnai /tmp/madwifi]# ./configure && make && make install  
[root@thinnai /tmp/madwifi]# modprobe ath_pci 

Then, I proceeded to create the interface - and this is where things started turning ugly (to be correct, where there was careless blunder on my part).

[root@thinnai ~]# wlanconfig ath0 create wlandev wifi0 wlanmode sta
wlanconfig: ioctl: No such device

At this point, I referred back to the URLs mentioned at the beginning of this article. Both had clearly indicated that the PCI wireless card, WG311 from NETGEAR, is supported by "ndiswrapper" - but not "madwifi".

I knew of only one remaining way of configuring my PCI wireless card - i.e., by using ndiswrapper. After reading through the basic documentation available at the ndiswrapper wiki, I understood that this is done as a two-step process:

First, install ndiswrapper from its sources. Then, download and install the appropriate Windows driver.

How did I decide which Windows driver to download? Simple - I identified the revision of the chipset available on the PCI wireless card, then just followed these steps listed below:

NOTE: Prior to configuring and installing the PCI wireless card in GNU/Linux, I had installed the drivers in Win2k and found them to be working perfectly.

Here is the Wiki page detailing the steps for installing ndiswrapper from sources, including the Windows driver amongst other things.

In these installation steps, it is mentioned that one should try the WinXP driver in preference to the Win2k drivers; under another section ("Install Windows driver"), it is also mentioned that if the Windows driver provided by the vendor worked, that specific driver files can be re-used. These statements had driven me to download the Windows driver from the URL given earlier rather than re-use the driver files from the existing Windows installation.

[root@thinnai:~]#/sbin/lspci|grep -i wireless
01:07.0 Ethernet controller: Marvell Technology Group Ltd. 88w8335 [Libertas] 802.11b/g Wireless (rev 03)
[root@thinnai ~]# lspci -n|grep 01:07
01:07.0 0200: 11ab:1faa (rev 03)

On the right path

Installing ndiswrapper

From the ndiswrapper project Wiki, I downloaded the tarball of the latest release. As it had been my regular practice, prior to installation, I read through the documentation carefully (at least the initial sections of the INSTALL file.) In this case, the initial steps to compile the sources and install the binaries were quite straightforward.

With current working dir as /root/ndiswrapper-1.20, I executed the following commands:

[root@thinnai ndiswrapper-1.20]# make && make install 
[...]
*** WARNING:  Kernel is compiled with 4K stack size option (CONFIG_4KSTACKS); many Windows drivers will not 
work with this option enabled. Disable CONFIG_4KSTACKS option, recompile and install kernel 
[...]

If you happen to see warnings at the end of "make" similar to the above, you can safely ignore them. This warning has not affected the functionality of the wireless card, at least for the PCI wireless card with the chipset revision shown above.

As discussed previously, I downloaded the Windows driver and religiously followed the instructions in the "Install Windows driver" section of the INSTALL file. After extracting the Windows driver to another directory, I went through the following steps:

[root@thinnai ndiswrapper-1.20]# ls ../ENLWI-G_Driver_Utility_98SE-ME-2000-XP/V1.10/DRIVER/Windows\ XP/
Mrv8000c.cat  Mrv8000c.inf  Mrv8000c.sys

[root@thinnai ndiswrapper-1.20]# cp ../ENLWI*/*{inf.sys} .		# Copy the drivers into the current dir

[root@thinnai ndiswrapper-1.20]# ndiswrapper -i Mrv8000c.inf	# Install them
Installing mrv8000c
Forcing parameter AdhocGMode|1 to AdhocGMode|0
Forcing parameter AdhocGMode|1 to AdhocGMode|0

[root@thinnai ndiswrapper-1.20]# ls /etc/ndiswrapper/			# Confirmed the installation
mrv8000c
[root@thinnai ndiswrapper-1.20]# ls /etc/ndiswrapper/mrv8000c/
11AB:1FAA.5.conf  11AB:1FAB.5.conf  mrv8000c.inf  mrv8000c.sys
[root@thinnai lnx_data]# ndiswrapper -l
Installed drivers:
mrv8000c                driver installed, hardware present

The next step is to configure the wireless interface, scan for access points, and attach to one. Prior to these steps, though, I checked the version of wireless tools:

[root@thinnai ~]# rpm -qa | grep -i wireless
wireless-tools-28-0.pre13.5.1

[root@thinnai ~]# iwconfig --version
iwconfig  Wireless-Tools version 28
          Compatible with Wireless Extension v11 to v19.

Kernel    Currently compiled with Wireless Extension v19.

wlan0     Recommend Wireless Extension v18 or later,
          Currently compiled with Wireless Extension v19.

Final Lap

After the confirmation, I wrapped the following commands up in a shell script to ease the wireless card driver installation and activation after every system boot (as a step forward, I could have re-written the script so that the wireless interface is activated from /etc/init.d):

echo "Activating wireless interface on your computer ..."
modprobe ndiswrapper
echo "===================================================================="
echo "Status of your ethernet interfaces ... "
/sbin/ifconfig
echo "===================================================================="
echo "Activating the wireless interface ... "
/sbin/ifconfig wlan0 up
echo "===================================================================="
echo "Status of your wireless interfaces ... "
/sbin/iwconfig
echo "===================================================================="
echo "Scanning your wireless networks, joining available n/w also ..."
iwlist wlan0 scan
/sbin/iwconfig wlan0 essid default
/sbin/iwconfig wlan0
echo "===================================================================="
echo "Acquiring IP address for the wireless interface ... "
dhclient wlan0

Below, I have listed the commands that I used to verify the status of the PCI wireless interface with ndiswrapper installed and activated. I did this via the "dhclient" command:

Acquiring IP address for the wireless interface ...
Internet Systems Consortium DHCP Client V3.0.3-RedHat
[...]
Listening on LPF/wlan0/00:1e:2a:35:2a:79
Sending on   LPF/wlan0/00:1e:2a:35:2a:79
Sending on   Socket/fallback
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPACK from 192.168.0.1
bound to 192.168.0.147 -- renewal in 39 seconds.

Results of simple check to validate the connectivity:

[ram@thinnai ~]$ host linuxgazette.net
linuxgazette.net has address 64.246.26.120
linuxgazette.net mail is handled by 10 genetikayos.com.
[ram@thinnai ~]$ ping -c 5 www.eham.net
PING www.eham.net (69.36.242.135) 56(84) bytes of data.
64 bytes from atlanta.eham.net (69.36.242.135): icmp_seq=1 ttl=50 time=297 ms
64 bytes from atlanta.eham.net (69.36.242.135): icmp_seq=2 ttl=50 time=298 ms
64 bytes from atlanta.eham.net (69.36.242.135): icmp_seq=3 ttl=50 time=298 ms
64 bytes from atlanta.eham.net (69.36.242.135): icmp_seq=4 ttl=50 time=298 ms
64 bytes from atlanta.eham.net (69.36.242.135): icmp_seq=5 ttl=50 time=298 ms

--- www.eham.net ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3998ms
rtt min/avg/max/mdev = 297.142/298.288/298.837/0.617 ms

Conclusion

Patiently and carefully read through the wireless support URLs (listed in the Intro section of this article) prior to deciding which card to buy. If you have to set up and configure a PCI/USB wireless card in a GNU/Linux environment that isn't supported by madwifi, don't feel let down; ndiswrapper is there to help you out of the quagmire.

I would be happy to hear from the community if there are better and proven ways to set up and configure PCI wireless cards under GNU/Linux!

Talkback: Discuss this article with The Answer Gang


Bio picture

Ram works for an SOC test company in Chennai with the head office based in Boston. In his free time (when his daughter gets busy with her friends), he likes to spend time reading books on world history, solving crosswords, and, if possible, get his hands dirty with FOSS.


Copyright © 2008, Muthaiah Ramanathan. Released under the Open Publication License unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 152 of Linux Gazette, July 2008

Tux