If you’re in the market for a new Linux computer, you might want to consider a laptop. Many modern 32- and 64-bit laptops rival the performance of traditional desktops, and some can be configured to offer comparable sound, graphics, and storage. Better yet, laptops are eminently portable — just try to put a tower in your briefcase or carry-on luggage.
Of course, once you have a laptop, you won’t want to be tethered to a wired Internet connection, a desk, or even an office. Luckily, given the right wireless card or a little bit of software and some patience, you and your Linux laptop will be as free as a certain chilly bird.
For Linux use, there are two kinds of wireless devices: those that have a Linux driver and those that don’t.
If you’re lucky, the wireless card you own is compatible with Linux (an extensive list of Linux-compatible devices can be found online at
http://linux-wireless.org/Drivers/). Simply follow the instructions included with the driver and enjoy computing in the great outdoors.
Otherwise, you may be able to use a
Windows- compatible wireless card by installing a special Linux kernel module called
ndiswrapper (
http://ndiswrapper.sourceforge.net/). ndiswrapper loads off-the-shelf Windows
Network Driver Interface Specification (NDIS) drivers and acts as a translator between the NDIS driver and the Linux kernel. Because so many cards are compliant with NDIS, ndiswrapper can host most (but not all) Windows wireless devices. The ndiswrapper Wiki (
http://ndiswrapper.sourceforge.net/mediawiki/index.php/Main_Page) recommends card and driver combinations that function particularly well with Linux.
Have Penguin, Will Travel
Let’s see what it takes to get wireless working on Linux. For this article, the test platform is an Acer Aspire 5020 laptop with a built-in PCI wireless card. Other wireless cards use USB or PCMCIA, yet configuring those types of cards is substantially similar.
There are two steps to installing a wireless card in Linux. In order, you must install software to configure the card and connect to a wireless network, and you must install the card’s driver (perhaps using ndiswrapper).
Before you install any wireless packages, ensure that the CONFIG_NET_RADIO extension is enabled in your kernel. Without it, you won’t be able to configure your wireless device. Most vendor kernels enable this option by default. If you have your own custom-built kernel, enable this option in the kernel coniguration menu, found in “Device Drivers& gt; Network Device Support& gt; Wireless LAN (non-hamradio) & gt; Wireless LAN drivers (non-hamradio) & amp; Wireless Extensions.”
Once you’ve booted a capable kernel, you can install the Wireless Tools. The package is offered as an
RPM, or if you have a Debian system, you can install it quickly with
apt-get install wireless-tools. Alternatively the source for Wireless Tools can be downloaded from
http://pcmcia-cs.sourceforge.net/ftp/contrib/wireless_tools.27.tar.gz. Compilation and installation is as easy as:
$ tar xzf wireless_tools.27.tar.gz
$ cd wireless_tools.27
$ make
$ sudo make install
sudo make install adds the utilities iwconfig, iwlist, iwpriv, iwspy, iwgetid, iwrename, and iwevent to your system. Let’s return to these utilities after installing ndiswrapper and your driver.
Using ndiswrapper
Unless you found a Linux driver written for your wireless networking card, it’s worthwhile to try your card with ndiswrapper.
Installing ndiswrapper is a little involved, because part of the software is closely tied to the kernel. The ndiswrapper wiki recommends kernel 2.6.6 or newer, or kernel 2.4.26. Use uname –r to find the version number of your kernel. Building ndiswrapper from source is recommended, but a number of web sites offer pre-built packages for a number of kernel versions.
$ tar xzvf ndiswrapper-1.8.tar.gz
$ cd ndiswrapper-1.8/
$ make distclean
$ make
$ sudo make install
make install copies the ndiswrapper module to /lib/modules/ linux-version /misc/ndiswrapper.ko and places the ndiswrapper utilities, ndiswrapper and loadndisdriver, in /usr/sbin/.
The next step provides a suitable Windows driver to ndiswrapper.
To ensure you provide a workable correct driver, start by examining your card’s chip set. Use the lspci command:
# lspci
…
0000:06:05.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)
On the test system, the wireless card uses a Broadcom BCM4318 chip set. For any given chip set, drivers are normally available from the laptop or card vendor’s web site. (In this case. the driver is available from Acer’s website in Taiwan.) Ideally, you should use the Windows XP driver for your card, although drivers for other version of Windows are known to work fine. And if you’re running a 64-bit kernel, you need to have the 64 bit Windows drivers also — you can’t mix and match 32- and 64-bit software at this level.
Assuming that you have the correct driver, you can install it with the ndiswrapper utility.
# ndiswrapper –i bcmwl5.inf
Installing bcmwl5
…
(Change bcmwl5.inf to the name of the Windows INF file included with your driver.) Next, run ndiswrapper –l to verify that the driver has been installed properly:
# ndiswrapper –l
Installed ndis drivers:
bcmwl5 driver present, hardware present
Now, add an alias wlan0 for the ndiswrapper module to /etc/modprobe.conf:
# ndiswrapper –m
Update your modules dependencies file:
# depmod –a
And now you are ready to load the wireless driver:
# modprobe ndiswrapper
Check /var/log/messages or run dmesg to check if the driver loaded successfully:
~ # dmesg
…
ndiswrapper version 1.8 loaded (preempt=no,smp=no)
ndiswrapper: driver bcmwl5 () loaded
wlan0: ndiswrapper ethernet device 00:0e:9b:c4:xx:xx using driver bcmwl5, 14E4:4318.5.conf
The last line above indicates that the card works with the loaded driver.You can now use the Wireless Tools you installed previously to connect to a wireless network.
Connecting to a Network
Whether your driver is native or runs via ndiswrapper, the steps to configure your wireless card from here on are the same: use iwconfig to specify the wireless network you’d like to connect to, and use iwlist to scan for wireless networks.
To begin, run iwconfig to acknowledge your wireless card. Its output likely resembles Figure One. As shown, the wireless card is recognized but isn’t yet configured.
Next, scan for wireless networks with iwlist. Simply pass iwlist the name of the wireless card you wish to use, typically wlan0:
~ # iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 00:14:6C:22:97:04
ESSID:”Home”
Protocol:IEEE 802.11g
…
Bit Rate:36 Mb/s
Bit Rate:48 Mb/s
Bit Rate:54 Mb/s
Extra:bcn_int=100
Extra:atim=0
You should see the wireless network you wish to connect to listed. Here, the network is called Home.
To connect to a wireless network, use iwconfig with the proper parameters. Once you have the correct settings entered, you can save the iwconfig configuration to a file to load at boot time.
Continuing the example, the access point to connect to is called Home, it uses channel 3, and access is protected with an open WEP encryption key of 3c088000210810324100568800, where the key corresponds to key one of the network keys; and uses wireless channel 3. iwconfig has many options:
# iwconfig –h
Usage: iwconfig interface [essid {NN|on|off}]
[nwid {NN|on|off}]
[mode {managed|ad-hoc|…}
[freq N.NNNN[k|M|G]]
[channel N]
[ap {N|off|auto}]
[sens N]
[nick N]
[rate {N|auto|fixed}]
[rts {N|auto|fixed|off}]
[frag {N|auto|fixed|off}]
[enc {NNNN-NNNN|off}]
[power {period N|timeout N}]
[retry {limit N|lifetime N}]
[txpower N {mW|dBm}]
[commit]
To connect to Home, type:
# iwconfig wlan0 essid Home
mode managed
enc 3c088000210810324100568800
open channel 3
You can also view your settings with iwconfig. Figure Two is exemplary.
You can now bring the wlan0 interface up using ifconfig, and can assign an IP address to the interface. The command dhcpcd is helpful to obtain an address via the Dynamic Host Control Protocol (DHCP).
# ifconfig wlan0 up
# dhcpcd wlan0
(Depending on which distribution you use, dhcpcd may be called dhclient.)
The interface should now be configured and ready to use on the network, as shown in Figure Three.
Starting Wireless at Boot
Now that you’ve successfully configured your wireless card, you probably want to enable the connection each time you boot Linux. The steps shown here work for Gentoo; similar steps are necessary on other distributions.
1.Ensure that the ndiswrapper module is loaded on boot. If you’re using Gentoo Linux, add ndiswrapper to the modules autoload file:
# echo "ndiswrapper" >> /etc/modules.autoload.d/kernel-2.6
2.Use ifconfig to bring your card” up” when you enter an appropriate runlevel. Assign the interface a static IP address or use DHCP to acquire one. Typically, you can just copy the configuration file of an existing interface, renaming it to match the name of your wireless interface.
# cp /etc/init.d/net.eth0 /etc/init.d/net.wlan0
3.Finally, you must store the wireless networking configuration. On Gentoo, the settings are kept in /etc/conf.d/net:
# wireless configuration
modules=( “iwconfig” )
essid_wlan0=”Home”
channel_wlan0=”1″
mode_wlan0=”managed”
key_Home=”[1] 3c088000210810324100568800 [1] enc open”
The first line contains the name of the utility used to configure wireless, iwconfig. If, for example, you wished to use the wpa-supplicant utility, you would specify this here. If you set the essid_wlan0 entry to any, your wireless card will attempt to connect to any access point. There are lots of other options you can play with — even some that define other access points to try to connect to if the default one is unavailable. The file /etc/conf.d/wireless.example provides many examples.
You should now have a system that boots and connects to your wireless network.
Summary
Wireless in Linux is improving all the time, continually evolving to support a richer array of devices. Unfortunately, there isn’t a unified effort to develop wireless tools, and a de facto standard has yet to emerge, making wireless configuration on Linux more difficult than on other platforms. The lack of vendor-supplied drivers for Linux is also detrimental.
For now, it’s ideal to choose a wireless card that has vendor support. Short of that, Wireless Tools and ndiswrapper can break the chains that bind you to your desk, or office, or building.
Need bio here.
No comments yet.