Wireless network configuration

From ArchWiki
Revision as of 06:27, 6 December 2009 by Keiichi (Talk | contribs) (tiny redirection fix)

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 entry Template:I18n entry Template:I18n links end Configuring wireless 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 to 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.

About new Arch systems: The wireless drivers and tools are available during Arch set-up under the base-devel category. Be sure to install the proper driver for your card. Udev will usually load the appropriate module, thereby creating the wireless interface, in the initial live system of the installer, as well as the newly installed system on your hard drive. If you are configuring your wireless functionality after, and not during, Arch installation, simply ensure the required packages are installed with pacman, (driver, firmware if needed, wireless_tools, wpa_supplicant, etc.) and follow the guidelines below.

Part I: Identify the card and driver

First steps

  1. Check to see whether the Linux kernel supports your hardware. You can find your card with 'lspci | grep -i net'. The Ubuntu Wiki has an extensive list of wireless cards and whether or not they are supported by available linux kernel drivers.
  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 GNU/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. At boot, 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) under the base-devel category.

You cannot initialize wireless hardware without these user-space 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 newly installed Arch system; you will need wireless_tools and drivers, but in order to get them, you will need wireless_tools and drivers.

Drivers and firmware

Methods and procedures for installing drivers for various chip-sets are covered below. In addition, certain chip-sets require the installation of corresponding firmware (also covered below).

wlan-ng

Packages: wlan-ng26-utils

This driver support PRISM based cards, which are hard to find now. The PRISM card is an IEEE 802.11 compliant 2.4 GHz DSSS WLAN network interface card that uses the Intersil PRISM chip-set for its radio functions and the AMD PCNet-Mobile chip (AM79C930) for its Media Access Controller (MAC) function. The supported adapters can be found from here: http://www.linux-wlan.org/docs/wlan_adapters.html.gz

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.

See http://www.linux-wlan.org/

rt2860 and rt2870

In kernel since 2.6.29 and requires no extra packages. It can be configured using the standard wpa_supplicant and iwconfig tools.

It has a wide range of options that can be configured with iwpriv. These are documented in the source tarballs available from Ralink

For rt2870sta, also see Rt2870

w322u

Treat this Tenda card as an rt2870sta. See: Rt2870

rtl8180

Realtek rtl8180 PCI/Cardbus 802.11b now fully supported in the kernel. It can be configured using the standard wpa_supplicant and iwconfig tools.

rt2x00

Unified driver for Ralink chip-sets (replaces rt2500,rt61,rt73 etc). In kernel since 2.6.24, some devices require extra firmware. It can be configured using the standard wpa_supplicant and iwconfig tools.

Some chips require a firmware file, which can be installed as follows, depending on the chip-set:

pacman -S rt2x00-rt71w-fw
pacman -S rt2x00-rt61-fw

See: Using the new rt2x00 beta driver

rt2500, rt61, rt73 (obsolete)

For Ralink

* PCI/PCMCIA based rt2500 series chip-sets.
* PCI/PCMCIA based rt61 series chip-sets
* USB based rt73 series chip-sets. 

Drivers are now obsolete and unsupported. The rt2x00 driver family is stable and to be used instead.

Support standard iwconfig tools for unencrypted and WEP connections, although it can be quite sensitive to the order of commands. The driver does support WPA (using hardware encryption), but in a non-standard way. wpa_supplicant 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.

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. Note that not all cards work with ath5k yet.

If using ath_pci, you may need to blacklist ath5k by adding it to the MODULES=array in /etc/rc.conf, and subsequently prefixing it with a bang (!):

MODULES=(!ath5k forcedeth snd_intel8x0 ... ...)

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.d/modprobe.conf:

Note: The new module-init-tools 3.8 package changes the location of the configuration file: /etc/modprobe.conf is no longer read, instead /etc/modprobe.d/modprobe.conf is used. link
options ath_pci countrycode=528
Note: A user had to remove the countrycode option completely or else the ath0 device was not created (kernel 2.6.21).

ath9k

ath9k is Atheros' officially supported driver for the newer 11n chip-sets. All of the chips with 11n capabilities are supported, with a maximum throughput around 180 Mbps. To see a complete list of supported hardware, check this page.

Working modes: Station, AP and Adhoc.

ath9k has been part of the kernel as of 2.6.27. But it has undergone some heavy development, and the changes have not propagated to the mainline kernel tree yet. The best solution would be to use the compat-wireless package for now. A mailing list exists for support and development related discussions.

ipw2100 and ipw2200

Fully supported in the kernel, but requires additional firmware. It can be configured using the standard wpa_supplicant and iwconfig tools.

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

ipw2100-fw

pacman -S ipw2100-fw

or:

ipw2200-fw

pacman -S ipw2200-fw

If installing after initial Arch installation, the module may need to be reloaded for the firmware to be loaded; run the following as root:

rmmod ipw2200
modprobe ipw2200
Enabling the radiotap interface

Launch the following (as root):

rmmod ipw2200
modprobe ipw2200 rtap_iface=1
Enabling the LED

Most laptops will have a front LED to indicate when the wireless is connected (or not). Run the following (as root) to enable this feature:

echo "options ipw2200 led=1" >> /etc/modprobe.d/ipw2200.conf

or if using sudo:

echo "options ipw2200 led=1" | sudo tee -a /etc/modprobe.d/ipw2200.conf

iwl3945, iwl4965 and iwl5000-series

Intel's open source WiFi drivers for Linux (See iwlwifi) will work for both the 3945 and 4965 chipsets since kernel v2.6.24. And iwl5000-series chipsets (including 5100BG, 5100ABG, 5100AGN, 5300AGN and 5350AGN) module has been supported since kernel 2.6.27, by the intree driver iwlagn.

Installing Firmware (Microcode)

Install the appropriate firmware package for your chipset:

# pacman -S iwlwifi-3945-ucode

or:

# pacman -S iwlwifi-4965-ucode

or:

# pacman -S iwlwifi-5000-ucode

If you need wireless connectivity to access pacman's repositories, the firmware files are also available direct from Intel. See this page, select and download the archive.

$ wget http://intellinuxwireless.org/iwlwifi/downloads/iwlwifi-XXXX-ucode-XXX.XX.X.XX.tgz

After downloading, you must extract and copy the *.ucode file to the firmware directory, commonly /lib/firmware

# tar zxvf iwlwifi-XXXX-ucode-XXX.XX.X.XX.tgz
# cd iwlwifi-XXXX-ucode-XXX.XX.X.XX/
# cp iwlwifi-XXXX-X.ucode /lib/firmware/
Loading the Driver

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

To manually load the driver at startup, edit /etc/rc.conf as root and add iwl3945 or iwl4965 respectively to the MODULES array. For example:

MODULES=( ... b44 mii iwl3945 snd-mixer-oss ...)

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

Other Notes
  • The windows NETw4x32 driver can be used with ndiswrapper as an alternative to the iwl3945 and ipw3945 drivers
  • In some cases (specifically a Dell Latitude D620 with Arch 2008.06, though it could happen elsewhere) after installation you may have both iwl3945 and ipw3945 in your MODULES=() section of rc.conf. The card will not work with both modules loaded, so you will have to ! out the ipw3945 module and then reboot or remove the module manually before you can use your wireless card.
  • By default iwl3945 is configured to only work with networks on channels 1-11. Higher ranges are not allowed in some parts of the world (US). In the EU however channels 12 and 13 are used quite common. To make iwl3945 scan for all channels, add "options cfg80211 ieee80211_regdom=EU" to /etc/modprobe.d/options. With "iwlist f" you can check which channels are allowed.
  • If you want to enable more channels on Intel Wifi 5100 (and quite possible other cards too) you can do that with the crda package. After install, edit /etc/conf.d/wireless-regdom and uncomment the line where your country code is found. Add wireless-regdom to your DAEMONS in rc.conf and restart (which is the easiest thing to do). You should now, when writing sudo iwlist wlan0 channel, have access to more channels (depending on your location).

ipw3945 (obsolete)

Note: The ipw3945 driver is no longer actively developed, and the iwlwifi driver (described above) should work perfectly, but may conflict with the former one. So, only one of them should be installed. If you choose to use the iwlwifi driver you still do need the ipw3945-ucode package though.
# pacman -S ipw3945 ipw3945-ucode ipw3945d

To initialize the driver on startup, edit /etc/rc.conf as root and add ipw3945 to the MODULES array and ipw3945d to the DAEMONS array. For example:

MODULES=(... mii ipw3945 snd-mixer-oss ...)
DAEMONS=(syslog-ng ipw3945d network ...)

Note: The ipw3945d daemon must be inserted BEFORE network and dhcdbd/networkmanager in the array.

orinoco

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

Note: Some orinoco chipsets are Hermes I/II. You can use http://aur.archlinux.org/packages.php?ID=9637 to replace the orinoco driver and gain WPA support. See http://ubuntuforums.org/showthread.php?p=2154534#post2154534 for more information.

To use the driver, blacklist orinoco_cs in rc.conf (!orinoco_cs in the MODULES array) and add wlags49_h1_cs. Example:

MODULES=(!snd_pcsp !eepro100 !orinoco_cs wlags49_h1_cs)

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). Be sure to use drivers appropriate to your architecture (i.e. 32/64bit). If you need to extract these files from an *.exe file, you can use either cabextract or wine. Ndiswrapper is included on the Arch Linux installation CD.

Follow these steps to configure ndiswrapper.

#Install the driver to /etc/ndiswrapper/*
ndiswrapper -i filename.inf
#List all installed driver for ndiswrapper
ndiswrapper -l
#Write configuration file in /etc/modprobe.d/ndiswrapper.conf
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. [1]

If that did not work, try this:

  • Reload the prism module (modprobe p54usb or modprobe p54pci, depending on your hardware)

alternatively remove your wifi card and then reconnect it

  • Use the "dmesg" command, and look at the end of the output it prints out.

Look for a section looking like this:

firmware: requesting isl3887usb_bare
p54: LM86 firmware
p54: FW rev 2.5.8.0 - Softmac protocol 3.0

and try renaming the firmware file to the name corresponding to the part bolded here.

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.

Link the appropriate firmware to '/lib/firmware':

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

For another way to determine which firmware revision number to use, see the "Which firmware" section of the acx100.sourceforge wiki. For ACX100, you can follow the links provided there, to a table of card model number vs. "firmware files known to work"; you can figure out the rev. number you need, by looking at the suffix there. E.g. a dlink_dwl650+ uses "1.9.8.b", in which case you'd do this:

ln -s /usr/share/tiacx/acx100_1.9.8.b/* /lib/firmware

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.d/modprobe.conf:

options acx debug=0
Note: The open-source acx driver does not support WPA/RSN encryption. Ndiswrapper will have to be used with the windows driver to enable the enhanced encryption. See ndiswrapper, this page, for more details.

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. Example:
    Network    : Broadcom Corp.|BCM94306 802.11g NIC module: unknown
    For a list of supported devices, see this.
  2. Run
    pacman -Sy b43-fwcutter
    to install the firmware cutter application.
  3. Download the Windows driver file for your card from which to extract the firmware.
  4. 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 [2], [3] or [4]. You will not need it after the next step, so location where it is saved is not important.
  5. Run
    bcm43xx-fwcutter -w /lib/firmware /home/<user>/Desktop/wl_apsta.o
    You may have to create /lib/firmware first.
  6. 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
    lspci
    to determine that you have an appropriate card. An example:
    0c:00.0 Network controller: Broadcom Corporation BCM4311 802.11b/g WLAN (rev 01)
    For a list of supported devices, see here.

    Either install the "b43-firmware" package from AUR, or perform the following steps manually:
  2. Install the firmware cutter application from core. It is named "b43-fwcutter".
  3. Because Arch has kernel >=2.6.25, download version 4.150.10.5 of Broadcom's proprietary driver. The older version(4.80.53.0) will be dropped in July.
    wget http://mirror2.openwrt.org/sources/broadcom-wl-4.150.10.5.tar.bz2
  4. Unpack the compressed file.
    tar xjf broadcom-wl-4.150.10.5.tar.bz2
  5. Change the current directory to the newly created directory, and then further to the driver folder:
    cd broadcom-wl-4.150.10.5/driver
  6. Create /lib/firmware if you do not have and then Run
    b43-fwcutter -w "/lib/firmware/" wl_apsta_mimo.o
  7. 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 !ndiswrapper...)

broadcom-wl

For recent Broadcom 43xx cards not supported by bcm43xx or b43. Not just for 4312 cards. See the Broadcom 4312 wiki page. It is available in AUR. These chipsets are used in most Dell laptops, among others.

rtl8187

See: rtl8187

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 [5] 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.

If iwlist scan displays Interface does not support scanning then you probably forgot to install the firmware.

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.

Procedure and tools you will need will depend on several factors:

  • The easiness of configuration management, from a completely manual setup procedure that you will need to repeat at each boot to a software-managed, automatic solution
  • The encryption type (or not) that protects the wireless network
  • If you need network profiles, i.e. if your computer will frequently change networks (such as a laptop)

Management methods

This table shows the different methods that can be used to activate and manage a wireless network connection, depending on the encryption and management types, and the various tools that are required. Although there may be other possibilities, these are the most frequently used:

Management No encryption/WEP WPA/WPA2 PSK
Manual, need to repeat at each computer reboot ifconfig + iwconfig + dhcpcd/ifconfig ifconfig + iwconfig + wpa_supplicant + dhcpcd/ifconfig
Automatically managed, centralized without network profile support define interface in /etc/rc.conf not covered
Automatically managed, with network profiles support Netcfg, wicd, NetworkManager, etc…

Whatever your choice, you should try to connect using the manual method first. This will help you understand the different steps that are required and debug them in case a problem arose. Another tip: if possible (e.g. if you manage your wifi access point), try connecting with no encryption, to check everything works. Then try using encryption, either WEP (simpler to configure) or WPA.

Manual setup

The programs provided by the package wireless_tools are the basic set of tools to set up a wireless network. Moreover, if you use WPA/WPA2 encryption, you will need the package wpa_supplicant. These powerful users-pace 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.

Note: Depending on your hardware and encryption type, some of these steps may not be necessary. Some cards are known to require interface activation and/or access point scanning before being associated to an access point and being given an IP address. Some experimentation may be required. For instance, WPA/WPA2 users may directly try to activate their wireless network from step 3.

1. (Optional, may be required) Some cards require that the kernel interface be activated before you can use the wireless_tools:

 # ifconfig wlan0 up

2. (Optional, may be required) See what access points are available:

# iwlist wlan0 scan

3. Depending on the encryption, you need to associate your wireless device with the access point to use and pass the encryption key.

Assuming you want to use the ESSID named MyEssid:

  • No encryption
 # iwconfig wlan0 essid "MyEssid"
  • WEP

using an hexadecimal key:

 # iwconfig wlan0 essid "MyEssid" key 1234567890

using an ascii key:

 # iwconfig wlan0 essid "MyEssid" key s:asciikey
  • WPA/WPA2

You need to edit the /etc/wpa_supplicant.conf file as described in WPA_Supplicant. Then, issue this command:

 # wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf

This is assuming your device uses the wext driver. If this does not work, you may need to adjust these options. Check WPA_Supplicant for more information and troubleshooting.

4. Finally, provide an IP address to the network interface. Simple examples are:

# dhcpcd wlan0

for DHCP, or

# ifconfig wlan0 192.168.0.2
# route add default gw 192.168.0.1

for static IP.

Note: Although the manual configuration method will help troubleshoot wireless problems, you will have to retype every command each time you reboot.

Automatic setup

There are many solutions to choose from, but remember that all of them are mutually exclusive; you should not run two daemons simultaneously.

Standard network daemon
Note: This method and configuration examples are only valid for unencrypted or WEP-encrypted networks, which are particularly unsecure. To use WPA/WPA2, you will need to use other solutions such as such as netcfg or wicd. Also, avoid mixing these methods as they may create a conflict and prevent the wireless card from functioning.
  • 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>). The name of the network goes in place of MyEssid.

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"

These solutions are limited for a laptop which is always on the move. It would be good to have multiple Network Profiles and be able to easily switch from one to another. That is the aim of network managers, such as netcfg.

Netcfg

netcfg provides a versatile, robust and fast solution to networking on Arch.

It uses a profile based setup and is capable of detection and connection to a wide range of network types. This is no harder than using graphical tools. Following the directions above, you can get a list of wireless networks. Then, as with graphical tools, you will need a password.

See: Network Profiles, and Network Profiles development

Autowifi

Autowifi is a daemon that configures your wireless network automatically depending on the ESSID. Once configured, no user interaction is necessary and no GUI tools are required.

See: Autowifi

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.

See: Wicd

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.

See: NetworkManager

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.

See: Wifi Radar

Wlassistant

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

Install from AUR: http://aur.archlinux.org/packages.php?ID=1726

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.

See also

External links