Wireless network configuration

From ArchWiki
Revision as of 01:07, 6 July 2008 by Georgia tech swagger (Talk | contribs) (Replaced every instance of wireless-tools with the correct wireless_tools)

Jump to: navigation, search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

Introduction

Configuring wireless under Arch Linux (or any distro for that matter) is a two-part process. The first part is to identify and ensure the correct driver for your wireless device is installed, (they are available on the installation media, so make sure you install them) and configure the interface. The second is choosing a method of managing wireless connections. This article covers both parts, and provides additional links to wireless management tools.

Template:Box Note

Part I: Identify your card and appropriate Driver

First steps

  1. Check to see whether Linux supports your hardware. You can find out what your card is with 'hwdetect --show-net' or lshwd.
    • zd1201-based card like ZyXEL B-220
    • wlan-ng supports quite a lot of chipsets; check here first.
    • madwifi for Atheros chipsets (AR5210, AR5211, AR5212 and AR5213)
    • rt2x00 project for a unified driver for Ralink's rt2400, rt2500, and rt2570 chipsets (beta).
    • Ralink Linux Support for drivers for Ralink chipsets direct from the manufacturer.
    • rt2x00 project for better-maintained versions of Ralink's own drivers ("legacy drivers" on the site).
    • ipw2100 for Intel Pro/Wireless 2100 Mini PCI
    • ipw2200 for Intel Pro/Wireless 2200 Mini PCI
    • ipw3945 for Intel Pro/Wireless 3945 AB/G Mini PCI-E
    • orinoco for some Prism 2-based cards
    • prism54 for Prism 54-based cards
    • bcm43xx for Broadcom 43xx-based cards (old)
    • b43 for Broadcom 43xx-based cards
    • Check the Linux Wireless Support page for your hardware or in The Linux Questions hardware compatibility list (HCL), which also has a good list of Linux-friendly hardware
  2. If the hardware is supported only under Windows
    • ndiswrapper for hardware supported only under Windows (some Broadcom, 3com, etc)
    • You will need the .inf and .sys files from your Windows driver - check here
  3. If your hardware is not listed anywhere
    • Try a web search for the exact model name of your hardware with the word "linux" - and feel free to ask for help on the forums
    • There is a chance that your hardware will not function under Linux (however, this is rarely the case)

How it Works

The Arch kernel is modular, meaning many of the drivers for machine hardware reside on the hard drive and are available as modules. On bootup, udev takes an inventory of your hardware. Udev will load appropriate modules (drivers) for your corresponding hardware, and the driver, in turn, will allow creation of a kernel interface.

The interface name for different drivers and chipsets will vary. Some examples are wlan0, eth1, and ath0.

  • Note: Udev is not perfect. If the proper module is not loaded by udev on boot, simply modprobe it and add the module name to etc/rc.conf on the MODULES= line.

Installation

If you have wired internet available

If you have wired ethernet available, and are simply adding wireless functionality to an existing system, and did not include wireless_tools during initial installation, use pacman to install:

pacman -S wireless_tools

The drivers' corresponding package names are all highlighted in bold on this page. The packages can be installed during initial package selection on the Arch installation media and can also be installed later with pacman, e.g.:

pacman -S madwifi

If you have only wireless internet available

The wireless_tools package is now available as part of the base system and is also on the live installation media (CD/USB stick image).

You cannot initialize wireless hardware without these tools, so ensure they are installed from the installer media, (during package selection), especially if you have no other means of networking other than wirelessly. Otherwise, you will be stuck in a recursion when you reboot your installed Arch system; you will need wireless_tools and drivers, but in order to get them, you will need wireless_tools and drivers.

  • This line intentionally left blank.

Wireless Quickstart

The general procedure will be:

  • Identify your interface and appropriate module:
hwdetect --show-net

or

lshwd 
  • Ensure the module is loaded with lsmod | grep <name_or_part_of_name_of_module> e.g.:
lsmod | grep ath
  • Ensure the driver has created a usable interface:
iwconfig
  • Bring the interface up with ifconfig <interface> up. e.g.:
ifconfig ath0 up
  • (Optional) Scan for available access points:
iwlist ath0 scan | less
  • Specify the id of the wireless network with iwconfig <interface> essid <youressid> key <yourwepkey>, e.g.:
iwconfig ath0 essid linksys key 0241baf34c
  • Request an IP address with dhcpcd <interface>. e.g.:
dhcpcd ath0
  • Ensure you can route:
ping -c 3 www.google.com

Done.

Refer to Part II to ensure a permanent configuration solution for your system.

Drivers

wlan-ng

Packages: wlan-ng26 wlan-ng26-utils

For wlan-ng you do not need the wireless_tools package as mentioned above. Instead you will need to learn the tools in the wlan-ng26-utils package: wlancfg and wlanctl-ng.

rt2x00

Unified driver for Ralink chipsets (replaces rt2500,rt61,rt73 etc). Compatible with stable wpa_supplicant using the wext driver interface. This driver is now (as of 2.6.24) part of the mainline kernel, and can be manually loaded as follows...

modprobe rt2500pci
(replace rt2500pci with your hardware e.g. rt2400pci, rt2500usb, rt61pci, rt73usb)

Some chips require a firmware file. See the rt2x00 wiki page.

RT2500

For Ralink's PCI/PCMCIA based rt2500 series chipsets (the first generation of Ralink chips to support 802.11g).

Package: rt2500

Supports standard iwconfig tools for unencrypted and WEP connections, although it can be quite sensitive to the order of commands. wpa_supplicant is not supported using the standard wext interface. The driver does support WPA (using hardware encryption), but in a non-standard way. The trunk version of wpa_supplicant (0.6.x) appears to include special support for this driver, and it is also possible to negotiate a WPA connection manually using iwpriv commands. See these instructions for details. The same applies for RT61 and RT73 below.

RT61

For PCI/PCMCIA cards based on Ralink's later generation of 802.11g chipsets (including those supporting proprietary MIMO modes). See the RT61 wiki page.

RT73

For USB devices based on Ralink's later generation of 802.11g chipsets (including those supporting proprietary MIMO modes). See the RT73 wiki page.

madwifi

Package: madwifi

The module is called ath_pci. The newer module, ath5k, will eventually phase out ath_pci.

modprobe ath_pci

for the older driver, or:

modprobe ath5k

for the development version.

Some users may need to use the countrycode option when loading the MadWifi driver in order to use channels and transmit power settings that are legal in their country/region. In the Netherlands, for example, you would load the module like this:

modprobe ath_pci countrycode=528

You can verify the settings with the iwlist command. See man iwlist and the CountryCode page on the MadWifi wiki. To have this setting automatically applied during boot, add the following to /etc/modprobe.conf:

options ath_pci countrycode=528

ATTENTION: I had to remove the countrycode option completely or the ath0 device wasn't created (andyrtr, kernel 2.6.21)!

ipw2100 and ipw2200

Depending on which of the chips you have, use either:

ipw2100-fw

or:

ipw2200-fw

If installing after initial Arch installation, you may need to reboot for the firmware to be loaded.

ipw3945 and ipw4965

ipw3945 is the old driver. It uses device name ethX. It requires a regulatory daemon named ipw3945d, and firmware named ipw3945-ucode.

iwl3945 is the new driver. It uses device name wlan0. It has no regulatory daemon, and uses firmware iwl3945-ucode. The new driver will work for both the 3945 and 4965 chipsets and is conveniently included with kernel v2.6.24 and up. Since the iwl3945 driver is newer, it is recommended to try first. Simply use the firmware that corresponds to your chipset:

iwlwifi-3945-ucode

or:

iwlwifi-4965-ucode

If MOD_AUTOLOAD is set to yes in /etc/rc.conf (it is by default) that should be all that's required. Simply check for the presence of the drivers by running ifconfig from a terminal. There should be a listing for wlan0.

If you would like to manually load the driver at boot-up, add it your MODULES array:

nano /etc/rc.conf

in the MODULES=() array, add iwl3945 or iwl4965 to the list, depending on your chipset

CTRL + X, Y to close and save.

The drivers should now load after a reboot, and running 'ifconfig' from a terminal should report wlan0 as a new network interface.

Notes:

  • if the iwlwifi drivers, being "experimental", do not work, know that the windows NETw4x32 driver works with ndiswrapper just fine.
  • If the iwl3945 doesn't works for you, you might have more luck with Ipw3945

ipw3945 (Alternate Method)

Note: This ipw3945 driver will be phased out as Intel's iwlwifi project drivers reach maturity.

Package: ipw3945

To properly initialize the driver on startup...

nano /etc/rc.conf

in the modules=() array, add ipw3945 to the list

in the daemons=() array, add ipw3945d to the list (its order must come BEFORE network and dhcdbd/networkmanager in the array)

CTRL + X, Y to close and save.

The ipw3945 module should load during "Loading Modules.." and "Starting IPW3945d" should appear during daemon initialization, and ethX should be present.

Update: On my HP nc6320 the Bluetooth won't connect unless you unload the ipw3945 module.

orinoco

This should be part of the kernel package and be installed already.

ndiswrapper

Ndiswrapper is not a real driver, but you can use it when there are no native Linux drivers for your wireless chips. So it is very useful in some situations. To use it you need the *.inf file from your Windows driver (the *.sys file must also be present in the same directory). If you need to extract these files from an *.exe file, you can use either cabextract or wine. ndiswrapper is included on the installation CD.

Follow these steps to configure ndiswrapper.

ndiswrapper -i filename.inf
ndiswrapper -l
ndiswrapper -m
depmod -a

Now the ndiswrapper install is almost finished; you just have to update /etc/rc.conf to load the module at boot (below is a sample of my config; yours might look slightly different):

MODULES=(ndiswrapper snd-intel8x0 !usbserial)

The important part is making sure that ndiswrapper exists on this line, so just add it alongside the other modules. It would be best to test that ndiswrapper will load now, so:

modprobe ndiswrapper
iwconfig

and wlan0 should exist. Check this page if you're having problems: Ndiswrapper installation wiki.

prism54

Download the firmware driver for your appropriate card from this site. Rename the firmware file to 'isl3890'. If nonexistent, create the directory /lib/firmware and place the file 'isl3890' in it. This should do the trick. (forum source)

ACX100/111

packages: tiacx tiacx-firmware

The driver should tell you which firmware it needs; check /var/log/messages.log or use the dmesg command. Move the appropriate firmware to '/lib/firmware'. I did this:

ln -s /usr/share/tiacx/acx111_2.3.1.31/tiacx111c16 /lib/firmware

Hint: If you find that the driver is spamming your kernel log, for example because you're running Kismet with channel-hopping, you could put this in /etc/modprobe.conf:

options acx debug=0

BCM43XX

Broadcom users that have 43xx series chipsets have a new alternative to ndiswrapper. In kernel version 2.6.17, the bcm43xx driver was introduced.

  1. Run
    iwconfig
    or
    hwd -s
    to determine that you have an appropriate card. My output of hwd -s looked like this:
    Network    : Broadcom Corp.|BCM94306 802.11g NIC module: unknown

For a list of supported devices, see here.

  1. Run
    pacman -Sy bcm43xx-fwcutter
    to install the firmware cutter application.
  2. Download the Windows driver file for your card from which to extract the firmware.
  3. If you download the driver from Dell's website, you must run in on a Windows machine or under WINE (it is a .exe file that extracts itself to C:\Dell\[driver numbers]). Or you may try [1], [2] or [3]. I just saved this file to my desktop; you won't need it after the next step.
  4. Run
    bcm43xx-fwcutter -w /lib/firmware /home/<user>/Desktop/wl_apsta.o
    You may have to create /lib/firmware first.
  5. Restart, and configure your device as normal. You may want to add bcm43xx into the modules section of your rc.conf file. Good luck!

b43

This driver is the successor to the bcm43xx driver, and is included in kernel 2.6.24.

  1. Run
    hwd -s
    to determine that you have an appropriate card. My output of hwd -s looked like this:
    Network    : BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller module: unknown

For a list of supported devices, see here.

  1. Install the firmware cutter application from core. It is named b43-fwcutter.
  2. Because now in core we have kernel 2.6.25 we download version 4.150.10.5 of Broadcom's proprietary driver. The older version(4.80.53.0) will be drop in july.
    wget http://mirror2.openwrt.org/sources/broadcom-wl-4.150.10.5.tar.bz2
  3. Unpack the compressed file.
    tar xjf broadcom-wl-4.150.10.5.tar.bz2
  4. Change the current directory to the newly created directory, and then further to the driver folder:
    cd broadcom-wl-4.150.10.5/driver
  5. Create /lib/firmware if you don't have and then Run
    b43-fwcutter -w "/lib/firmware/" wl_apsta_mimo.o
  6. Restart, and configure your device as normal. You may want to add b43 into the modules section of your rc.conf file.
MODULES=(...b43 !bcm43xx...)

Good luck!

rtl8187

See the rtl8187 wiki page.

zd1211rw

zd1211rw is a driver for the ZyDAS ZD1211 802.11b/g USB WLAN chipset and it is included in recent versions of the Linux kernel. See [4] for a list of supported devices. You only need to install the firmware for the device:
pacman -Sy zd1211-firmware

Test Installation

After loading your driver run

iwconfig

and see if a wireless interface (wlanX, ethX, athX) is recognized

Part II: Wireless Management

Assuming that your drivers are installed and working properly, you will need to choose a method for managing your wireless connections. The following subsections will help you decide the best way to do just that.

Arch-based wireless management

Arch Linux provides several solutions for managing wireless connections. Choosing the best method depends on your individual needs.

netcfg

netcfg provides a more versatile, robust solution to networking on Arch. It uses a profile based setup and is capable of detection and connection to a wider range of network types.

Documentation: Network Profiles

Development version: Network Profiles development

/etc/rc.conf

  • The /etc/rc.conf file is sourced by the network script. Therefore, you may define and configure a simple wireless setup within /etc/rc.conf for a centralized approach with wlan_<interface>="<interface> essid <essid>" and INTERFACES=(<interface1> <interface2>)

For example:

# /etc/rc.conf
eth0="dhcp"
wlan0="dhcp"
wlan_wlan0="wlan0 essid MyEssid" # Unencrypted
#wlan_wlan0="wlan0 essid MyEssid key 1234567890" # hex WEP key
#wlan_wlan0="wlan0 essid MyEssid key s:asciikey" # ascii WEP key

INTERFACES=(eth0 wlan0) (Not all wireless cards are wlan0. Determine your wireless interface with ifconfig -a.

Atheros-based cards, for example, are typically ath0, so change wlan_wlan0 to:

wlan_ath0="ath0 essid MyEssid key 12345678" 

Also define ath0 in the INTERFACES= line.)

  • Alternatively, you may define wlan_<interface> within /etc/conf.d/wireless, (which is also sourced by the network script), for a de-centralized approach:
# /etc/conf.d/wireless
wlan_wlan0="wlan0 essid MyEssid"

wireless_tools

These powerful console tools work extremely well and allow complete, manual control from the shell. These examples assume your wireless device is wlan0. Replace wlan0 with the appropriate device name. Many cards require that the kernel interface be activated before you can use the wireless_tools:

ifconfig wlan0 up

See what access points are available:

iwlist wlan0 scan

Using the scan results, tell your wireless device which access point to use. For example:

iwconfig wlan0 essid linksys

Then, setup the network interface as usual. Simple examples are:

dhcpcd wlan0

or

ifconfig wlan0 192.168.0.2
route add default gw 192.168.0.1

Third-party wireless management

There are a number of wireless management solutions available to Arch Linux users as an alternative to the above scripts.

NetworkManager

NetworkManager is an advanced network management tool that is enabled by default in most popular Linux distributions. In addition to managing wired connections, NetworkManager provides worry-free wireless roaming with an easy-to-use GUI program for selecting your desired network.

For more information, see the NetworkManager wiki.

Wicd

Wicd is a network manager that can handle both wireless and wired connections. It is written in Python and Gtk with fewer dependencies than NetworkManager, making it an ideal solution for lightweight desktop users. Wicd is now available in the extra repository for both i686 and x86_64.

For more information, see the Wicd wiki.

Wifi Radar

WiFi Radar is Python/PyGTK2 utility for managing wireless profiles (and only wireless). It enables you to scan for available networks and create profiles for your preferred networks.

For more information, see the Wifi Radar wiki.

Wlassistant

Wlassistant is a very intuitive and straightforward GUI app for managing your wireless connections.

Install with:

pacman -S wlassistant

Wlassistant must be run with root privileges:

sudo wlassistant

One method of using wlassistant is to configure your wireless card within /etc/rc.conf, specifying the access point you use most often. On startup, your card will automatically be configured for this essid, but if other wireless networks are needed/available, wlassistant can then be invoked to access them. Background the network daemon in /etc/rc.conf, by prefixing it with a @, to avoid boot delays.

Additional Resources