Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

Set Up Wireless Networking with NdisWrapper

by E. A. Graham, Jr. on May 5, 2004

I recently "inherited" an ancient Dell Latitude (333 Mhz Celeron) laptop. In true fashion, I was unable to find a Linux-compatible PCMCIA 802.11b card for it, so I just bit the bullet and bought a Netgear MA521, figuring I could more-or-less put up with Windows on the laptop. Unfortunately, Win2K runs about as fast as molassas in a Maine December (e.g. not) on this particular platform. So I dug in and tried many things to get the MA521 to work.

Fortunately, this particular card uses the RealTek chipset. Unfortunately, RealTek has limited driver support for Linux (in other words, the driver wouldn't work "out of the box" for a fresh Fedora Core 1 installation).

To cut the tale of 2 months off-and-on work short, I finally got everything working using the RealTek Win2K driver and ndiswrapper. Here's the steps I went through to make everything happen. You'll have to feel at least somewhat comfortable with the command-line and doing some old-time "hacking," but it's actually pretty straight-forward.

Intial Steps

First, make sure the PCMCIA card is NOT inserted. This will make your life easier later. Download the source for ndiswrapper. I recommend this because that way you don't have to worry (too much) about which kernel you're using. Make sure you have the proper kernel sources, as well.

You'll have to figure out how to get the tarball onto the laptop, since it's not already connected, but there's several ways to do it. I'll leave it up to you to handle that part...

The package includes some very good instructions, so just follow the INSTALL diretions until you get to section 4. Here's where we're going to seriously deviate from their instructions.

If you've paid attention, you'll know that the device that ndiswrapper is furnishing to the system is called wlan0. Now, RedHat (and Fedora) have done their own "magic" on the hotplug and wireless setup sections, so it's real nice and easy if you have supported hardware. When you don't, let's just say that any instructions or HowTos I tried to follow for the iwtools were a bit lacking and didn't perform as expected. So, it's time to get a bit creative.

Hacking the RedHat Scripts

Go ahead and issue the command
ndiswrapper -m
This sets up your modules.conf file to alias "wlan0" to "ndiswrapper" - very important!

At this point, ndiswrapper is loaded into the memory and wlan0 is somewhat enabled (more in a bit). The redhat-config-network utility, of course, doesn't have any information about ndiswrapper or wlan0. But that won't stop us...

Start redhat-config-network (as root) and select "New" to create a new device.

Select "Wireless connection", click on "Forward", select "Other Wireless Card" (your only option), click "Forward" again. You won't find anything in the Ethernet adapter interface drop down, so just select any old thing. We'll take care of this in a minute. Click on "Foward."

This next page is where you'll enter your specific wireless information. Double-check everything you enter here, but most importantly, make sure that your Wireless Access Point (WAP) has WEP encryption turned off. This will make your initial connection easier and, to be honest, I've had troubles with it. I used the "Auto" setting for "Mode" (although "Managed" worked as well), specified my SSID, and selected the channel I had set my WAP to. Click on "Forward."

The first time I did this, I used the DHCP option and it worked just fine, but I'm kind of picky and I want to have a static address for every machine on my network, since I ssh and NFS between all of them. So this time around, I set up a static IP (192.168.1.10), with the appropriate NetMask (255.255.255.0) and Gateway (the WAP - I relocated mine to 192.168.1.101). Click on "Forward" and then "Apply."

Obviously, this setup won't work, so don't even try to activate the device. Make sure that your DNS setup is okay (if not using DHCP) and save the configuration. Now we get into the fun part...

First stop is the wireless setup. Change to the /etc/pcmcia directory and locate the file named "wireless.opts" - make a backup copy of the file and then open it in your editor of choice. Make sure the following lines are at the top of this file:

essidany,*,*,*)
INFO="Any ESSID"
ESSID="any"
;;
Save your work and exit the editor.

Next stop is the /etc/sysconfig directory. In there, locate the file named "network". Make sure that it has entries like this:

NETWORKING=yes
HOSTNAME=your.host.name
The HOSTNAME is important if you want a "real" name for your laptop insted of some random name that DHCP creates for you.

Change to the /etc/sysconfig/network-scripts directory. Locate two files: "keys-eht0" and "ifcfg-eth0". Rename (mv) them to "keys-wlan0" and "ifcfg-wlan0" respectively. Note that the "keys-wlan0" file is empty, which is fine for right now. You'll want to edit the "ifcfg-wlan0" file and change the following entry:

DEVICE=wlan0
Make sure the ONBOOT is set to "no" because setting it to "yes" will just make your computer show you nasty messages when booting.

Change to the /etc/sysconfig/networking/devices directory. Yes, those are the same files. Just erase them and copy your new "*-wlan0" files here. Change to the /etc/sysconfig/networking/profiles/default directory - and there they are again! Delete and copy once more.

Time to cross your fingers and insert the PCMCIA card. In some (most) cases, you might hear the system "beep" as hotplug detects that the card has been inserted. If not, type the following command in your terminal and you should see an output similar to this:

# cardctl status
Socket 0:
no card
Socket 1:
3.3V CardBus card
function 0: [ready]
This means the system has at least recognized that you have a card. If you type "ifconfig" or "iwconfig" though, you still won't see an entry for "wlan0." The reason for this is that the ndiswrapper module doesn't know which driver to use (even though you've loaded up only one). Enter the following commands:
# ndiswrapper -l
Installed ndis drivers:
net8180
# loadndisdriver net8180
If you enter "iwconfig" at this point, you'll note that there's now an entry for "wlan0" but it doesn't seem to be connected to your ESSID. The easy way to fix this is this:
# cardctl eject 1
Physically eject the card and re-insert it. If that didn't get the network started, this surely will:
# ifup wlan0
Issuing the iwconfig and ifconfig commands should show the card configuration and the network connection, respectively. If not, you may want to double-check your work.

Final Bits

To make your life easier, edit the /etc/rc.d/rc.local script and add the following line:
/sbin/loadndisdriver net8180
Now, when you reboot the system (leaving the PCMCIA card in), networking will automatically start and connect to your WAP. If you have problems, but everything appears to be working correctly, eject the card (remember the cardctl command!) and re-insert. If you don't use the cardctl command and just physically remove the card, your system will probably hang and you'll have to do a hard boot.

Note that if you upgrade your kernel, you'll have to re-compile and install NdisWrapper for that kernel version.

Special Thanks

The NdisWrapper team - awesome!
coryonline.com - his original article at here helped get me started and more-or-less looking in a slightly different direction.