How to set up a wireless network card using drivers from Debian packages
From NewbieDOC
--Chris Lale 09:36, 21 May 2007 (CEST)
1 Introduction
This article shows you how to compile and install wireless network (wifi) card drivers from the source provided by a Debian package. This procedure has worked using Debian Etch (Stable). This article is based on notes made at the time and has not been fully tested in the form presented here. If there are any omissions, amendments, comments etc, please edit this article and add them. The Edimax EW-7128g is used as an example in this article.
2 Short version if you are impatient
2.1 Build source
It's so simple these days. Eg to install the Ralink 2500 driver:
Build the driver (from the command line as user root):
# aptitude install rt2500-source module-assistant # m-a prepare # m-a a-i rt2500-source
Install the driver:
# modprobe rt2500
2.2 Configuration using Gnome GUI tool
Set up your interface from Gnome with
Desktop -> Administration -> Networking Connections tab -> Wireless connection Properties Interface name wlan0 Enable this connection (tick the box) Network name (ESSID): (Enter the ESSID of your wireless Access Point) Key type: Plain (hexadecimal) WEP key: Enter the WEP key configured in your AP setup Connection settings: DHCP if this is configured on your AP; otherwise Static and fill in details.
Set up your nameservers
DNS tab -> Add
(You can use DNS servers at opendns.com eg 208.67.222.222, or the ones provided by your ISP.)
Activate the wireless interface:
Connections tab -> Wireless connection ... wlan0 -> Activate
2.3 Manual configuration
Configuring the wireless interface with the command line (wireless-tools package) is straightforward. Modify your /etc/network/interfaces file. In this example the network is 192.168.1.0 with the Access Point (wifi/modem/router) at 192.168.1.1. If you use Gnome Network Administration Tool (Desktop -> Administration -> Networking) it will modify this file for you. A handwritten file looks like this:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface #allow-hotplug eth0 #iface eth0 inet static #address 192.168.1.4 #netmask 255.255.255.0 #network 192.168.1.0 #broadcast 192.168.1.255 #gateway 192.168.1.1 # wireless interface iface wlan0 inet static address 192.168.1.3 netmask 255.255.255.0 gateway 192.168.1.1 wireless-essid my-network-id wireless-key NNNNNNNNNN auto wlan0 allow-hotplug wlan0
I commented out my ethernet interface (eth0) when everything was working to make sure that the computer always uses the wireless interface. It was a problem if the signal was too weak to be picked up continuously.
Leave out "wireless-key NNNNNNNNNN" until you have a working connection. Then add it in and configure encryption on your AP.
"allow-hotplug wlan0" lets you hotswap the pcmcia card and get an automatic connection while the computer is running.
Commands to get you started are
- "iwconfig" (to check/configure the interface)
- "iwlist wlan0 scan" (to check for the wireless AP)
- "ifdown eth0" and "ifup wlan0" to take down/bring up the interface
- "/etc/init.d/networking stop", "/etc/init.d/networking start" to restart network service
You may need to add nameservers to /etc/resolv.conf. Mine looks like this:
domain home #nameserver 192.168.1.1 nameserver 208.67.222.222 nameserver 208.67.220.220
These are the OpenDNS nameservers. If you have set up DHCP on your modem/router then use the commented-out line instead of the last two. Test with something like "ping bbc.co.uk".
What follows is some extra detail.
3 Find out your card's chipset
The driver is based on the card's chipset. You might find out which chipset using a pcmcia database such as
http://tuxmobil.org/pcmcia_linux.html
or by using a search engine. For instance, if you were looking for the chipset of the Edimax EW-7128g pci card, this Google search string
edimax EW-7128g chipset
might turn up this page: http://www.linuxquestions.org/hcl/showproduct.php/product/2361 . This shows you that the chipset for the Edimax EW-7128g is
Ralink RT2500
4 Find out whether there is a Debian source package
You can use Synaptic to search for "source", or use Aptitude on the command line. In a terminal or a terminal window enter
$ aptitude search source
This will give you a list of all packages with "source" in the package name. Narrow down your search using Grep. For the Ralink RT2500 chipset try
$ aptitude search source | grep rt2500 p rt2500-source - RT2500 wireless network drivers source
If you want to be sure that this is what you need, look at the description provided by entering
$ aptitude show rt2500-source
5 Install the Debian packages
You need the source package (eg rt2500-source) and the Module-assistant tool. This tool will pull in any other packages you might need (eg kernel headers), compile the driver module as a new Debian package and install it.
Switch user ("su") to root and install the packages.
$ su (Enter password for user root) # aptitude install rt2500-source module-assistant
6 Build and install the driver
6.1 Pcmcia cards only
If the card is a pcmcia card, insert the card. Check that it has been detected with dmesg.
# dmesg
There will be a message near the end of the output to say that the card has been detected.
6.2 All cards, including pcmcia and PCI
Use the module-assistant tool. You can use "m-a" instead of "module-assistant" to save typing.
6.2.1 Clean up if necessary
If you have previously installed the source package you can clean up
# m-a purge --force rt2500-source
6.2.2 Prepare the system Module-assistant
Module-assistant prepares your system by installing any other packages that you need.
# m-a prepare
6.2.3 Build and automatic install using module-assistant
Module assistant builds the kernel module, creates a .deb package and installs it automatically ("a-i").
# m-a a-i rt2500-source
You can follow progress on the blue Ncurses screen.
The .deb is created in /usr/src and installed. You can check the location and name of the package using Synaptic.
Package -> Check Properties -> Installed Files
Alternatively, you can use the "find" command to locate the driver module.
# find /lib/modules -name rt2500.ko
You should find the module somewhere like
/lib/modules/2.6.16-2-686/kernel/drivers/net/wireless/rt2500.ko
7 Insert the driver module into the kernel
First, check that the module is not already loaded.
# lsmod | grep rt2500
Then, insert the module using "modprobe" and check again.
# modprobe rt2500 # lsmod | grep rt2500
In the system log (syslog) or the output of dmesg you should see something similar to the following messages for successful insertion of the module.
# tail /var/log/syslog
# dmesg | grep rt2500 rt2500 1.1.0
8 Configure the network card interface using the command line
8.1 Install wireless-tools
# aptitude install wireless-tools
8.2 Temporary checks
8.2.1 Check that the interface is available
# iwconfig
8.2.2 Set essid
(replace mylan with essid set up on your Access Point).
# iwconfig wlan0 essid mylan
8.2.3 Check for Access Point (AP)
# iwlist wlan0 scan
8.2.4 Set mode
# iwconfig wlan0 mode Managed
8.2.5 Set WEP encryption
# iwconfig wlan0 key restricted XXXXXXXX
8.2.6 Take down any existing ethernet hardwired interface
Other interfaces seem to cause a conflict and prevent the wireless interface from working properly.
# ifdown eth0
8.2.7 Bring up wireless interface
# ifup wlan0
Note: If it complains about unknown interface wlan0, edit /etc/network/interfaces to include an entry for wlan0.
8.2.8 Test the interface
(Replace 192.168.1.1 with the IP address of your AP - the gateway.)
# ping 192.168.1.1
8.2.9 Make ISP's nameservers are available
Edit
/etc/resolv.conf
and add a nameserver line for each of your ISP's nameservers.
search nameserver nnn.nnn.nnn.nnn nameserver nnn.nnn.nnn.nnn
8.2.10 Test nameservers
# ping google.co.uk
8.3 Permanent setup once everything is working
8.3.1 Modify the /etc/network/interfaces file
8.3.2 Disable existing ethernet interface
Comment out any entry for eth0 in /etc/network/interfaces
8.3.3 Enable wireless interface
Add entry for wlan0 to /etc/network/interfaces. See man wireless and /usr/share/doc/wireless-tools/README.Debian.
Note: one of these documents documents a "wireless-" prefix for wireless command, the other gives "wireless_" (underline character instead of hyphen). Both seem to work interchangeably.
auto wlan0 iface wlan0 inet static address 192.168.1.nnn netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 # replace mylan with the essid set up on the AP wireless-essid mylan wireless-mode Managed # Set up encryption. wireless-keymode restricted wireless-key XXXXXXXXXX
4. Test
Set up encryption on the AP. Take down the interface and bring it up again.
# ifdown wlan0 # ifup wlan0 # ping google.co.uk
5. Test the init scripts
(these call ifup/ifdown)
# /etc/init.d/networking stop # /etc/init.d/networking start # ping google.co.uk
Exit the root user account
# exit $
9 Configure the network card interface using GUI tools
Here are some very brief notes about GUI alternatives.
9.1 Wlassistant
Install package "wlassistant" and run it.
Radio of your wireless is off. Would you like to turn it on? Yes Be patient
(Refresh as needed)
Click on the detected essid to get
First Connection Wizard
Interface Configuration (Automatic (DHCP) or Manual)
If Manual, here are some example settings. Substitute the IPs for your system.
IP:192.168.1.3 Broadcast: 192.168.1.255 Netmask:255.255.255.0 Gateway:192.168.1.1 Domain: home Primary DNS:192.168.1.1 Secondary DNS:
WEP Configuration:
WEP Configuration Which WEP mode would you like to use? Open System or Shared Key (Open recommended) WEP key: XXXXXXXXXXX Done
Press Finish to connect.
Card's LEDs come on.
To modify settings later: right-click on essid,
Edit Settings
9.2 Gnome Network Tools
Applications -> System Tools -> Network Tools Devices tab Network device: (Select wlan0) Click configure
9.3 Gnome Network Administration Tool
Desktop -> Administration -> Networking
9.4 Gnome Network Monitor Applet
Right click on icon -> Properties Connections tab, select 'Wireless connection' and click Properties Interface properties dialogue Connection Interface name: wlan0 Tick 'Enable this connection' Wireless settings Connection settings Activate
10 WEP or WPA encryption
If you want WPA encryption, you must install the "wpasupplicant" package. Configuration not covered here.
Content is available under GNU Free Documentation License 1.2, unless otherwise stated.