Wi-Fi
Presentation Outline
Presented to Greater Orlando Linux User Group
2/1/2007
by Steve Litt


Copyright (C) 2007 by Steve Litt, all rights reserved. You can use this outline as provided by the Creative Commons Attribution 2.5 license, as described at
http://creativecommons.org/licenses/by/2.5/legalcode.
Why Wifi?
Wifi basics
	TCP/IP over radio
	NICs and Access Points
	hardware<->driver<->operating system
	Complex, lots of variables and components, hard to debug
		Try to learn about it
		Try to break it down
	Baseline
		Windows system
		Known good NIC or access point
	3 Levels of connection
		1: Driver installed (iwlist  scanning)
		2: Association
		3: IP/DNS/Gateway connectivity
	3 Levels of Vendor's Linux Support
		Open Source drivers
		Linux binary (or HAL)
		"That's your problem, buddy!"
	Ndiswrapper
		Interfaces a Windows wifi driver to Linux
		Often more stable
		Often more features
		Often higher speeds
		More consistent installation
	Driver interference
		Hard to troubleshoot
		dmesg might show desired driver replaced by other
		lsmod | less
		/etc/modprobe.conf
		/etc/modprobe.d/
		blacklisting
Wifi trash talkin
	Wifi is easy, you're a wimp if you have trouble
		If you're Lucky
		If you're a certified Genius
		If you have pre-loaded Windows
	Ndiswrapper is "worse", "for wimps"
		Native drivers often buggy
		Ndiswrapper often supports more features & faster comm
		Ndiswrapper installs all resemble each other
	Linux doesn't support Broadcom
		Really, Broadcom doesn't support Linux
Packages you need
	dhcp-client
		Purpose
			Get IP, DNS, Gateway info from DHCP server
		Get from
			Distro
	wireless-tools
		Yields
			iwconfig
			iwlist
		Get from
			Distro
	wpa_supplicant
		Purpose
			Interface to WPA and WPA2 encryption
		Yields
			wpa_supplicant
			wpa_cli
			wpa_passphrase
			/etc/wpa_supplicant.conf
		Get from
			Distro
	ndiswrapper
		Purpose
			Linux to winWifiDriver interface
		Get from
			Distro
	Windows driver
		Purpose
			Manufacturer designed interface to wifi hardware
			Accessible through ndiswrapper
		Yields
			.inf file(s)
			"firmware"
		Get from
			Installation CD
			Computer vendor model specific website
			Wifi vendor website
			Look around the Internet
	cabextract
		Purpose
			Extract files from Windows install .exe and .cab files
		Yields
			cabextract
		Get from
			http://www.kyz.uklinux.net/cabextract.php
		Installation
			./configure && make && su -c "make install"
	unshield
		Purpose
			Extract files from Installshield .cab files
		Yields
			unshield
		Get from
			http://www.synce.org/index.php/Unshield
		Installation
			./configure && make && make check && su -c "make install"
	bcm43xx-fwcutter
		Purpose
			Extract "firmware" from installation files
		Yields
			bcm43xx-fwcutter
		Get from
			http://bcm43xx.berlios.de/
			DO NOT get from distro
		Installation
			Read the README file
			make && su -c "make install"
Baseline (Atheros ath0)
	iwlist ath0 scanning
	iwconfig
	ifconfig
	ping troubleshooters.com
		Careful -- many locations have web-based signins
	web browsing
	lspci -vv | less
		/802
		/wlan
		/ath
	lsusb -vv | less
		/802
		/wlan
		/linksys
		/ath
	lsmod | less
		/802
		/wlan
		/ath
		/rt25
		/ndis
Linksys WUSB54G, native
	Prevent bootstarting of competing drivers
		Blacklist all ndiswrapper drivers from /etc/modprobe.d/blacklist
		Comment out all ndiswrapper drivers from /etc/modprobe.conf
		Comment out all ndiswrapper drivers from /etc/modprobe.d/*
	Enable Linux native rt2570 driver on reboot
		Edit /etc/modprobe.conf
		alias rausb0 rtusb
	Create minimal ifcfg-rausb0
		DEVICE=rausb0
		BOOTPROTO=dhcp
		ONBOOT=yes
	Kill loaded competing driver
		rmmod ndiswrapper
	Install driver
		depmod -a
		modprobe rt2570
	Test driver
		iwlist rausb0 scanning
		iwconfig rausb0
		ifconfig rausb0
			Look for DHCP loaded IP address
		If necessary:
			ifdown rausb0
			ifup rausb0
			troubleshoot
Linksys WUSB54G, ndiswrapper
	Prevent bootstarting of competing drivers
		Blacklist all other rt25x drivers from /etc/modprobe.d/blacklist
		Comment out all other rt25x drivers from /etc/modprobe.conf
		Comment out all other rt25x drivers from /etc/modprobe.d/*
	Create minimal ifcfg-wlan0
		DEVICE=wlan0
		BOOTPROTO=dhcp
		ONBOOT=yes
	Associate windows driver with ndiswrapper
		ndiswrapper -l
			I have nothing up my sleeve
		mount -o loop,ro -t iso9660 linksys_wusb64g /mnt/linksys
		cd /mnt/linksys/Drivers/WUSB54Gv4
		ndiswrapper -i rt2500usb.inf
		ndiswrapper -l
	Kill loaded competing driver
		rmmod rt2570
	Install driver
		depmod -a
		modprobe ndiswrapper
	Test driver
		iwlist wlan0 scanning
		iwconfig wlan0
		ifconfig wlan0
			Look for DHCP loaded IP address
		If necessary:
			ifdown wlan0
			ifup wlan0
			troubleshoot
WPA
	Add the following to /etc/wpa_supplicant.conf
		network={
				key_mgmt=NONE
				scan_ssid=1
				ssid="any"
			}
			network={
				psk="mypassphrase"
				scan_ssid=1
				ssid="earthquake"
			}
	Start wpa_supplicant for ath0
		wpa_supplicant -c /etc/wpa_supplicant.conf -i ath0 -D madwifi
	Test ath0
		ifconfig ath0
	Start wpa_supplicant for wlan0
		wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0 -D wext
	Test wlan0
		ifconfig wlan0
	Configure autostarting of ath0
		Modify ifcfg-ath0, add these to the bottom
			WIRELESS_ENC_KEY="open s:mypassphrase"
			WIRELESS_WPA_DRIVER=madwifi
			DHCP_CLIENT=dhclient
		Restart
		Test
	Configure autostarting of wlan0
		Modify ifcfg-ath0, add these to the bottom
			WIRELESS_ENC_KEY="open s:mypassphrase"
			WIRELESS_WPA_DRIVER=wext
			DHCP_CLIENT=dhclient
		Restart
		Test
WEP
	Create wep script
		#!/bin/bash
		iwconfig $1 key [1]  1111111111 
		iwconfig $1 key [2]  2222222222
		iwconfig $1 key [3]  3333333333
		iwconfig $1 key [4]  4444444444
		#iwconfig $1 key [4]  
		iwconfig $1 mode managed
		iwconfig $1 essid earthquake
	Run wep script
		./wep wlan0
	Bring up interface
		ifup wlan0