teh bigbro blog(tm)
Bigbro's foray into the scary world of blogging
Thu, 23 Jun 2005
Wireless 802.11g on Linux
I have a Belkin 54g 802.11g WiFi card that has been running happily under Windows, providing me with internet connectivity for my x86 laptop. While the laptop is dual boot (Linux is my development platform of choice and the laptop has Fedora Core 3 installed) I've only just got around to getting wireless working on it. While it was not simple, neither was it particularly difficult. Complete instructions follow:
How to get Wireless networking under Linux working with a Belkin 54g card:
- Get ndiswrapper - unfortunately, the Belkin 54g card uses a Broadcom chipset so the only way I've found to make it work is by using the Windows driver and ndiswrapper.
- Untar the ndiswrapper package. Obviously, change the filename to reflect the version number you download (tar -xzvf ndiswrapper-1.2.tar.gz)
- Move into the created directory (cd ndiswrapper-1.2)
- Make the package (make)
- You may discover at this point that ndiswrapper refuses to build itself if you're using a stock RedHat kernel with a 4K stack. I used the opportunity to upgrade to a 2.6.12 kernel from kernel.org.
- I cheated and used the config file (You'll find them in /boot) for the most recent stock Redhat 2.6.11-something kernel. Setting CONFIG_4KSTACKS=n or simply commenting the line out will tell the kernel build not to use the 4kB stack.
- Build and install the kernel in the usual fashion (make && make modules_install && make install) (There's probably a shorter way to do this...)
- 'Manage' grub so that it boots into the new kernel and reboot.
- You will need to cd into the ndiswrapper-1.2 directory and rerun make if it failed with the first time.
- When it's compiled, install it. (As root : make install) All further steps need to be run with root privileges as network configuration is a security critical part of the kernel.
- Install the windows driver. I had the CD that came with the card, but once you have the .inf and associated files, you should be able to do it from any location. (From the included CD: ndiswrapper -i /media/cdrom/Driver/bcmwl5.inf)
- You'll probably want to check that driver is installed and the hardware found. Fortunately, ndiswrapper -l checks that things are working as expected. Output something similar to Installed ndis drivers: bcmwl5 driver present, hardware present should be good.
- I'll assume you have an Access Point (Commonly called a wireless router) and that you have set up a network with ESSID "wifinet". You can get a list of available Access Points using iwlist wlan0 scanning.
- You'll be wanting to set your WiFi card to be in 'Managed' mode, in other words, use an access point. (iwconfig wlan0 mode managed) If you don't have an access point you can use Adhoc mode instead of managed, but I'll not talk about that in this instruction set in order to keep things brief.
- Connect to your access point. (iwconfig wlan0 essid "wifinet")
- You'll be most likely using some WEP keying. You'll probably want to insert your own key here rather than using the one I've just made up. (iwconfig wlan0 key restricted 1234567890ABCDEF1234567890) iwlist wlan0 key will list the keys as known to the driver for the interface.
- Adding ndiswrapper as an alias to modprobe is probably a good idea. The ndiswrapper script allows you to do this with ndiswrapper -m.
- Finally, you'll want to bring up your wlan interface and configure it for connection to an IP network. If you use DHCP you can do a simple dhclient wlan0 - otherwise, you'll need to configure it using ifconfig as per any other ethernet interface. If you're not using DHCP, you'll need to set up some DNS and some routing as well, most likely.
- I wanted to bring up the wlan interface on boot-up, so I made the following script, which I call from /etc/rc.local
#!/bin/sh
modprobe wlan0
iwconfig wlan0 mode managed
iwconfig wlan0 essid "myWiFiLAN"
iwconfig wlan0 key restricted 1234567890ABCDEF1234567890
dhclient wlan0
Huge thanks to dsmith and David Crumps for their postings on how to use ndiswrapper for Wireless networking under Linux. My mini-howto above is based very heavily on their published work - thanks guys :-)
posted at: 02:59 | path: /technical | permanent link to this entry

copyright © 2005-2008, Gareth Eason