Thursday, March 11, 2004

Wireless Setup (WPC11V4) in RedHat Linux

Occasionally I worked in Middlesex college with my Dell Inspiron 8100 notebook, but I couldn't get the wireless connection there with my Linux bootup (Redhat 9.0 with kernel 2.4.20). It's Linksys Wireless-B network card (WPC11 V4). Notice the WPC11 V4 network card has different chipset (Realtek 8180) from previous models that are based on prism2. Getting some wireless cards to work in Linux is not a trivial thing, and I spent a couple of days fiddling around how it work. A good link about wireless LAN resources for Linux comes from Jean Tourrilhes' excellent wireless collection.

Go to Realtek's dowload website, search for 8180L driver. There is one for Linux kernel 2.4.20. Download and unzip it. Compile it as a root user, there will be a driver file named "rtl8180-24x.o" created when there were no errors. If there were something wrong, it might be caused by a messed up kernel, or source that doesn't match the kernel you are running. You have to download a new kernel (2.4.20-8) and compile the kernel. When the driver file is created, copy it to the system's module library:

[root]# cp rtl8180_24x.o /lib/modules/`uname -r`/kernel/drivers/net/wireless/
[root]# cardctl insert
[root]# depmod -ae
[root]# modprobe rtl81880_24x
[root]# cardctl ident
Socket 0:
no product info available
Socket 1:
product info: "Realtek", "Rtl8180"
manfid: 0x0000, 0x024c
function: 6(network)
[root]#

Now the device is recognized. To boot it up in the wireless network, we have to do some configuration work. Here is my script to enable the wireless card:

[huang]$ cat /etc/init.d/wlanup
# Load wireless lan driver
#/sbin/insmod -f rtl8180_24x.o
/sbin/modprobe rtl8180_24x

# Work as AP mode & Assign SSID and operation channel.
# Channel 1, 2, 10 are working fine in UWO
/sbin/iwpriv wlan0 wlan_para ssid=uwo
/sbin/iwpriv wlan0 wlan_para ssid2scan=uwo
/sbin/iwpriv wlan0 wlan_para channel=2

# Configure WEP. UWO doesn't use it, a "blue socket" instead
/sbin/iwpriv wlan0 wlan_para encmode=off
/sbin/iwpriv wlan0 wlan_para wepmode=off

# Configure debugging message
/sbin/iwpriv wlan0 msglevel 0


# Enable wireless lan driver
/sbin/iwpriv wlan0 enable
sleep 2

# Get IP address from DHCP server
/sbin/dhclient -1 -q -lf /var/lib/dhcp/dhclient-wlan0.leases \
-pf /var/run/dhclient-wlan0.pid wlan0
echo "$(/sbin/ifconfig wlan0)"
[huang]$

Notice in UWO's campus wireless network, the WEP (Wired Equivalent Privacy) is disable, instead, the school's username and password are used for authentication. The SSID (Service Set Identifier) is lowercase "uwo". After run the wlanup script, a network IP address of the wireless card would show up if the connection is established. To shutdown the connection, another script is used:

[huang]$ cat /etc/init.d/wlandown
# Shut down wlan0 net interface
/sbin/ifconfig wlan0 down

# Disable wireless lan driver
/sbin/iwpriv wlan0 disable
# Unload module
/sbin/rmmod rtl8180_24x
[huang]$ su -
[root]# cardctl eject

Finally, we add a file named "S99wireless" with one line of "/etc/init.d/wlanup" into "/etc/rc.d/rc3.d/" directory, then the script would run automatically during Linux's booting up.