Wireless cards and linux

Ah...What a wonderful topic :) I remember back when I was first playing around with knoppix on an old IBM thinkpad 2645 laptop....Slow as poop, but it was great. I was messing with it, and everything was all nice and fine with KDE but I noticed that my internet didn't work. Which was very disheartening. So what did I do? What any weiner would do. Ran right back to windows 2000. After that, I decided linux would be better with my desktop, since I wasn't using a wifi card with that. Ran gentoo for a while, and I enoyed it quite a bit. Then I decided to go with my IBM again. But this time, I wanted to install a distribution, instead of just play with a livecd. A magazine that I grabbed at the time, had ubuntu on a dvd, and I decided to burn that to an iso and then try it. So I installed it, and my wireless card was available under the gnome network manager, but it would only load one site, and then never load any others. At the time I had a linksys WPC54GS ver. 2 card, with a broadcom chipset. So now I had some info, so off to google I went. I finally came to the conclusion that I had to use ndiswrapper, to basically wrap my windows wireless card driver into linux code, and then use it that way. After trial after trial I finally found a guy that would help me (I was a noob :P) Blacklisted the driver that linux was using natively, installed ndiswrapper, and finally after some configuring, I got it working. Very excited. Everything worked! Pretty much the end of that story. So why did I have to do that? Why couldn't popular companies like Linksys, or Netgear port their drivers for linux? I don't know. :P But in any case, I just go about my business with what I can get to work. So here, in this post, I will show you how to get an RTL8187 card working under linux, and how to connect to an access point, set your IP address, a default gateway, and set your wireless key.

First thing is first, you need to blacklist the drivers that your distribution is "trying" to use. This will create some conflict problems if you do not. So find your blacklist file, which for me is /etc/modprobe.d/blacklist because I use slackware wooh.

nano /etc/modprobe.d/blacklist

add
blacklist rtl8187
blacklist 8187
blacklist rtl

Now I just threw that in there, because I am not sure which driver it is, but it is one of those, so that should get you by.

Next thing is installing ndiswrapper. I installed from source, because I am cool like that. So just for the heck of it I will show you how to do that.

Download the .tar.gz file, preferably to your home directory.

cd ~/

(that stands for the current users home directory btw)

tar -xvzf ndiswrapper.tar.gz

look for the directory that it should output that it it made.
change into that directory:

cd ndiswrapper
Then look for a readme, or install.

ls

find it, and read it ;). Might need some special parameters or something.
for me, it was just the usual.

./configure

make

su
*password*

make install

And there we go. Now that ndiswrapper is installed, you will want to find your drivers. You want the .inf and .sys files located with whatever cd you have, or wherever you found them online. In my case the files are named netrtuw.inf and rtl8187.sys

Anyway, copy those files somewhere cool. Say your ndiswrapper directory :P Then simply change to that directory (If ndiswrapper dir, then just stay where your at).
Here is where we will install the driver.

ndiswrapper -i netrtuw.inf

Not the .sys file :P
Preferably do that as root. I do anyway :).
Now you can do

ndiswrapper -l

And hopefully get a good output like this:

netrtuw : driver installed
device (0BDA:8187) present

If not, you will probably want to use

ndiswrapper -e netrtuw

to uninstall, and then reinstall.

Lastly, to finish up, you need to associate that driver with the correct interface, which is pretty automated, just one command.

ndiswrapper -m

And bam. You are done with the install. You will probably want to be like me, and add that to your modprobe list, so that you can load it on boot. Hopefully you know how to do that, but if not, then here is what you need to do:

If your running slackware, then this should be correct, just replace the kernel version with yours.

nano /etc/rc.d/rc.modules-2.6.21.5-smp

Then add

/sbin/modprobe ndiswrapper

To the bottom, and then ctrl+x to exit, and save it. That should load it at boot, and that handles that.

Next, you will probably want to connect to your access point, and all that jazz. Probably a good idea just to restart your system now, just to clean things up.

There are three tools we will use here.
ifconfig.
iwconfig.
and route.

The first is a monitor/configuration tool for interfaces, the second is specific for wireless interfaces, and the third we will use to add your default gateway.

First thing is first though, you will probably find adding your default gateway (gw) nameserver to your resolve.conf file.
For me:

nano /etc/resolve.conf

Then I added

nameserver 192.168.1.1

Thats the IP of my router.

ctrl+x and save that, and now you have that configured.

Next we will use ifconfig.

Just do ifconfig -a to see all the interfaces, or use ifconfig wlan0 if that is your wireless interface's name.

Check out all the info there.

Mine looks like this:

wlan0 Link encap:Ethernet HWaddr *my address is here :)*
inet addr:192.168.1.46 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2c0:a8ff:fecf:ec44/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21987 errors:0 dropped:0 overruns:0 frame:0
TX packets:24607 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:14547597 (13.8 MiB) TX bytes:4510864 (4.3 MiB)

anyway, if you don't have an inet addr that is just fine.

Before you go any further, ping www.google.com or something to see if your internet works. Or use the network manager, or something if you don't want to configure it in the terminal. But the cool people use the shell so get over your no-terminal-mindset and lets get cracking.

All of the following should be done as root.

Adding an IP address:

ifconfig wlan0 192.168.1.46

For me, interface is wlan0, and I use that IP address. This all may be configured by DHCP by you, which is great, but I like to do it myself :D Remember that your IP should be in the same rounds as your router. So if you have 192.168.0.1 as your router, use 192.168.0.46 or something as your IP. Don't copy the IP of another computer either, because that is just very naughty of you ;).

Next check out the output of iwconfig. Mine:
wlan0 IEEE 802.11g ESSID:"myessid" Nickname:"(none)"
Mode:Managed Frequency:2.437 GHz Access Point: 00:12:0E:7E:03:56
Bit Rate=54 Mb/s Tx-Power:20 dBm Sensitivity=0/3
RTS thr=2432 B Fragment thr=2432 B
Encryption key:off
Power Management:off
Link Quality:65/100 Signal level:-54 dBm Noise level:-96 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

If you have "off/any" in your ESSID section, thats great. Just means you have to add one, by doing the following:

iwconfig wlan0 essid youressid

w00t! Done.

Now if you have an encryption key, just add one.

iwconfig wlan0 encryption on

iwconfig wlan0 key yourkey

BAM! Done.

Probably a good idea to re-add your IP now. I just like all the extra work personally. :).

Now, we need to make sure that your interface allows the router to send your information across the internet, so you can load sites. This means setting your router as your default gateway to the internet. Basically like sending your interface, a card that says "open door 1 to get to the internet"

route add default gw 192.168.1.1

I know your smart, so I will assume that you replaced 192.168.1.1 with your routers address, if not, you should know now :).

After that, it should all work. Consider writing a nice bash script to automate all this. I did it a while ago, at around 4:00 AM just because I was bored :D.

You should have a fully configured wireless card now :). Hopefully.

If you have an atheros card, check out http://madwifi.org/

If you have problems, check out a forum specific to your distro, or slap an email at me, and I can try to help you. no guarantees though.

hendrix.ryan@gmail.com

Or you can message me on myspace.

www.myspace.com/Ryan_hendrix

Axl

0 comments:

Post a Comment