May 10, 2007, 9:59 a.m.
posted by whitehat
Networking with Linux-WLANLinux-WLAN is one of the original wireless LAN products developed for Linux. It is generally more difficult to install than Wireless Tools and has fewer troubleshooting tools, but it does have wide ranging hardware support, making it a desirable alternative based on the NIC card you have available. You'll notice that Linux-WLAN uses the term SSID instead of ESSID in its configuration files. Linux-WLAN PreparationHere are some pointers you'll need to remember prior to using the Linux-WLAN product:
Identifying the Correct RPMsYou can find RPM versions of the driver files at http://prism2.unixguru.raleigh.nc.us. Remember to download the files for the correct kernel type, OS version, and kernel version. Downloading and installing RPMs isn't hard. If you need a refresher, Chapter 6, "Installing RPM Software," covers how to do this in detail. Determine the Kernel TypeUse the uname -p command. The Bigboy server discussed in Chapter 1, "Why Host Your Own Site," is running an i686 version of Linux. The Linux version may not match the CPU you have installed, always use the uname version:
[root@bigboy tmp]# uname -p
i686
[root@bigboy tmp]#
Determine the OS VersionOne of the easiest ways to determine the OS version is to view the /etc/ redhat-release or the /etc/fedora-release file. In this case, server Bigboy is running Red Hat version 9.0, while Zero is running Fedora Core 1. You can also look at the /etc/issue file for other versions of Linux.
[root@bigboy tmp]# cat /etc/redhat-release
Red Hat Linux release 9 (Shrike)
[root@bigboy tmp]#
[root@zero root]# cat /etc/fedora-release
Fedora Core release 1 (Yarrow)
[root@zero root]#
Determine the Kernel VersionYou can use the uname -r command to figure out the kernel version. In this case, Bigboy is running version 2.4.20-8:
[root@bigboy tmp]# uname -r
2.4.20-8
[root@bigboy tmp]#
Installing the RPMsAfter you have all this Linux information, you need to download and install the base, module, and interface packages. When searching for the RPMs, remember that the filename usually starts with the software package name by a version number:
kernel-wlan-ng-0.2.1-pre14.i686.rpm
kernel-wlan-ng-modules-fc1.1.2115-0.2.1-pre14.i686.rpm
kernel-wlan-ng-pci-0.2.1-pre14.i686.rpm
kernel-wlan-ng-pcmcia-0.2.1-pre14.i686.rpm
Notice the sequence of installation in this sample output. Double-check your preparation steps and the RPM versions if the very last line of the installation gives a result code that is not success.
[root@bigboy tmp]# rpm -Uvh kernel-wlan-ng-0.2.1-pre14.i686.rpm
Preparing... #####################################
[100%]
1:kernel-wlan-ng #####################################
[100%]
[root@bigboy tmp]# rpm -Uvh kernel-wlan-ng-modules-fc1.1.2115-0.2.1-
pre14.i686.rpm
Preparing... #####################################
[100%]
1:kernel-wlan-ng-modules-#####################################
[100%]
[root@bigboy tmp]#
[root@bigboy tmp]# rpm -Uvh kernel-wlan-ng-pcmcia-0.2.1-pre14.i686.rpm
Preparing... #####################################
[100%]
1:kernel-wlan-ng-pci #####################################
[100%]
Adding prism2_pci alias to /etc/modprobe.conf file...
***NOTE*** YOU MUST CHANGE THIS IF YOU HAVE A PLX CARD!!!
The default wlan0 network configuration is DHCP. Adjust accordingly.
ACHTUNG! ATTENTION! WARNING!
YOU MUST configure /etc/wlan/wlan.conf to define your SSID!
YOU ALSO must configure /etc/wlan/wlancfg-SSID to match WAP
settings!
(---> replace SSID in filename with the value of your SSID)
If you get an error after this point, there is either a problem with
your drivers or you don't have the hardware installed! If the former,
get help!
Starting WLAN Devices:message=dot11req_mibset
mibattribute=dot11PrivacyInvoked=false
resultcode=success
message=dot11req_mibset
mibattribute=dot11ExcludeUnencrypted=false
resultcode=success
[root@bigboy tmp]#
Linux-WLAN Post Installation StepsAfter the RPMs are installed, you need to configure the new wlan0 wireless NIC to be compatible with your network. Configure the New wlan0 InterfaceEdit /etc/sysconfig/network-scripts/ifcfg-wlan0 to include these new lines:
DHCP Version Fixed IP Version
============ =================
DEVICE=wlan0 DEVICE=wlan0
USERCTL=yes IPADDR=192.168.1.100
ONBOOT=yes NETMASK=255.255.255.0
BOOTPROTO=dhcp ONBOOT=yes
BOOTPROTO=static
In the fixed IP version you also need to substitute your selected IP, netmask, network, and broadcast address with those above. Plus, make sure you have the correct gateway statement in your /etc/sysconfig/network file, for example. GATEWAY[eq]192.168.1.1. Disable Your Existing Ethernet NICYou may want to disable your existing eth0 Ethernet interface after installing the drivers. Add an ONBOOT=no entry to the /etc/sysconfig/networkscripts/ifcfg-eth0 file. This disables the interface on reboot or when /etc/init.d/network is restarted. Select the Wireless Mode and SSIDAll the configuration files are located in the /etc/wlan directory. The package allows your server to be connected to up to three wireless LANs. You specify the SSIDs (LAN IDs) for each wireless LAN in the /etc/wlan/wlan.conf file. In the example, I make the wlan0 interface join the homenet WLAN, as well as instruct the WLAN driver to scan all wireless channels for SSIDs.
#
# Specify all the wlan interfaces on the server
#
WLAN_DEVICES="wlan0"
#
# Specify whether the server should scan the network channels
# for valid SSIDs
#
WLAN_SCAN=y
#
# Specify expected SSIDs and the wlan0 interface to which it should
# be tied
#
SSID_wlan0="homenet"
ENABLE_wlan0=y
Each WLAN specified in the /etc/wlan/wlan.conf file has its own configuration file. Copy the /etc/wlan/wlancfg-DEFAULT file to a file named /etc/wlan/wlancfg-SSID (replace SSID with the actual SSID for your WAP). This line configures for the homenet SSID:
[root@bigboy wlan]# cp wlancfg-DEFAULT wlancfg-homenet
Start Linux-WLANStart the wlan process and test for errors in the file /var/log/messages. All the result codes in the status messages should be success. You may receive the following error, however, which the WLAN RPM Web site claims is "harmless."
Error for wireless request "Set Encode" (8B2A) :
SET failed on device wlan0 ; Function not implemented.
Error for wireless request "Set ESSID" (8B1A) :
SET failed on device wlan0 ; Function not implemented.
With PCI cards, you can restart Linux-WLAN by restarting the WLAN daemon:
[root@bigboy tmp]# service wlan restart
[root@bigboy tmp]# ifup wlan0
With PCMCIA cards, you can start Linux-WLAN by restarting the Linux PCMCIA daemon:
[root@bigboy tmp]# service pcmcia restart
[root@bigboy tmp]# service network restart
Testing Linux-WLANNow check to see if the IP address of the wlan0 interface is okay. Refer to the upcoming troubleshooting section if you cannot ping the network's gateway.
[root@bigboy tmp]# ifconfig -a
[root@bigboy tmp]# ping <gateway-address>
Linux-WLAN Encryption for SecurityOne of the flaws of wireless networking is that all the wireless clients can detect the presence of all available network SSIDs and have the option of joining any of them. With encryption, the client must have a membership encryption password that can also be represented as a series of Wireless Encryption Protocol (WEP) keys. The wlan.conf file (Red Hat 8.0 RPMs), wlan-SSID file (Red Hat 9/Fedora Core 1 RPMs), or /etc/pcmcia/wlan-ng.opts file (PCMCIA-type NICs) is also used to activate this feature.
To invoke encryption, you have to set the dot11PrivacyInvoked parameter to TRue. You also must state which of the keys will be used as the default starting key via the dot11WEPDefaultKeyID parameter. You then have the option of either providing a key-generating string (simple password) or all four of the keys. In the example below, ketchup is the password used to automatically generate the keys.
#=======WEP===========================================
# [Dis/En]able WEP. Settings only matter if PrivacyInvoked is true
lnxreq_hostWEPEncrypt=false # true|false
lnxreq_hostWEPDecrypt=false # true|false
dot11PrivacyInvoked=true
dot11WEPDefaultKeyID=1
dot11ExcludeUnencrypted=true # true|false, in AP this means WEP
# is required for all STAs
# If PRIV_GENSTR is not empty, use PRIV_GENTSTR to generate
# keys (just a convenience)
PRIV_GENERATOR=/sbin/nwepgen # nwepgen, Neesus compatible
PRIV_KEY128=false # keylength to generate
PRIV_GENSTR="ketchup"
# or set them explicitly. Set genstr or keys, not both.
dot11WEPDefaultKey0= # format: xx:xx:xx:xx:xx or
dot11WEPDefaultKey1= # xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
dot11WEPDefaultKey2= # e.g. 01:20:03:40:05 or
dot11WEPDefaultKey3= # 01:02:03:04:05:06:07:08:09:0a:0b:0c:0d
Not all devices on your network will use the same algorithm method to generate the encryption keys. You may find the same generator string will not create the same keys, rendering intra-network communication impossible. If this is the case, you can use the /sbin/nwepgen program to generate the keys after you provide an easy to remember key generator string. Once you have the four sets of keys, you'll have to add them individually and in sequence to the wlan.conf, wlan-SSID or /etc/pcmcia/wlan-ng.opts file and set the PRIV_GENSTR parameter to a null string of "" (the quotes are important). Here is how you can use nwepgen to create the keys with a generator string of ketchup.
[root@bigboy tmp]# /sbin/nwepgen ketchup
64:c1:a1:cc:db
2b:32:ed:37:16
b6:cc:9e:1b:37
d7:0e:51:3f:03
[root@bigboy tmp]#
In this case, your wlan.conf or wlan-SSID file would look like this:
PRIV_GENSTR=""
# or set them explicitly. Set genstr or keys, not both.
dot11WEPDefaultKey0= 64:c1:a1:cc:db
dot11WEPDefaultKey1= 2b:32:ed:37:16
dot11WEPDefaultKey2= b6:cc:9e:1b:37
dot11WEPDefaultKey3= d7:0e:51:3f:03
Remember that all devices on your network, including all wireless NICs and WAPs, need to have the same keys and default key for this to work. De-activating EncryptionIn some cases, NICs without full Linux-WLAN compatibility freeze up after a number of hours of working with encryption. The steps to reverse encryption are: If you fail to reload the driver modules, you'll get errors in your /var/log/messages file and your NIC card will operate in an encrypted mode only:
Jan 2 18:11:12 bigboy kernel: prism2sta_ifstate: hfa384x_drvr_start()
failed,result=-110
Jan 2 18:11:18 bigboy kernel: hfa384x_docmd_wait: hfa384x_cmd
timeout(1), reg=0x8021.
Jan 2 18:11:18 bigboy kernel: hfa384x_drvr_start: Initialize command
failed.
Jan 2 18:11:18 bigboy kernel: hfa384x_drvr_start: Failed, result=-110
|
- Comment