Article View: alt.os.linux.suse
Article #90HOWTO: Adding cheap wifi to your linux box
From: Gregory Toomey
Date: Mon, 26 Jul 2004 07:02
Date: Mon, 26 Jul 2004 07:02
101 lines
5309 bytes
5309 bytes
Summary: This is a brief howto on adding wifi to a laptop or desktop using a cheap, common 802.11b device.
For SuSE 9.1 its just about all done for you; other distributions may need to do more work.
This Howto
- is for the most common wifi devices, which use the Prism2 chipset
- compatible devices are listed here
http://www.linux-wlan.org/docs/wlan_adapters.html.gz
- is tested with Netgear MA111; this is a usb device with a usb extension cable; can be easily connected to a laptop or dessktop;
I bought one at www.thediscshop.com.au last week for $A77
http://www.netgear.com.au/products/prod_details.asp?prodID=173&view=
- is for connecting from linux TO an access point using a static IP
This howto is NOT
- for 802.11g devices (different driver)
- for peer-peer connections, or using the device AS an access point
- for dhcp (though it should be easy to do)
- for operating in promiscuous mode
GotCha:
- iwconfig can be used to show the device status
- to configure the device you need the wlanctl-ng command
- wlanctl-ng is documented at http://www.linux-wlan.org/
SuSE 9.1
- its trivial; all has been done for you in the default install. wlanctl-ng is available as root. Just connect the device and run script 1 or script 2.
- for other distributions you may need to install a package to get wlanctl-ng; I recommend a 2.6 kernel as it has better wifi support
SCRIPT 1 - simple wifi ( no encryption)
You will need: an access point, ssid for the access point, a linux box, a prism2 wifi device connected to the linux box; root access.
In this script I set up tbe prism2 device connect to an access point. Set up the access point to the same ssid as the script.
#!/bin/bash
linux:~/bin # ifconfig
modprobe prism2_usb prism2_doreset=1
wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable
wlanctl-ng wlan0 lnxreq_autojoin ssid=gmtnet authtype=opensystem
# set up my IP
ifconfig wlan0 192.168.2.6
If all is well ifconfig & iwconfig should show the device:
linux:~/bin # ifconfig
wlan0 Link encap:Ethernet HWaddr 00:09:5B:91:E9:69
inet addr:192.168.2.3 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::209:5bff:fe91:e969/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:24495 errors:0 dropped:0 overruns:0 frame:0
TX packets:26005 errors:0 dropped:4 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13410263 (12.7 Mb) TX bytes:2572436 (2.4 Mb)
linux:~/bin # iwconfig
wlan0 IEEE 802.11-b ESSID:"gmtnet" Nickname:"gmtnet"
Mode:Managed Frequency:2.412GHz Access Point: 00:50:FC:D6:7B:A8
Bit Rate:11Mb/s Tx-Power:2346 dBm
Retry min limit:8 RTS thr:off Fragment thr:off
Encryption key:off
Link Quality:50/92 Signal level:-60 dBm Noise level:-97 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
(here signal quality=60/92=54%)
PROBLEM:
If you ping the access point from linux and get "network unreachable", or
"Tx attempt prior to association, frame dropped" in the system log, the most likely cause is the ssid in the script does not match the access point.
See ftp://ftp.linux-wlan.org/pub/linux-wlan-ng/FAQ for this and other common problems
SCRIPT 2 - wifi access with encryption
Same as script 1 but with WEP encryption. The ssid and WEP key of the access point must be the same as the script.
Get a random WEP key here:
https://www.wireless.org.au/~jhecker/wepgen/index.php
#!/bin/bash
ssid=gmtnet
wep="E2:74:5D:35:00"
modprobe prism2_usb prism2_doreset=1
wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable
wlanctl-ng wlan0 lnxreq_hostwep decrypt=true encrypt=true
wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11WEPDefaultKeyID=0
wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11ExcludeUnencrypted=true
wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11PrivacyInvoked=true
wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11WEPDefaultKey0=$wep
wlanctl-ng wlan0 lnxreq_autojoin ssid=$ssid authtype="sharedkey"
# set up my IP
ifconfig wlan0 192.168.2.3 netmask 255.255.255.0
route add default gw 192.168.2.20
More Reading:
prism2 driver: http://linux-wlan.org/
http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Linux.Wireless.drivers.802.11b.html
gtoomey
Technical Details
Message-ID:
<2mjoj0FndmdtU1@uni-berlin.de>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1041dd,e4a104380bc32719,start X-Google-Thread: 102983,e4a104380bc32719,start X-Google-Attributes: gid1041dd,gid102983,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Gregory Toomey <nospam@bigpond.com> Newsgroups: alt.os.linux.suse,aus.computers.linux Subject: HOWTO: Adding cheap wifi to your linux box Followup-To: alt.os.linux.suse,aus.computers.linux Date: Mon, 26 Jul 2004 17:02:36 +1000 Lines: 101 Message-ID: <2mjoj0FndmdtU1@uni-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de wIahnkuyvot13HIwwb7c0goALfluKNOdDr6VMWLmxzrzyNXtxm User-Agent: KNode/0.7.7 X-Hello: Why are you looking at my headers - your Outlook Express cant do this