Mike's blog

A place to put things I would like to remember.

Saturday, January 29, 2005

Using ndiswrapper

This is how I was able to use ndiswrapper, with a D-Link DWL-G510 (Rev B) wireless card. This program saved me from using windows exclusively. I am running Fedora Core 3 and loving it. I had moved my computer to another room and running cat5 cabling was going to be quite a chore from the new location. I also relocated my router, modem & server which further added to the difficulty of running new cabling. Wireless became the answer as my router had wireless built in for use by my wife and I's laptops.

So, I installed a D-Link wireless card, part# dwl-g510, on sale for $20. The card worked flawlessly with windows 2000, but was not supported by linux. I installed ndiswrapper and now I'm back in the Fedora saddle again, woo-hoo!

Here's the steps I had to take to make this work:

Get it any way you can! I booted into my windows partition to download the software because I couldn't connect to my network with a nonfunctioning wireless card, of course. I then booted into Fedora and copied ndiswrapper-0.12.tar.gz from the windows partition, /media/dos/Downloads (/media/dos is where I mount windows on my computer) to /tmp. You should definitely read the installation wiki, found on the above link. Follow the prerequisites completely. That was a big mistake I made the first time I installed ndiswrapper, I didn't have the kernel sources installed and the software couldn't install properly because there was no link from the modules directory. So, you have to first install the kernel sources for your particular kernel and create the link from /lib/modules/VERSION/ build to the kernel source you are running. VERSION=your kernel, mine is kernel-2.6.10. The kernel sources get installed in /usr/src/redhat/SOURCES/ in Fedora Core 3. The link from the modules directory is created with this command:

ln -s /usr/src/redhat/SOURCES/kernel-2.6.10 /lib/modules/2.6.10/build

Also, make sure you have wireless-tools installed. Run the command:

rpm -q wireless-tools

You should see something like: wireless-tools-27-0.pre25.4. If not, then install the wireless-tools rpm from the Fedora CD's or DVD. You'll need it later to run iwconfig.

Change to the /tmp directory.

  • install ndiswrapper with these commands:
tar zxvf ndiswrapper-0.12.tar.gz
cd ndiswrapper-0.12
make distclean
su -c "make install"

Another way is to to run make rpm instead of make install. Once the rpm's are built, then install them by running rpm -ivh.

  • install the windows driver from installation CD that came with the wireless card
First I checked the list found under the link list on the installation wiki page to get the chipset, pciid & driver information for my card. Chipset: Atheros, pciid: 168c:001a, Driver: Version 1.0, Provided on CD that came with card.
Run the command "/sbin/lspci" and get the number 02:0a:0 found before the line:
Ethernet controller: Atheros communications, Inc.: Unkown device 001a (rev 01)
Then run the command "/sbin/lspci -n" to get the PCI ID of the card. Look for the line beginning with 02:0a:0 and right down the number in the third column, 168c:001a (rev 01). Now you'll know which driver to install, it'll be clear as mud soon.
Insert the CD that came with the card into your cdrom/dvd drive.
Negotiate to the /media/cdrecorder/Drivers/Drivers directory. Issue this command:

/usr/sbin/ndiswrapper -i NetA3AB.inf

Ignore the messages that say: Warning: Cannot locate

This copies a bunch of driver files to /etc/ndiswrappper/neta3ab and creates the config file for the wireless card. The important files here are a3ab.sys, neta3ab.inf, 168C:001A:1186:3A15.conf & the link 168C:001A.conf. Make sure the link 168C:001A.conf points to the 168C:001A:1186:3A15.conf file. Mine didn't and I had to change it. If you have to, change it by negotiating to the /etc/ndiswrapper/neta3ab directory and issuing the following commands:

rm 168C:001A.conf
ln -s /etc/ndiswrapper/neta3ab/168C:001A:1186:3A15.conf \ 168C:001A.conf


Now run the command:

/usr/sbin/ndiswrapper -l

You should see:

Installed ndis drivers:
neta3ab driver present, hardware present

Now load the module, type the command:

/sbin/modprobe ndiswrapper

Check that the module loaded properly, type the command:

dmesg | grep ndis

You should see the line, ndiswrapper: driver neta3ab (D-Link, 07/28/2004, 3.3.0.157) added
Your version may be different, the part in ( ). If you don't see the above line, then check the information under section 3 of the installation wiki.

  • Now configure the interface using the iwconfig command:

/sbin/iwconfig

You should see a listing of interfaces: lo, eth0, eth1, sit0. Enter the command:

/sbin/iwlist eth1 scan

This will list information about your wireless network, like mac address, essid, mode, frequency, etc. If not, you have to issue the command:

/sbin/iwlist eth1 essid ESSID

ESSID=your wireless network name
Then issue the following command to set the mode:

iwconfig eth1 mode Managed

If you want to set WEP encryption, then type:

iwconfig eth1 key restricted XXXXXXXXXX

where XXXXXXXXXX is your WEP key. Set the network name with:

iwconfig eth1 essid ESSID

/sbin/ifconfig eth1 up

should turn on your card and join you to your wireless network, to turn the card off just type:

/sbin/ifconfig eth1 down

After getting everything working you can set ndiswrapper to load automatically by running the command:

/sbin/ndiswrapper -m

Add these lines to /etc/modules.conf to make your wireless connection start up when you boot your computer.

alias wlan0 ndiswrapper
options ndiswrapper if_name=eth1
alias eth1 ndiswrapper

That's it! Enjoy your connection.
The installation wiki was indispensable in making this work, it has everything I needed to get up and running with wireless. There are specific issues for Fedora Core that have to be addressed, they can be found by clicking the Distributions link at the top of the installation wiki page.