AUTHOR:			Dr. Edgar Alwers <edgaralwers@gmx.de>

DATE:			2006-12-10

LICENSE:		GNU Free Documentation License Version 1.2

SYNOPSIS:		Wireless Communication from the sources

PREREQUISITES:

BLFS 6.x with  kernel 2.6.18 


DESCRIPTION:

This is a Hint explaining how to prepare a PC for wireless communication with
the Internet and how to put it into operation. I solved this problem with the
help of hints and advices given by many persons, and working through lots of
papers, many of them not beeing actual anymore at this time. 
The object I had to deal with is an 'Acer' TravelMate 291LCi with Intel Centrino
Mobile Technology, equiped with an Intel PRO/Wireless 2200BG(IEEE 802.11b/g)
chip. The Laptop communicates with an 54 Mbps Wireless Netgear ADSL Firewall
Router DG834G as access point However, there are good chances, that this hint
may also be applied to other PC's with other drivers. If you cannot obtain a
native Linux driver for your wireless NIC, you may want to try 'ndiswrapper', a
package that will allow to load a Windows driver under Linux.

The kernel compiled is version 2.6.18. This kernel includes already an  'old' 
driver ipw2200 and a iee802 subsystem, which should not be enabled, as they are
beeing provided separate.

Additional instructions are given, how to operate a PC in a wireless field under
a DHCP Server ( Dynamic Host Configuration Protocol ) providing  IP's to the
clients. This is the probably situation which will be found in most public
locations, like airports, hotels etc. 

HINT:

KERNEL

Download:
	Kernel v. 2.6.18
	http://www.kernel.org

Configuring the kernel:

	enable Networking->
		Networking support->
			Networking options->
				Packet socket
				TCP/IP networking
	device drivers->
		Network device support->
			Wireless LAN (non-harmradio)->
				Wireless LAN drivers & Wireless Extensions
	cryptographic optionsI->
		ARC4 cipher algorithm (Modul)

Make sure, that the following capabilities are not enabled:

	networking->
		Generic IEE 802.11 Networking Stack
	device drivers->
		Network device support->
			Wireless LAN ( non-hamradio ) ->
				Intel PRO/Wireless 2200BG and
				2915ABG network 
compile and install the kernel according to the instructions of the book 'Linux
From Scratch'

HOTPLUG-2004_09_23

Scripts that react upon hotplug events generated by the kernel
Download:
	hotplug-2004_09_23.tar.bz2
	http://www.kernel.org/pub/linux/utils/kernel/hotplug

Install hotplug issuing a 'make install' in the untared directory.

IEE80211-1.2.15

Kernel subsystem dealing with communications security

Download
	ieee80211-1.1.15.tgz
	http://ieee80211.sourceforge.net
Untar the file, change to the ieee80211-1.1.15 directory and enter make, make
install. 
Includes headerfiles in /lib/modules/2.6.18/net

INTEL'S PRO/WIRELESS DRIVER AND FIRMWARE

Download  the file 
	ipw2200_linux_1_2_0.tgz
	http://ipw2200.sourceforge.net
Unter the file. Two new tar files will be included in the new created 
'intel_ipw2200_120' directory: ipw2200-1.2.0.tgz, the PRO/Wireless driver, and
ipw2200-fw-3.0.tgz, the firmware. 

Untar the firmware file in the directory /lib/firmware. Four files
ipw-2200-xxx.fw will be found there after untaring

Untar the PRO/Wireless driver file, change to the ipw2200-1.2.0 directory and
enter make, make install. ( as su )

The driver requires the firmware image as well as the ieee80211 module
installed. sysfs should be  already mounted

See also the INSTALL file for more instructions

THE WIRELESS TOOLS 

Set of tools that allows to manipulate Wireless Extensions
Download the wireless tools:
	wireless_tools.28.tar.gz
	http://pcmcia-cs.sourceforge.net/ftp/contrib/
Untar the file, change to the wireless_tools.28 directory and enter make, make
install
Seven tools will be installed in /usr/local/sbin: iwconfig, iwlist,
ifrename,iwevent,iwgetid, iwpriv and iwspy
Make a link from KDE_Prefix/bin to /usr/local/sbin: 
	ln -s /usr/local/sbin/iwconfig KDE_Prefix/bin/iwconfig

THE DHCPCD CLIENT SOFTWARE

Software to connect a computer to a network which uses DHCP to assign network
addresses.There are two alternatives: dhcp, which includes also the server
software, and dhcpcd, an implementation of the DHCP client specified in RFC2131.
I prefered  dhcpcd, wich seems to be more simple.
Download 
	dhcpcd-2.0.8.tar.bz2
	http://prdownload.berlios.de/dhcpcd/
Untar, change to the dhcpcd-2.0.8 directory and enter
	./configure --prefix="" --mandir=/usr/share/man
	make
	and, as superuser, make install, and
	chmod -v 754 /etc/dhcpc/dhcpcd.exe.
The reason for the prefix "" in the configuration command is explained in the
blfs-book, version svn-20061028, chapter 14. 
Install the network service script
/etc/sysconfig/network-devices/services/dhcpcd  and create
/etc/sysconfig/network-devices/ifconfig.eth1/dhcpcd configuration file as
indicated in the same place
	
BOOTING THE PC

If everything went right, the PC boots and loads firmware and wireless-driver.
The corresponding booting  messages will look like
	........
	ieee80211_crypt: registered algorithm 'NULL'
	ieee80211: 802.11 data/management/control stack, 1.1.6
	ieee80211: Copyright (C) 2004-2005 Intel Corporation
		<jketreno@linux.intel.com>
	ipw2200: Intel(R) PRO/Wireless 2200/2915 Network Driver, 1.0.8
	ipw2200: Copyright(c) 2003-2005 Intel Corporation
	ACPI: PCI Interrupt Link [LNKG] enabled at IRQ 10
	ACPI: PCI Interrupt 0000:01:02.0[A] -> Link [LNKG] -> GSI 10 (level,
		low) -> IRQ 10
	ipw2200: Detected Intel PRO/Wireless 2200BG Network Connection
	Detected geography ZZM (11 802.11bg channels, 0 802.11a channels)
	.........

MONITORING PROGRAMS

There are many prrograms that allows the monitoring of wireless communications.
I installed two of them: 'Wireshark' ( former ethereal ) and 'KWiFiManager'.

'wireshark' is a powerfull  network protocol analyser ( packet sniffer ). 
Download 'wireshark-0.99.4.tar.gz' from http://www.wireshark.org/download/src
Untar the file and run ./configure, make and make install.

'kwifimanager' is a KDE frontend program used to configure and monitor wireless
LAN cards. 'kwifimanager' is part of 'kdenetwork'. Download
kdenetwork_3.4.1.tar.bz2 and follow the instructions given e.g. In BLFS -
Version 6.1, chapter 29. Wireless tools should be installed before building this
packet.

CONFIGURING THE ROUTER -  SAFETY CONSIDERATIONS

during the installation of the wireless system, the safety options of the router
are deactivated. Now, it is time to activate them. Access the settings menu of
the router through a browser, entering something like http://192.168.0.1. I
activated WEP ( Wired Equivalent Privacy ) with  64 bit encryption. You may
consider a 125 bit encryption

Enter a password in the encryption field, and the router will generate four
keys, each one consisting of 10 characters, combining numbers 1 to 9 and letters
A-F, like:EC670531BE. The first of this four keys is the one beeing normally
used.

Furthermore, the MAC-addresses ( Media Access Control ) of the laptop's and PC's
wich are allowed to access the router shoud be entered in the access list
'trusted wireless stations'. You may get the MAC addresses  from the list of
connected devices in the settings menu of the router or with the help of a
network exploration tool like 'nmap' ( Network Mapper ), in  the last case e.g.
entering 'nmap -sP 192.168.0.1/22'

However, even a 125 bit encryption does not give a real security today.
According to a note contributed by Bryan Kadzban,  real security can only be
obtained with WPA or WPA2 encryption. You may want to consider this, if you have
confidential data to transmit.

CONFIGURING THE PC FOR WIRELESS COMMUNICATIONS

immediately after the safety options of the router are activated, the PC will
not more be able to see the access point: the PC also needs to be configured. 
Entering the command 'iwconfig eth1 key xxxxxxxxxx'  enables the communication,
but not permanently. For a permanent configuration, write a shell-script
e.g.'connect' in /etc/rc.d/init.d:
	$!/bin/sh
	/usr/local/sbin/iwconfig eth1 key xxxxxxxxxx
and make this script executable: chmod ug+x connect. Make a symbolic link in
/etc/rc.d/rc3.d that points to this script: ln -s /etc/rc.d/init.d/connect
S19connect. The link should start with something like S19, as the script should
be run before the S20network script is executed. For an unencrypted system,
likely to be found on public places, the command in the script should not
contain a key:
	/usr/local/sbin/iwconfig eth1

Create a directory 'ifconfig.eth1' in '/etc/sysconfig/network-devices', and cd
to this directory. 
For operation withouth DHCP create a ipv4 file:
	ONBOOT=yes
	SERVICE=ipv4-static
	IP=192.168.1.3			// the address of your box
	GATEWAY=192.168.1.9		// the address of your router
	PREFIX=24
	BROADCAST=192.168.1.255
	NETMASK=255.255.255.0
and change GATEWAY_IF in /etc/sysconfig/network to eth1.

For operation with DHCP create instead ipv4 a file dhcpcd:
	ONBOOT="no"
	SERVICE="dhcpcd"
	DHCP_START="eth1 -t 20"
	DHCP_STOP="-k "

	# Set PRINTIP="yes" to have the script print
	# the DHCP assigned IP address
	PRINTIP="yes"

	# Set PRINTALL="yes" to print the DHCP assigned values for
	# IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
	PRINTALL="no"

USING THE WIRELESS CONNECTION 

After booting, lsmod shows
	Module		Size		Used by
	ipw2200		170244		0
	ieee80211	  45356		1  ipw2200 
	ieee80211_crypt	    4512	1  ieee80211_crypt_wep,
						ieee80211

The command 'iwconfig eth1' entered in a console delivers
		eth1      IEEE 802.11g  ESSID:"Mannheim"  
        	Mode:Managed  Frequency:2.462 GHz  Access Point:
				00:0A:B5:CF:64:28   
          	Bit Rate=48 Mb/s   Tx-Power=20 dBm   Sensitivity=8/0
          	Retry limit:7   RTS thr:off   Fragment thr:off
          	Encryption key:57E4-DB3A-B1   Security mode:open
          	Power Management:off
          	Link Quality=95/100  Signal level=-29 dBm  Noise level=-86 dBm
          	Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          	Tx excessive retries:0  Invalid misc:0   Missed beacon:0
As the ONBOOT parameter was set to 'yes', the connection to the access point is
already activ.

The internet browser should be configured with direct access to the internet.
Opening the browser should establish immediately a connection.

USING THE WIRELESS CONNECTION UNDER A DHCP SERVER

I experienced some problems starting the dhcpcd daemon during the boot process.
So I decided to set the ONBOOT parameter in the file
/etc/sysconfig/network-devices/ifconfig.eth1/dhcpcd to 'no', as indicated above,
and to start as 'su' a little script 'eth1_connect' :
	#!/bin/bash
	/sbin/dhcpcd eth1
	# end
After starting the daemon dhcpcd, the connection to the access point is activ.

AKNOWLEDGEMENTS:	  

I have tryed to compile articles, informations, hints and answers to questions I
put in the BLFS-mailing list to this hint. Many thanks to all those who
contributed: Gabe Yoder, Andrew Benton, Alexander E. Patrakov, Jim Gifford,
David Fix, Rainer Peter Feller, Chris Staub, Randy McMurchy,
Jeremy Monnet, Stefan Krah, Bryan Kadzban.


LINKS AND LITERATURE:

Intel PRO/Wireless driver
http://ipw2200.sourceforge.net						

Linux Wireless Networking 	
http://www.linuxhomenetworking.com/linux-hn/wmp11-linux.html

Wireless LAN Resources for Linux
http://www.hpl.hp.com/personal/jean_Tourrilhes/Linux/Tools.html

Wiresharkt
http://www.wireshark.org/

The devices, the drivers... Jean Tourrilhes
http://www.hpl.hp.com/personal/jean_Tourrilhes/Linux/Linux.Wireless.drivers.802.
1.11ag.html#CentrinoAG

Sane network interface management with Hotplug. Jean Tourrilhes
http://www.hpl.hp.com/personal/jean_Tourrilhes/Linux/HOTPLUG.txt

ndiswraper
http://ndiswrapper.sourceforge.net/mediawiki/index.php/Installation

CHANGELOG:

[2006-03-26]

 Remarks concerning safety considerations
 Additional notes concerning DHCP-Server operation
 Chapter "The DHCPCD Client Software" 
 Configuring the PC for operation under DHCP 
 Subsystem IEE80211-1.1.6 changed to IEE80211-1.1.12
 Intel PRO/WIRELESS driver ipw2200-1.0.8 changed to ipw2200-1.0.10
 Using the wireless connection under a DHCP server

[2006-12-10]

 Kernel version 2.6.18
 Kernel configuration changed
 Hotplug instructions changed
 UDEV is now part of the system
 ieee80211 version changed to 1.2.15
 New versions of Intel's PRO/Wireless driver and firmware
 Wireless tools version 28
 dhcpcd  version 2.0.8 
 new message booting the PC
 'Kismet' skipped,  'wireshark' introduced
 Links and literature changed