User:Zeb/wireless

From ArchWiki
Jump to: navigation, search

Wireless Management (draft)

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’ll need will depend on several factors:

  • The easiness of configuration management, from a completely manual setup procedure that you’ll need to repeat at each boot to a software-managed, automatic, autostarting 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)

Encryption types

WEP

The Wired Equivalent Privacy encryption scheme was introduced in 1997. But the discovery of weaknesses in the WEP algorithm in 2001 have made it a poor choice of wireless security protocol. Some tools, such as aircrack, can break the WEP protection in a couple of minutes. Despite this issue, WEP is still popular and the default encryption scheme in most commercial wireless routers.

WPA/WPA2

The Wi-Fi Protected Access security protocol was created in response to the WEP weaknesses. WPA and especially WPA2, which uses the AES encryption algorithm, are considered secure. Several modes of authentication are supported by WPA/WPA2: a PSK mode (Pre-Shared Key) designed for home and small office use, and an Enterprise (EAP) mode, which requires an authentication server. Wi-Fi certified devices must now provide WPA2. The following instructions will only covered the PSK method.

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 admin 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 userspace 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, all 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

We assume you want to use the essid named MyEssid.

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

  • 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.

Automatically managed, centralized without network profile support

Note: This method and configuration examples are only valid for unencrypted or WEP-encrypted networks, which are particularly unsecure. To use WPA/WPA2, you'll need to use other solutions like using wpa_supplicant manually or network managers, such as netcfg or wicd. Also, avoid mixing these methods as they may create a conflict and prevent the wireless card to function.
  • 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"
Note: 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's the aim of network managers, such as netcfg

Automatically managed, using netcfg network manager

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.

Occasionally, you have to configure wpa_supplicant properly at first, if you want to use an encrypted wireless connection (eg: wep, wpa, wpa2, etc.) in netcfg, because netcfg package depends on wpa_supplicant.

Detailed article: Network Profiles

Detailed article for development version: Network Profiles development

Other wireless management solutions

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

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.

For more information, see the Autowifi 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.

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.

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.