Wireless Setup

From ParabolaWiki
Jump to: navigation, search
Summary
A complete guide to enabling and configuring wireless networking.
Overview
Parabola provides netctl for network configuration. netctl supports wired connections on desktops and servers, as well as wireless setups and roaming for mobile users, facilitating easy management of network profiles. NetworkManager and Wicd are popular third-party alternatives.

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 Parabola GNU/Linux-Libre systems: The wireless drivers and tools are available during Parabola set-up in the base group. 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 the installation, simply ensure the required packages are installed with pacman, (driver, wireless_tools, wpa_supplicant, etc.) and follow the guidelines below. Note that wireless_tools may be optional depending on how recent your wireless hardware is.

1 Part I: Identify Card/Install Driver

1.1 Identify and Discover if Supported

First you will need to check and see if the Linux-Libre kernel has support for your card.

1.1.1 Identify your card

You can find your card type by command:

# lspci | grep -i net

Or, if you have a USB device, run:

# lsusb
Note: The internal Wi-Fi card in some laptops may actually be a USB device, so make sure you check both commands.

1.1.2 Discover if the card is supported

  • The Ubuntu Wiki has a good list of wireless cards and whether or not they are supported either in the Linux kernel or by a user-space driver (includes driver name).
  • Linux Wireless Support and The Linux Questions' Hardware Compatibility List (HCL) also have a good database of kernel-friendly hardware.
  • The kernel page additionally has a matrix of supported hardware.

1.1.3 If your card is not listed

If your wireless hardware is not listed above, likely it has no free driver or requires nonfree firmware. We recommend that you use h-node to find a replacement adapter in this case.

1.2 Install user space tools

1.2.1 If you have wired Internet access available

If you have wired Ethernet available and are simply adding wireless functionality to an existing system, and you did not include wireless_tools during initial installation, then install the package wireless_tools.

Note: wireless_tools may not be required depending on the age of your hardware and whether your hardware/drivers support wpa_supplicant. If your configuration is supported well enough to work using only wpa_supplicant, then it is recommended to stick with wpa_supplicant only.

The drivers' corresponding package names are either highlighted in bold or via monospaced font on this page. The packages can be installed during initial package selection on the Parabola installation media and can also be installed later.

1.2.2 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 means of networking other than wireless. Otherwise, you will be stuck in a recursion when you reboot your newly installed Parabola GNU/Linux-Libre system: you will need wireless_tools and drivers, but in order to get them, you will need wireless_tools and drivers.

1.3 Drivers

The default Parabola GNU/Linux-Libre 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 and eth1.

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. Note also that udev may occasionally load more than one driver for a device, and the resulting conflict will prevent successful configuration. Be sure to blacklist the unwanted module.

Methods and procedures for installing kernel modules for various chipsets are covered below. Read Kernel modules for general informations on operations with modules.

1.3.1 rtl8180

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

1.3.2 rtl8187

Realtek rtl8180 (USB) are now fully supported in the kernel. It can be configured using the standard wpa_supplicant and iwconfig tools.

1.3.3 rt2x00

Unified driver for Ralink chipsets (replaces rt2500, rt61, rt73, etc). This driver has been in the Linux kernel since 2.6.24, some devices won't work as they require non-free firmware. It can be configured using the standard wpa_supplicant and iwconfig tools.

1.3.4 ath5k

ath5k is the preferred driver for AR5xxx chipsets and for some older chipsets.

If ath5k is conflicting with ath_pci on your system, blacklist (and unload using rmmod or reboot) the following drivers:

ath_hal
ath_pci
ath_rate_amrr
ath_rate_onoe
ath_rate_sample
wlan
wlan_acl
wlan_ccmp
wlan_scan_ap
wlan_scan_sta
wlan_tkip
wlan_wep
wlan_xauth

then modprobe ath5k manually or reboot. wlan0 (or wlanX) in sta mode should spawn and become ready to use.

Info:

Note: Some laptop have problems with their wireless LED indicator flickering red and blue. To solve this problem, do:
echo none > "/sys/class/leds/ath5k-phy0::tx/trigger"
echo none > "/sys/class/leds/ath5k-phy0::rx/trigger"
For alternatives, look here.
Note: If you find web pages randomly loading very slow in Firefox/Opera/Chromium try to switch from hardware to software encryption:
rmmod ath5k
modprobe ath5k nohwcrypt

And restart your connection. If it helps, make the change permanent by adding into /etc/modprobe.d/010-ath5k.conf:

options ath5k nohwcrypt
More about modprobe options: Modprobe#Options

1.3.5 ath9k

ath9k is Atheros' officially supported driver for the newer 802.11n chipsets. All of the chips with 802.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 Linux kernel as of v2.6.27. Support seems acceptable as of kernel v2.6.32 (see details on linuxwireless.org). (In the unlikely event that you have stability issues that trouble you, you could try using the compat-wireless package. An ath9k mailing list exists for support and development related discussions.)

Info:

2012/04/14: The new kernel 3.3.1 includes a patch that prevent association with an atheros wifi card. See https://bbs.archlinux.org/viewtopic.php?id=139274 for more infos. The previous kernel (3.2.13) don't include this patch and the next one (3.1.2) shouldn't include it.

1.3.6 ath9k_htc

This driver support some Atheros (USB) chipsets. This driver requires a firmware, which was liberated by Atheros. This firmware can be found in the ath9k-htc-firmware package.

The driver is now fully supported in the kernel. It can be configured using the standard wpa_supplicant and iwconfig tools.

1.3.7 carl9170

As explained in the Debian Wiki, this device requires free firmware (GPLv2 licensed). It has been included in the mainline Linux kernel since version 2.6.37, and carl9170 replaces the obsolete ar9170usb driver which was removed at Linux 3.0.

1.3.7.1 Installation

Acquire and install the device firmware:

$ wget 'https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/plain/carl9170-1.fw' -O carl9170-1.fw
$ su
# mkdir /usr/local/lib/firmware
# mv carl9170-1.fw /usr/local/lib/firmware

Connect the device to your system. The carl9170 kernel module is automatically loaded for supported devices. Configure your wireless interface as explained below. If you have any issues, see the driver’s homepage for troubleshooting.

1.4 Test installation

After loading your driver, run ip link to ensure a wireless interface (e.g. wlanX, ethX, athX) is created.

If no such interface is visible, modprobing it might work. To start your driver, use the rmmod and modprobe commands. If rmmod fails, continue with modprobe. See Kernel modules for more info.

Example: If your driver is called "driverXXX", you would run the following commands:

# rmmod driverXXX
# modprobe driverXXX

Bring the interface up with ip link set <interface> up. For example, assuming the interface is wlan0:

# ip link set wlan0 up

If you get this error message: SIOCSIFFLAGS: No such file or directory, it most certainly means your wireless chipset requires a firmware to function, so please see h-node for a replacement wireless adapter.

2 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 required will depend on several factors:

  • The desired nature of configuration management; from a completely manual command line setup procedure repeated at each boot to a software-managed, automated solution
  • The encryption type (or lack thereof) which protects the wireless network
  • The need for network profiles, if the computer will frequently change networks (such as a laptop)

2.1 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 iproute2 + iwconfig + dhcpcd/iproute2 iproute2 + iwconfig + wpa_supplicant + dhcpcd/iproute2
Automatically managed, with network profiles support netcfg, newlan (AUR), wicd, NetworkManager, etc.

More choice guide:

- netcfg+Newlan(AUR) Wicd NetworkManager + network-manager-applet
auto connect at boot with net-profiles daemon configured in /etc/rc.conf yes yes
auto connect if dropped
or changed location
with net-auto-wireless daemon configured in /etc/rc.conf yes yes
support 3G Modem yes
GUI (proposes to manage and connect/disconnect
profiles from a systray icon.
Automatic wireless detection is also available)
with ArchAssistant yes yes
console tools with wifi-select wicd-curses (part of wicd package) nmcli

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 Wi-Fi access point), try connecting with no encryption, to check everything works. Then try using encryption, either WEP (simpler to configure -- but crackable in a matter of seconds, so it is hardly more secure than an unencrypted connection), WPA, or WPA2.

When it comes to ease of use, NetworkManager (with GNOME's network-manager-applet) and wicd have good GUI's and can provide a list of available networks to connect, and they prompt for passwords, which is straightforward and highly recommended.

Note: GNOME's network-manager-applet also works under Xfce if you install xfce4-xfapplet-plugin first. (xfce4-xfapplet-plugin is in the AUR, but it is orphaned and may not work.) Additionally, there are applets available for KDE.

2.1.1 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 user-space 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.

Step 0. (Optional, may be required) At this step you may need to set the proper operating mode of the wireless card. More specifically, if you are going to connect an ad-hoc network, you might need to set the operating mode to ad-hoc:

# iwconfig wlan0 mode ad-hoc
Note: Ideally, you should already know which type of network you are going to connect to. If you do not, scan the network as described in step 2 below, then, if necessary, return back to this step and change the mode. Also, please keep in mind that changing the operating mode might require the wireless interface to be down (ip link set wlan0 down).

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

# ip link set wlan0 up

Step 2. See what access points are available:

# iwlist wlan0 scan
Note: If it displays "Interface doesn't support scanning" then your device probably requires firmware. Please see h-node for a replacement wireless adapter. You can also try bringing up the interface first as shown in point 1. In some cases this message is also displayed when not running iwlist as root. Also, your wireless network card may be soft-blocked. Try getting rfkill and running rfkill list all to check.

Step 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 MyEssid:

Note: The essid is usually just the name of the network you want to connect to.
  • No encryption
# iwconfig wlan0 essid "MyEssid"
  • WEP

using a 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 -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. If connected successfully, continue in a new terminal (or quit wpa_supplicant with Ctrl+c and add the -B switch to the above command to run it in the background). WPA_Supplicant contains more information and troubleshooting.

Regardless of the method used, you can check if you have associated successfully as follows:

 # iwconfig wlan0
Note: In some setups it may still display "Access Point: Not-Associated", continue on to the next step.

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

# dhcpcd wlan0

for DHCP, or

# ip addr add 192.168.0.2/24 dev wlan0
# ip route add default via 192.168.0.1

for static IP addressing.

Note: If you get a timeout error due to a waiting for carrier problem, then you might have to set the channel mode to auto for the specific device.
# iwconfig wlan0 channel auto 

Before changing the channel to auto, make sure your wireless interface (in this case 'wlan0') is down. After it has successfully changed it, you can again bring the interface up and continue from there.

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

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

2.1.2.1 Netcfg

netcfg provides a versatile, robust and fast solution to networking on Parabola GNU Linux-libre.

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

See: Netcfg

2.1.2.2 Netcfg Easy Wireless LAN (newlan)

newlan is a mono console application that starts a user-friendly wizard to create netcfg profiles; it also supports wired connections.

Install the newlan package from the AUR.

newlan must be run with root privileges:

# sudo newlan -n mynewprofile
2.1.2.3 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 available in the official repositories.

See: Wicd

2.1.2.4 NetworkManager

NetworkManager is an advanced network management tool that is enabled by default in most popular GNU/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.

If you do not use GNOME but use a window manager like Openbox or xmonad, do not forget to install polkit-gnome, gnome-keyring, libgnome-keyring, and pyxdg to manage WEP, WPA, and WPA2 connections.

See: NetworkManager

2.1.2.5 WiFi Radar

WiFi Radar is a 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

2.1.2.6 wlassistant

wlassistant is a very intuitive and straight-forward GUI application for managing your wireless connections.

Install the wlassistant package from the AUR.

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 start-up, 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-up delays.

3 See also

4 External links