Thursday, March 3, 2011

Linux & Wireless Networking

Setting up a wireless NIC is usually fairly straightforward if you know what commands to use.

You MUST know what chipset your NIC uses.  The model number and manufacturer is mostly irrelevant.  

For a usb device use:
sudo /usr/bin/lsusb
You'll see output similar to this: 
Bus 003 Device 005: ID 0bda:8187 Realtek Semiconductor Corp. RTL8187 Wireless

For a pci NIC use:
sudo /sbin/lspci -nnk
This will give you output similar to the usb command.

If you're not getting any output with those commands your hardware is defective and Linux obviously won't be able to use it.  You can verify by trying in Windows as well.

The next step is to check if the kernel recognizes it.

Use the command: 
dmesg | less
or to get more specific
dmesg | grep -A 5 -B 5 -i firmware


That will allow you to browse through your looking for any information about your wireless card, in particular requests for firmware.  The second command searches specifically for the word firmware and outputs 5 lines before and five after so you won't miss anything.  Adjust it less if it's too much output.

One of my usb NICs require the package 'kernel-firmware' (opensuse) and would have something like this in the output of dmesg:
requesting firmware file 'kernel-firmware' failed

At that point all I have to do is install the package kernel-firmware (zypper in kernel-firmware) and it starts working.

If you know your nic id and the chipset but don't know what driver it uses or where to get the driver you can easily google around and find which driver it uses.  The usb id is the most surefire way to get an exact match of what driver you need.  The drivers actually have these id's in their code.

The best way to add a driver is by using a repository for your flavor of Linux.  If you just add the driver manually you'll have to update it every time you update the kernel.  With the repository that will be taken care of automatically.

It's not very likely that you'll have to compile your own driver unless your device is very new in the market.

Using NDISWrapper and Windows drivers should be a last resort.  There's almost always a better way to get your card working.

Please feel free to drop me a line if you can't get your wireless working, no matter which distro you use.

I've recently taken on the challenge of occasionally buying random (cheap) wireless nics (especially the ones people say in reviews don't work with Linux)  to see if I could make them work.  So far I haven't even had a challenge.  I just plugged them in and they worked.  I'm sure I'll eventually find some that don't work.

My wireless devices:

Rosewill RNX-G1

Bus 001 Device 007: ID 0bda:8187 Realtek Semiconductor Corp. RTL8187 Wireless Adapter
(works out of the box on the latest kernel)

Belkin F6D4050 V2
Bus 001 Device 012: ID 050d:935b Belkin Components
(requires package 'kernel-firmware' in opensuse, Ubuntu works out of the box)

Asus WL-167g V3
Bus 001 Device 013: ID 0b05:1791 ASUSTek Computer, Inc.
(Works out of the box)









3 comments:

ravi said...

Hello Dear,

how did you installed Asus WL167G V3 in Backtrack 5 r3. I am totaly tired to install the drivers please guide me and show me the way.

My id- ravi238873@gmail.com

Happy Linux Guy said...

It should be supported out of the box on that release.

mahasiswa teladan said...

hi...Im student from Informatics engineering nice article,
thanks for sharing :)