Wifi

From SlackWiki
Jump to: navigation, search

Regarding wireless, I promised more info on getting wifi to work with linux. Here it is. I'm still utilizing the Linksys WPC11 wireless PCMCIA network card in Slackware. The methods I'm about to discuss work in Slackware v8.0 through v11 (I've not tested v12 yet, but there shouldn't be an issue). 9.0 and 9.1 seem to use orinoco drivers instead of prism drivers. I COULD fix this by installing prism drivers but the orinoco driver seem to work without problems (so far). When and if problems arise, I'll move to the prism drivers and update this page.

Note: this page goes through the manual steps of gaining internet activity. I tend to use static IP configurations. This means that the system won't rely on a DHCP server for connectivty, which is why I cover how to edit the routing table of your system. Another reason I go through the manual process is so that the new user can know and understand the technical aspects of networking and the internals of Slackware (or any *nix-based system).

Now, my particular laptop accepts a CAT5 connection and will also run PCMCIA wifi (and also USB wifi adapters). I've usually relied upon the PCMCIA method of internet connectivity. Slackware 9.1 (and 9.0) accept PCMCIA cards via the Hotplug function now, which makes things very easy to set up. I usually just insert my wifi card into the PCMCIA slot and hear the computer 'beep'. Follow along by doing what I do. :o)

After insertion of the card, type 'dmesg' in a shell and you should see something akin to the below:

orinoco_lock() called with hw_unavailable (dev=ce66f800)
hermes.c: 4 Dec 2002 David Gibson 
orinoco.c 0.13d (David Gibson  and others)
orinoco_cs.c 0.13d (David Gibson  and others)
eth1: Station identity 001f:0005:0001:0003
eth1: Looks like an Intersil firmware version 1.3.5
eth1: Ad-hoc demo mode supported
eth1: IEEE standard IBSS ad-hoc mode supported
eth1: WEP supported, 104-bit key
eth1: MAC address 00:06:25:A8:EA:50
eth1: Station name "Prism  I"
eth1: ready
eth1: index 0x01: Vcc 5.0, irq 3, io 0x0100-0x013f
eth1: New link status: Connected (0001)
eth1: New link status: Disconnected (0002)
eth1: New link status: Connected (0001)

This shows that the wifi card has been recognized and that a device name was assigned to it (eth1, in this case). To use the card, you have to know how you're going to use the card. Most people gain internet access via WAP (wireless access point) and this is what we'll do. I've not net experimented with adhoc (direct computer(s)-to-computer(s) connections) yet, but when I do, this page will be updated.

A WAP's DHCP server may automatically assign your wifi card an IP. If that is the case, you won't have much use for this tutorial, other than establishing encryption. Please be aware that I cover establishing WEP encryption but not WPA/WPA2 (yet). If you're using static IPs or to establish WEP encryption, continue to read the steps below.

Next, you'll want to assign a WAP for the card to access. If you type 'iwconfig' (using 'sudo' or as the superuser), you'll see your wifi card's stats:

ron@toshi:~$ sudo /usr/sbin/iwconfig
lo        no wireless extensions.
eth0      no wireless extensions.
eth1      IEEE 802.11-DS  ESSID:""  Nickname:"Prism  I"
          Mode:Managed  Access Point: 00:00:00:00:00:00  Bit Rate:11Mb/s
          Tx-Power=15 dBm   Sensitivity:1/3
          Retry min limit:8   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality:0/92  Signal level:-68 dBm  Noise level:-122 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

As you can see, there's no ESSID and the MAC address for the card isn't showing. The wifi card needs to be set up to access the WAP:

ron@toshi:~$ sudo /usr/sbin/iwconfig eth1 essid applejack
ron@toshi:~$ sudo /usr/sbin/iwconfig
lo        no wireless extensions.
eth0      no wireless extensions.
eth1      IEEE 802.11-DS  ESSID:"applejack"  Nickname:"Prism  I"
          Mode:Managed  Access Point: 00:00:00:00:00:00  Bit Rate:11Mb/s
          Tx-Power=15 dBm   Sensitivity:1/3
          Retry min limit:8   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality:0/92  Signal level:-68 dBm  Noise level:-122 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Now, you need to establish an interface. I'm using 'eth1' as an interface so I'd type: "ifconfig eth1 <Static-IP-HERE> up":

ron@toshi:~# sudo /sbin/ifconfig eth1 10.150.1.171 up
ron@toshi:~# sudo /sbin/ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:09:5B:05:8E:C7  
          inet addr:10.150.1.171  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::209:5bff:fe05:8ec7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:468 (468.0 b)
          Interrupt:20 Base address:0xa000 

Next, run 'iwconfig':

eth1      IEEE 802.11-DS  ESSID:"applejack"  Nickname:"Prism  I"
          Mode:Managed  Frequency:2.437GHz  Access Point: 00:07:23:78:95:80
          Bit Rate:2Mb/s   Tx-Power=15 dBm   Sensitivity:1/3
          Retry min limit:8   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality:90/92  Signal level:5/153  Noise level:117/153
          Rx invalid nwid:0  Rx invalid crypt:51  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

If you're not utilizing encryption on your WAP, then you should be set for online activity (provided your routing table is set up, if you're using static IPs...this is covered below). Some people use WEP/WPA (at the LEAST, use WEP), so we'll establish this now. You'll have to know what bit size your WAP is set to use but I normally use 128-bit. Type 'iwconfig eth1 key (your key here)'. Do this without the parentheses:

iwconfig eth1 key xxxxxxxxxxxxxxxxxxxxxxxxxx

I've put the 'xxxx's there because there's no way in a hot day in Hell I'm going to share my encryption with the world. Replace the x's with your own key. To check the WEP status:

root@toshi:~# iwconfig
lo        no wireless extensions.
eth0      no wireless extensions.
eth1      IEEE 802.11-DS  ESSID:"applejack"  Nickname:"Prism  I"
          Mode:Managed  Frequency:2.437GHz  Access Point: 00:07:23:78:95:80
          Bit Rate:2Mb/s   Tx-Power=15 dBm   Sensitivity:1/3  
          Retry min limit:8   RTS thr:off   Fragment thr:off
          Encryption key:xxxxxxxxxxxxxxxxxxxxxxxxxx   Security mode:open
          Power Management:off
          Link Quality:88/92  Signal level:5/153  Noise level:117/153
          Rx invalid nwid:0  Rx invalid crypt:291  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

If you haven't set your interface IP yet, try this: 'ifconfig eth1 10.150.1.171'. Now you'll have to set your routing table up (if you're running two interfaces like I am):

root@toshi:~#  route add -net 10.150.1.0 netmask 255.255.255.0 dev eth1
root@toshi:~#  route add default gw 10.150.1.1 eth1
root@toshi:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.150.1.0      *               255.255.255.0   U     0      0        0 eth1
10.150.1.0      *               255.255.255.0   U     0      0        0 eth0
10.0.0.0        *               255.0.0.0       U     0      0        0 eth1
loopback        *               255.0.0.0       U     0      0        0 lo
default         10.150.1.1      0.0.0.0         UG    0      0        0 eth1
default         10.150.1.1      0.0.0.0         UG    1      0        0 eth0

Lastly, check to see that you can get outside of your local network:

root@toshi:~# ping -I eth1 www.unixfool.com
PING www.unixfool.com (216.0.115.49) from 10.150.1.171 eth1: 56(84) bytes of data.
64 bytes from www.unixfool.com (216.0.115.49): icmp_seq=1 ttl=240 time=207 ms
64 bytes from www.unixfool.com (216.0.115.49): icmp_seq=2 ttl=240 time=199 ms
64 bytes from www.unixfool.com (216.0.115.49): icmp_seq=3 ttl=240 time=138 ms
--- www.unixfool.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2016ms
rtt min/avg/max/mdev = 138.879/181.863/207.709/30.605 ms
root@toshi:~#

I created a script that gets my wifi card online. Because I sometimes use both the wifi card and the integrated ethernet card simultaneously (as you can see in the about routing output), getting them both running is sometimes cumbersome. Usually, I will be online with one of the two interfaces and I'll decide I want to use them both. I'll post the script sometime soon.

You can also use 'ping www.unixfool.com' if you've no other interfaces to deal with.

Let me know if any of this is faulty and keep in mind that not every system's going to be set up as mine is, so you may still run into problems if you've modified your Slackware setup beyond a fresh install.

______


The below are instructions to get the D-Link DWL-650 (revision M) working with Linux. I've added this because I had difficulty getting this card to work and because, when doing research, noticed that many others had issues with this card.

I bought a D-Link DWL-650 without doing extensive research on if it would work with Linux. Since I dual-boot the Toshiba Satellite 1805-S274, I got it to work with Windows XP but not Slackware-current. I tried using Linuxant's product but had little success at the time (early 2004).

Yesterday, I did extensive research on this card and its chipset. I utilizes the Atmel chipset. I'd tried using drivers from Atmel's page with little good results so I decided to try ndiswrapper. Tonight, I can attest that ndiswrapper works with this card. I'll document the process here:

I downloaded ndiswrapper-0.11.tar.gz and moved the file to /usr/local/src. After moving the file, I ran:

tar xvzf ndiswrapper-0.11.tar.gz
cd ndiswrapper-0.11

As root, run:

make install

After compilation, you'll need your Windows driver installed. I got ndis5x-8180(173).zip from opendrivers.com. Unzip it using the unzip command:

unzip ndis5x-8180(173).zip
ndiswrapper -i </path/to/inffile.inf>

Example:

ndiswrapper -i /usr/local/src/ndis-drivers/net8180.inf

Running "ndiswrapper -l" shows the status of the installed driver. In my case, this command shows:

root@toshi:/usr/local/src/ndis-drivers# ndiswrapper -l
Installed ndis drivers:
net8180 driver present, hardware present

Next, load the module:

modprobe ndiswrapper

Now we need to locate the wireless interface:

iwconfig

You may need to set the IP of the interface (if you like using static IPs):

ifconfig wlan0 10.150.1.170

I used "10.150.1.170", as I use the 10.150.0.0 netblock. Use whatever IP is appropriate for your network.

Next, run all your "iwconfig" settings. Mine is below:

iwconfig wlan0 essid h@m mode auto enc xxxxxxxxxxxxxxxxxxxxx

I had to add routes to get my wifi card functional:

route add -net 10.150.1.0 netmask 255.255.255.0 dev wlan0
route add default gw 10.150.1.1 wlan0

This concludes my notes for utilizing the D-Link DWL-650, revision M wifi card. Keep in mind that certain revisions use certain chipsets. I couldn't use Prism-based drivers for my card since it uses the Atmel chipset. I've yet to get Atmel's Linux drivers to work, but I may continue to try as a side project.

Let me know if you've comments to make this tutorial better.

This tutorial is a [1] mirror

A wifi security perspective is here

--Ron 00:46, 16 September 2007 (EDT)