Wednesday, 30 May 2007

Going Wireless

The problem with having Fedora installed on VMWare is that I can only use it when I'm sat at my desk. With the holiday weekend coming up, I wanted to give myself some options. I remembered that we have an old Toshiba laptop in a cupboard, so I decided to install Fedora on that.

Everything went very smoothly - I had no installation problems at all. However, having the laptop wasn't going to be much good without Internet access, so I needed to install my NetGear wireless card: just inserting it in the card slot didn't work ;-)

The Netgear card uses an Atheros chipset. Fortunately, there is great support for Atheros based cards on Linux from MadWifi.

The first step is to install the driver. You need to download the driver source files which come as a bzip2 tar file. The easiest thing to do is just double-click the file to get the archive manager to open it, and drag the compressed source folder somewhere convenient - like your home directory. MadWifi have some really good instructions for building and installing the driver here.

One of the biggest differences I've discovered running Linux after running Windows is that building the software should be seen as the first stage of the installation process, not the last stage of the development process. This is a result of both the software being open source, and needing to run on multiple versions of multiple distributions of Linux. The good news is that you do not need to know anything at all about developing software to build the source code.

There are standard methods of building software. The first thing you need to do is run a terminal window and cd to the source directory (which you have probably just unzipped.) Next you may need to run autoconf. This will generate a configure file, although often the configure file has already been generated for you. You now run configure. configure will set up the files needed to build the software on your system.

To make life even easier, many source packages come with a shell script called which does all this for you. If there's a file you should run that instead of autoconf and configure. Just type sh

Whether you have run autoconf and configure, or just you should now be prompted to run make. If the software builds correctly (and this can take some time depending on the software) you can su and then run make install which copies the compiled software into all the right directories.

With MadWifi all you have to do is run make and then make install. Because MadWifi is a driver you need to add it to the kernel using modprobe. (See the MadWifi instructions.)

Getting the wireless card to function isn't hard, but there are some curiosities. Firstly, by default, two wireless "devices" get created by MadWifi. This is because MadWiFi supports virtual access points. The first device is wifi0, which I think of as the wireless card. The second device is ath0 which is the virtual device which is actually used by the OS. It is ath0 that you configure in order to connect you your wireless network. The only problem here is that it is wifi0 that is brought up when the system boots, and the system will attempt to get an IP address. This leads to a long pause on bootup until the "connection" times out. To stop this you can use the "Network Configuration" utility (from the System/Administration menu) to configure wifi0 to use a static IP address which can just be left blank.

The MadWifi instructions tell you how to configure the wireless connection manually, but what if you want to start the wireless connection automatically everytime your machines boots? Isn't that what most people want to do?

The answer is to edit your /etc/rc.d/rc.local file. This shell file gets run on bootup after the system has finished loading. You just need to add the wireless configuration commands to the file:

#Bring up the virtual card
/sbin/ifconfig ath0 up

#Set the authentication mode
/sbin/iwpriv ath0 authmode 1

#Specify the Wireless Network
/sbin/iwconfig ath0 essid network_name key password

#Get an IP address
/sbin/dhclient ath0

Not too difficult at all.


Biby Cletus said...

Cool blog, i just randomly surfed in, but it sure was worth my time, will be back

Deep Regards from the other side of the Moon

Biby Cletus

David Rowe said...

Thank you! I really appreciate it.