Making wireless work in Ubuntu

767

By Benjamin Mako Hill, Jono Bacon, Ivan Krstic. David J. Murphy, Jonathan Jesse, Peter Savage, Corey Burger

This article is excerpted from the newly published book The Official Ubuntu Book. © Copyright Pearson Education. All rights reserved.

Simply click on the Network-Manager icon to see all available wireless networks, and click on the network to connect to it. If wireless authentication is needed, be it WEP, WPA, or 802.1x, a network-manager dialog will pop up asking for your authentication details.

If network manager does not solve the problem, the first step should be to see which driver your wireless card needs. Do a search for your card on Google and in the Ubuntu Forums to find out which driver you need. Many of the drivers are already included in Ubuntu, but some newer drivers may not be present.

Next, you need to find out if the driver is loaded. As an example, if you have an Intel Centrino and it uses the ipw2200 driver, run this command:

sudo lsmod | grep ipw2200

Replace ipw2200 with the relevant driver for your card. If you get some lines returned, the driver is loaded and working. If nothing is returned, your card is either not supported or the driver is not included in Ubuntu. You should refer to the Ubuntu Forums for further support.

With the card identified, you now need to get connected. The easiest way to do this is to select System -> Administration -> Networking. Inside this tool you should see an icon for your wireless card. Select it and click the Properties button. Add the name of the wireless network and a password if applicable. If you are using a normal password such as s3cr3tpass, select Plain (ASCII) from the Key type box. If you are entering the long numeric password, use the Hexedecimal option. If you don’t have a password on your wireless network, leave the Key type and WEP key boxes empty.

If you are automatically assigned an IP address, use the Configuration box to select DHCP. Otherwise, select Static IP Address, and enter the details of your network in the boxes.

For more information, see the Ubuntu wiki.

Using WPA

To use WPA, you need a supported card. Such cards are listed on the WPA Supplicant Web site. Common drivers that support WPA include ipw2200, ipw2100, and madwifi.

To use WPA (Wi-Fi Protected Access) with wireless cards in Ubuntu, the wpasupplicant package must be installed. After installing it, edit /etc/wpa_supplicant.conf. Networks are configured by adding network blocks to the configuration file. Each network block can also be assigned a priority so if both networks are seen, the higher priority network is chosen. Examples for common network configurations can be found in /usr/share/doc/wpasupplicant/examples/wpa_supplicant.conf.gz.

Some configurations require certificates that should be available from the network administrator. WPA Supplicant can also configure your wireless card to use unencrypted networks, as noted in the example file. After writing the file, edit /etc/default/wpasupplicant and change the ENABLED, DRIVER, and INTERFACE options. The DRIVER option should match the type of wireless device being used. Available drivers can be viewed by typing:

wpa_supplicant -help

To start the Supplicant run:

/etc/init.d/wpasupplicant start

Lastly, wpasupplicant should be added to STOP_SERVICES in /etc/default/ acpi-support to ensure it functions properly after a system suspend or hibernation.

To check if the connection is working, run:

sudo wpa_cli

This command gives information on the current connection along with scrolling logs to indicate the current status. By default wpa_cli must be run as root. Status will show what network the wireless card is currently connected to and parameters about the link. Scan causes the supplicant to look for a new access point while scan_results will display what access points are locally accessible to the machine. As soon as the supplicant authenticates, ifplugd should start the interface with ifup, and networking will be available shortly. If it seems that the supplicant is not working it may be that a different driver must be selected in the /etc/defaults/wpasupplicant configuration file. Also, some cards cannot operate in a mixed TKIP/CCMP (types of encryption) mode. If it appears the PTK listed in the log from wpa_cli is CCMP but that the GTK is TKIP, setting the pairwise and group entries of a network configuration block to TKIP may fix the issue.