Cut the Cord: Using Wireless Networking - Networking and the Internet - Ubuntu Linux For Dummies (2007)

Ubuntu Linux For Dummies (2007)

Part II: Networking and the Internet

Chapter 7. Cut the Cord: Using Wireless Networking

In This Chapter

· Introducing wireless networking

· Connecting to unencrypted wireless networks

· Connecting to encrypted wireless networks

· Using a Windows wireless network interface driver

How did people ever live without wireless networking? Before wireless fidelity networking — WiFi (pronounced WHY-fye), for short — we were tethered to our Ethernet cables — or worse, to telephone cords and dialup modems. In retrospect, it was like living without electricity or telephones — or for younger readers, without cellphones and text messaging.

Fortunately, the smart people from the IEEE (Institute of Electrical and Electronics Engineers) realized what wireless networking could achieve using radio frequency (RF) transmissions. The IEEE had previously designed the specifications used to create wired networking and decided to extend those protocols into the wireless realm. After the wireless protocols were designed, manufacturers used them to create the WiFi products we use today.

This chapter describes how to connect your Ubuntu computer — laptop or desktop — to an existing wireless network. I tell you how you can make three different types of connections using a Linux-compatible wireless network interface (also called a network device or a network interface adapter — NIC). You can do it without encryption and with either WEP (wired equivalent privacy) or WPA/WPA2 (WiFi Protected Access) encryption. I also tell you how you can adapt existing proprietary Windows wireless network interface drivers for use by Ubuntu when no Linux open source driver exists for your WiFi device.

Preparing for Wireless Networking

I assume that you connect to a pre-existing wireless network. Many businesses and organizations provide publicly accessible wireless networks on their premises.

You can also create a wireless network for yourself by purchasing an access point (AP) to connect to your private network. Many consumer-level APs cost less than $100 and are available in any electronics store. Follow the manufacturer's instructions to configure your own private wireless network.

Quick start: Getting connected fast

Before describing any details about what wireless networking is and how it works, I can help you get connected to one. The process is easy if Ubuntu provides a driver for your wireless network interface — in that case, you just connect to a wireless network. When it's connected, you can explore wireless networking at your leisure.

1. Plug your wireless network interface into your computer if you're using an external PCMCIA or USB device.

You must turn on some built-in wireless network interfaces; for instance, some laptop computers have a power switch for the device. In that case, turn on your computer's interface.

PCMCIA is short for Personal Computer . . . take a breath . . . Memory Card International Association (although some sources define it as Peripheral Component MicroChannel Interconnect Architecture). USB is the acronym for universal serial bus.

2. If necessary, boot your Ubuntu computer.

3. Log in to your user account.

4. From the GNOME menu bar, choose SystemAdministration Networking.

If you haven't recently performed an administrative task, the Enter Your Password to Perform Administrative Tasks dialog opens.

5. Type your password if prompted.

The Network Settings dialog opens, showing all your network interfaces. Figure 7-1 shows a typical window with three network interfaces: a wireless interface, a wired (Ethernet) interface, and a modem.

Figure 7-1: The Network Settings dialog showing the available network interfaces.

The Network Settings dialog is the front end to the Network Administration Tool utility, which is the default Ubuntu network configuration utility.

The dialog shows a wireless interface if Ubuntu has a compatible driver for the interface. In that case, locate the instructions in one of the following sections that describe how to connect to the type of wireless network you want to use. The following list describes the subsection, found in the "Connecting to Access Points" section, that you should go to depending on the type of wireless network you're connecting to:

· Unencrypted APs: When connecting to a wireless network that does not use encryption.

· WEP-encrypted APs: When connecting to a wireless network using the WEP encryption.

· WPA-encrypted APs: When connecting to a wireless network using either WPA or WPA2 encryption.

If you don't see any wireless interfaces, this chapter shows how to obtain or configure a driver in the "Obtaining a wireless network interface" section.

Wireless networking basics

Wireless networks use common radio signals used to create wireless networks and generally have a range of between 50 and 100 meters (about 150 to 300 feet). The signal range can be reduced by

· Weather

· Physical barriers (such as doors, walls, and windows)

The radio frequencies used by wireless networks are regulated by the Federal Communications Commission (FCC) in the United States and equivalent governmental agencies in other countries. The FCC designates certain parts of the electromagnetic spectrum — from low-frequency radio waves to light, X-rays, and beyond — for various purposes. For instance, the FCC licenses AM and FM frequencies to radio stations, and likewise for television stations. However, the FCC designates some frequencies for nonlicensed use. Cellphones, portable phones, garage door openers, microwaves, wireless networks, and many other devices all use nonlicensed frequencies. Wireless network devices use the 2.4 GHz (gigahertz, or billion cycles per second) frequency.

Security standards

Three different levels of security are available if you use a wireless network: high, low, and none.

High-security options

If you transmit sensitive information or conduct business over a wireless network, you should use one of these high-security options. High-security options include the WPA and WPA2 encryption standards.

WPA2 encryption

WPA2 encryption provides the best wireless network protection. It's compatible with

· Most 802.11g wireless network interfaces and APs

Upgrading your wireless networking equipment to 802.11g usually is worth the expense.

· Some 802.11b cards that can be upgraded by installing firmware updates

WPA encryption

WPA encryption is much more secure than WEP (the original WiFi encryption), but not as secure as WPA2.

If your wireless network interface or AP currently provides WPA, you can probably upgrade it to WPA2 (the highest security level). Check the device manufacturer's Web site for firmware upgrades that add WPA2 capability.

WPA is designed to work with

· All 802-11g wireless network interfaces

· All access points, except first-generation ones

VPN (virtual private network) encryption

VPNs (virtual private networks) can safely encrypt information transmitted over unencrypted wireless networks.

Appendix B shows how to create an encrypted VPN on an unencrypted wireless network using the open source security tool OpenSSH.

Low security

WEP encryption was the first encryption method used on wireless networks. It's a little better than nothing at all. It might prevent unauthorized users from easily seeing your information, but it might be beaten by a hacker armed with the right tools and plenty of Jolt Cola and cheezpuffs.

Don't trust WEP encryption if you need to keep hackers out. WEP can be cracked using common software tools.

No security

Without any encryption, anyone in relatively close proximity can easily capture (sniff) and read your WiFi-transmitted information.

You might not need security when using a public WiFi network to view a sports page or the news. But don't transmit sensitive information or conduct business without using either wireless encryption or an encrypted VPN.

Wireless standards

When you have a wireless network, you need to connect to it. Ubuntu supports many wireless network interfaces (also called wireless network adapters or WiFi network adapters).

Table 7-1 compares current and future wireless standards, but three standards are common for wireless network interfaces:

· 802.11b networks are the slowest standard.

· 802.11g networks are up to five times as fast as 802.11b.

· 802.11inetworks are based on the 802.11g standard but use improved encryption, called WPA2.

Most new wireless network interfaces work with both 802.11b and 802.11g networks.

· 802.11a interfaces were considerably more expensive than 802.11b. 802.11a never achieved commercial success and is seldom used.

· 802.11n will be the next generation of wireless networking. The 802.11n standard has been adopted in draft form but hasn't yet become official. At the time of publication, a few wireless network interface devices based on the draft form of 802.11n are on the market; these are called Pre-N. Few Linux drivers exist at this time.

Table 7-1: Wireless Network Standards

Standard

Introduction Year

Speed (Maximum)

Range (Maximum)

802.11a

1999

54Mbs

30 meters (100 feet)

802.11b

1999

11Mbs

100 meters (330 feet)

802.11g

2003

54Mbs

30 meters (100 feet)

802.11i

2004

54Mbs

30 meters (110 feet)

802.11n

2007 (or later)

540Mbs

50 meters (165 feet)

Network scenarios

You'll find yourself in one of two situations when trying to connect your Ubuntu computer to a WiFi network:

· Have at least one wireless network interface.

You already own

o A laptop with a built-in wireless network device

and/or

o A PCMCIA or USB device

In that case, the section "Using an existing wireless network interface" shows what you need to do.

· Need to purchase a wireless network interface.

The section "Obtaining a wireless network interface" shows what you need to know when purchasing a device.

Using an existing wireless network interface

When you already have a wireless network interface, you need to discover whether the device works with Ubuntu. There are two ways that your device might work:

· Ubuntu provides Linux drivers for many wireless devices.

· Ubuntu provides a utility that allows you to use a Microsoft Windows device driver when no native Linux one exists.

Linux device drivers allow the device to work with the Linux kernel. Technically, Linux device drivers are actually Linux kernel modules. Kernel modules dynamically plug into the running Linux kernel and provide the connection to the device.

Here's one way to check if a wireless network interface works with Ubuntu:

1. Plug the PCMCIA or USB wireless network interface into your computer.

If you're using a laptop with an embedded wireless network device, make sure it's turned on. Install a PCI wireless network interface on your desktop computer if using such a device.

2. From the GNOME menu bar, choose SystemAdministrationNetworking.

If you haven't recently performed an administrative task, the Enter Your Password to Perform Administrative Tasks dialog opens.

3. Type your password if prompted.

The Network Settings dialog opens, showing all of your network interfaces.

4. Look for a wireless interface option.

If the Network Settings dialog shows a wireless network interface, wireless networking is supported, and you can start configuring the device. Proceed to one of the following sections that matches your wireless network's capabilities:

· "Unencrypted AP": Use only unencrypted wireless networks if no other option exists. Public APs often provide unencrypted service.

Be careful when using unencrypted public networks. You should assume that all your communications are being monitored. Try to use a virtual private network (VPN) if at all possible to encrypt your network traffic. (Appendix B shows how to use OpenSSH to create your own VPN.) Your computer is more vulnerable to attack when using such networks because it's easier for hackers to use the network to exploit any vulnerabilities in your computer.

· "WEP-encrypted AP": WEP encryption is better than no encryption but can be broken with a moderate amount of effort. If possible, you should upgrade to WPA2, or at least WPA, rather than continue to use WEP.

· "WPA-encrypted AP": WPA offers adequate encryption, which falls between WEP and WPA2. You should definitely use WPA in place of WEP, but use WPA2 if your equipment supports that protocol.

· "WPA2-encrypted AP": WPA2 offers the best wireless network encryption. You can sleep well at night if you use properly configured WPA2.

Displaying your network information

You can use the lshw utility to view your Ubuntu computer's network interfaces. Type the command lshw -C network and you see all information about your interfaces. For instance, the following listing shows my computer's interfaces:

Code View:

*-network:0

description: Wireless interface

product: BCM4306 802.11b/g Wireless LAN Controller

vendor: Broadcom Corporation

physical id: 9

bus info: pci@00:09.0

logical name: wlan0

version: 02

serial: 00:90:4b:48:4a:25

width: 32 bits

clock: 33MHz

capabilities: bus_master cap_list ethernet physical wireless

configuration: broadcast=yes driver=ndiswrapper driverversion=1.22 firmware=Broadcom,03/19/2003, 3.10.53.0 ip=192.168.2.101 link=yes multicast=yes wireless=IEEE 802.11b

resources: iomemory:d0004000-d0005fff irq:10

*-network:1

description: Ethernet interface

product: DP83815 (MacPhyter) Ethernet Controller

vendor: National Semiconductor Corporation

physical id: 12

bus info: pci@00:12.0

logical name: eth0

version: 00

serial: 00:0d:9d:82:22:3c

size: 10MB/s

capacity: 100MB/s

width: 32 bits

clock: 33MHz

capabilities: bus_master cap_list ethernet physical tp mii fibre 10bt 10bt-fd 100bt 100bt-fd autonegociation

configuration: autonegociation=on broadcast=yes driver=natsemi driverversion=1.07+LK1.0.17 duplex=half link=no multicast=yes port=twisted pair speed=10MB/s

resources: ioport:8c00-8cff iomemory:d000a000-d000afff irq:11

This output shows detailed information about your network interfaces. Note that if lshw shows the wireless network interface to be disabled, you haven't loaded the necessary driver. In that case, you might be able to use a Windows driver to run the device. The "Using a Windows Device Driver" section later in this chapter describes how to use a Windows device driver to enable the wireless device under Ubuntu.

Obtaining a wireless network interface

If you need to purchase or borrow a wireless network interface, there are nearly 200 commercially available devices to choose from. Ubuntu provides a convenient and detailed table at https://help.ubuntu.com/community/WifiDocs/WirelessCardsSupported. This table provides information about the manufacturer and model plus whether and how well each device works with Ubuntu Linux. You can use this information to find a Linux-capable, wireless network interface before purchasing one.

Some manufacturers place a Linux sticker on their products. Look for the decal before purchasing a wireless device.

Chapter 7. Cut the Cord: Using Wireless Networking

In This Chapter

· Introducing wireless networking

· Connecting to unencrypted wireless networks

· Connecting to encrypted wireless networks

· Using a Windows wireless network interface driver

How did people ever live without wireless networking? Before wireless fidelity networking — WiFi (pronounced WHY-fye), for short — we were tethered to our Ethernet cables — or worse, to telephone cords and dialup modems. In retrospect, it was like living without electricity or telephones — or for younger readers, without cellphones and text messaging.

Fortunately, the smart people from the IEEE (Institute of Electrical and Electronics Engineers) realized what wireless networking could achieve using radio frequency (RF) transmissions. The IEEE had previously designed the specifications used to create wired networking and decided to extend those protocols into the wireless realm. After the wireless protocols were designed, manufacturers used them to create the WiFi products we use today.

This chapter describes how to connect your Ubuntu computer — laptop or desktop — to an existing wireless network. I tell you how you can make three different types of connections using a Linux-compatible wireless network interface (also called a network device or a network interface adapter — NIC). You can do it without encryption and with either WEP (wired equivalent privacy) or WPA/WPA2 (WiFi Protected Access) encryption. I also tell you how you can adapt existing proprietary Windows wireless network interface drivers for use by Ubuntu when no Linux open source driver exists for your WiFi device.

Preparing for Wireless Networking

I assume that you connect to a pre-existing wireless network. Many businesses and organizations provide publicly accessible wireless networks on their premises.

You can also create a wireless network for yourself by purchasing an access point (AP) to connect to your private network. Many consumer-level APs cost less than $100 and are available in any electronics store. Follow the manufacturer's instructions to configure your own private wireless network.

Quick start: Getting connected fast

Before describing any details about what wireless networking is and how it works, I can help you get connected to one. The process is easy if Ubuntu provides a driver for your wireless network interface — in that case, you just connect to a wireless network. When it's connected, you can explore wireless networking at your leisure.

1. Plug your wireless network interface into your computer if you're using an external PCMCIA or USB device.

You must turn on some built-in wireless network interfaces; for instance, some laptop computers have a power switch for the device. In that case, turn on your computer's interface.

PCMCIA is short for Personal Computer . . . take a breath . . . Memory Card International Association (although some sources define it as Peripheral Component MicroChannel Interconnect Architecture). USB is the acronym for universal serial bus.

2. If necessary, boot your Ubuntu computer.

3. Log in to your user account.

4. From the GNOME menu bar, choose SystemAdministration Networking.

If you haven't recently performed an administrative task, the Enter Your Password to Perform Administrative Tasks dialog opens.

5. Type your password if prompted.

The Network Settings dialog opens, showing all your network interfaces. Figure 7-1 shows a typical window with three network interfaces: a wireless interface, a wired (Ethernet) interface, and a modem.

Figure 7-1: The Network Settings dialog showing the available network interfaces.

The Network Settings dialog is the front end to the Network Administration Tool utility, which is the default Ubuntu network configuration utility.

The dialog shows a wireless interface if Ubuntu has a compatible driver for the interface. In that case, locate the instructions in one of the following sections that describe how to connect to the type of wireless network you want to use. The following list describes the subsection, found in the "Connecting to Access Points" section, that you should go to depending on the type of wireless network you're connecting to:

· Unencrypted APs: When connecting to a wireless network that does not use encryption.

· WEP-encrypted APs: When connecting to a wireless network using the WEP encryption.

· WPA-encrypted APs: When connecting to a wireless network using either WPA or WPA2 encryption.

If you don't see any wireless interfaces, this chapter shows how to obtain or configure a driver in the "Obtaining a wireless network interface" section.

Wireless networking basics

Wireless networks use common radio signals used to create wireless networks and generally have a range of between 50 and 100 meters (about 150 to 300 feet). The signal range can be reduced by

· Weather

· Physical barriers (such as doors, walls, and windows)

The radio frequencies used by wireless networks are regulated by the Federal Communications Commission (FCC) in the United States and equivalent governmental agencies in other countries. The FCC designates certain parts of the electromagnetic spectrum — from low-frequency radio waves to light, X-rays, and beyond — for various purposes. For instance, the FCC licenses AM and FM frequencies to radio stations, and likewise for television stations. However, the FCC designates some frequencies for nonlicensed use. Cellphones, portable phones, garage door openers, microwaves, wireless networks, and many other devices all use nonlicensed frequencies. Wireless network devices use the 2.4 GHz (gigahertz, or billion cycles per second) frequency.

Security standards

Three different levels of security are available if you use a wireless network: high, low, and none.

High-security options

If you transmit sensitive information or conduct business over a wireless network, you should use one of these high-security options. High-security options include the WPA and WPA2 encryption standards.

WPA2 encryption

WPA2 encryption provides the best wireless network protection. It's compatible with

· Most 802.11g wireless network interfaces and APs

Upgrading your wireless networking equipment to 802.11g usually is worth the expense.

· Some 802.11b cards that can be upgraded by installing firmware updates

WPA encryption

WPA encryption is much more secure than WEP (the original WiFi encryption), but not as secure as WPA2.

If your wireless network interface or AP currently provides WPA, you can probably upgrade it to WPA2 (the highest security level). Check the device manufacturer's Web site for firmware upgrades that add WPA2 capability.

WPA is designed to work with

· All 802-11g wireless network interfaces

· All access points, except first-generation ones

VPN (virtual private network) encryption

VPNs (virtual private networks) can safely encrypt information transmitted over unencrypted wireless networks.

Appendix B shows how to create an encrypted VPN on an unencrypted wireless network using the open source security tool OpenSSH.

Low security

WEP encryption was the first encryption method used on wireless networks. It's a little better than nothing at all. It might prevent unauthorized users from easily seeing your information, but it might be beaten by a hacker armed with the right tools and plenty of Jolt Cola and cheezpuffs.

Don't trust WEP encryption if you need to keep hackers out. WEP can be cracked using common software tools.

No security

Without any encryption, anyone in relatively close proximity can easily capture (sniff) and read your WiFi-transmitted information.

You might not need security when using a public WiFi network to view a sports page or the news. But don't transmit sensitive information or conduct business without using either wireless encryption or an encrypted VPN.

Wireless standards

When you have a wireless network, you need to connect to it. Ubuntu supports many wireless network interfaces (also called wireless network adapters or WiFi network adapters).

Table 7-1 compares current and future wireless standards, but three standards are common for wireless network interfaces:

· 802.11b networks are the slowest standard.

· 802.11g networks are up to five times as fast as 802.11b.

· 802.11inetworks are based on the 802.11g standard but use improved encryption, called WPA2.

Most new wireless network interfaces work with both 802.11b and 802.11g networks.

· 802.11a interfaces were considerably more expensive than 802.11b. 802.11a never achieved commercial success and is seldom used.

· 802.11n will be the next generation of wireless networking. The 802.11n standard has been adopted in draft form but hasn't yet become official. At the time of publication, a few wireless network interface devices based on the draft form of 802.11n are on the market; these are called Pre-N. Few Linux drivers exist at this time.

Table 7-1: Wireless Network Standards

Standard

Introduction Year

Speed (Maximum)

Range (Maximum)

802.11a

1999

54Mbs

30 meters (100 feet)

802.11b

1999

11Mbs

100 meters (330 feet)

802.11g

2003

54Mbs

30 meters (100 feet)

802.11i

2004

54Mbs

30 meters (110 feet)

802.11n

2007 (or later)

540Mbs

50 meters (165 feet)

Network scenarios

You'll find yourself in one of two situations when trying to connect your Ubuntu computer to a WiFi network:

· Have at least one wireless network interface.

You already own

o A laptop with a built-in wireless network device

and/or

o A PCMCIA or USB device

In that case, the section "Using an existing wireless network interface" shows what you need to do.

· Need to purchase a wireless network interface.

The section "Obtaining a wireless network interface" shows what you need to know when purchasing a device.

Using an existing wireless network interface

When you already have a wireless network interface, you need to discover whether the device works with Ubuntu. There are two ways that your device might work:

· Ubuntu provides Linux drivers for many wireless devices.

· Ubuntu provides a utility that allows you to use a Microsoft Windows device driver when no native Linux one exists.

Linux device drivers allow the device to work with the Linux kernel. Technically, Linux device drivers are actually Linux kernel modules. Kernel modules dynamically plug into the running Linux kernel and provide the connection to the device.

Here's one way to check if a wireless network interface works with Ubuntu:

1. Plug the PCMCIA or USB wireless network interface into your computer.

If you're using a laptop with an embedded wireless network device, make sure it's turned on. Install a PCI wireless network interface on your desktop computer if using such a device.

2. From the GNOME menu bar, choose SystemAdministrationNetworking.

If you haven't recently performed an administrative task, the Enter Your Password to Perform Administrative Tasks dialog opens.

3. Type your password if prompted.

The Network Settings dialog opens, showing all of your network interfaces.

4. Look for a wireless interface option.

If the Network Settings dialog shows a wireless network interface, wireless networking is supported, and you can start configuring the device. Proceed to one of the following sections that matches your wireless network's capabilities:

· "Unencrypted AP": Use only unencrypted wireless networks if no other option exists. Public APs often provide unencrypted service.

Be careful when using unencrypted public networks. You should assume that all your communications are being monitored. Try to use a virtual private network (VPN) if at all possible to encrypt your network traffic. (Appendix B shows how to use OpenSSH to create your own VPN.) Your computer is more vulnerable to attack when using such networks because it's easier for hackers to use the network to exploit any vulnerabilities in your computer.

· "WEP-encrypted AP": WEP encryption is better than no encryption but can be broken with a moderate amount of effort. If possible, you should upgrade to WPA2, or at least WPA, rather than continue to use WEP.

· "WPA-encrypted AP": WPA offers adequate encryption, which falls between WEP and WPA2. You should definitely use WPA in place of WEP, but use WPA2 if your equipment supports that protocol.

· "WPA2-encrypted AP": WPA2 offers the best wireless network encryption. You can sleep well at night if you use properly configured WPA2.

Displaying your network information

You can use the lshw utility to view your Ubuntu computer's network interfaces. Type the command lshw -C network and you see all information about your interfaces. For instance, the following listing shows my computer's interfaces:

Code View:

*-network:0

description: Wireless interface

product: BCM4306 802.11b/g Wireless LAN Controller

vendor: Broadcom Corporation

physical id: 9

bus info: pci@00:09.0

logical name: wlan0

version: 02

serial: 00:90:4b:48:4a:25

width: 32 bits

clock: 33MHz

capabilities: bus_master cap_list ethernet physical wireless

configuration: broadcast=yes driver=ndiswrapper driverversion=1.22 firmware=Broadcom,03/19/2003, 3.10.53.0 ip=192.168.2.101 link=yes multicast=yes wireless=IEEE 802.11b

resources: iomemory:d0004000-d0005fff irq:10

*-network:1

description: Ethernet interface

product: DP83815 (MacPhyter) Ethernet Controller

vendor: National Semiconductor Corporation

physical id: 12

bus info: pci@00:12.0

logical name: eth0

version: 00

serial: 00:0d:9d:82:22:3c

size: 10MB/s

capacity: 100MB/s

width: 32 bits

clock: 33MHz

capabilities: bus_master cap_list ethernet physical tp mii fibre 10bt 10bt-fd 100bt 100bt-fd autonegociation

configuration: autonegociation=on broadcast=yes driver=natsemi driverversion=1.07+LK1.0.17 duplex=half link=no multicast=yes port=twisted pair speed=10MB/s

resources: ioport:8c00-8cff iomemory:d000a000-d000afff irq:11

This output shows detailed information about your network interfaces. Note that if lshw shows the wireless network interface to be disabled, you haven't loaded the necessary driver. In that case, you might be able to use a Windows driver to run the device. The "Using a Windows Device Driver" section later in this chapter describes how to use a Windows device driver to enable the wireless device under Ubuntu.

Obtaining a wireless network interface

If you need to purchase or borrow a wireless network interface, there are nearly 200 commercially available devices to choose from. Ubuntu provides a convenient and detailed table at https://help.ubuntu.com/community/WifiDocs/WirelessCardsSupported. This table provides information about the manufacturer and model plus whether and how well each device works with Ubuntu Linux. You can use this information to find a Linux-capable, wireless network interface before purchasing one.

Some manufacturers place a Linux sticker on their products. Look for the decal before purchasing a wireless device.

Connecting to Access Points

The process of connecting to an access point depends on the type of encryption it uses. The following sections show how to connect to

· Unencrypted APs

This book shows how to securely encrypt messages over unencrypted networks.

· WEP-encrypted APs

· WPA-encrypted APs

Unencrypted APs

Connecting to an unencrypted AP is the easiest way to use your Ubuntu computer on a wireless network.

Public WiFi hot spots usually aren't encrypted.

Secure Sockets Layer (SSL) encryption

Using an unencrypted connection is not necessarily as unsecure as it sounds. Using Secure Sockets Layer (SSL) encryption protects your communication even on unencrypted wireless networks.

· Most Web sites that conduct business or collect sensitive information use Secure Sockets Layer (SSL) encryption.

· You can configure your e-mail client to use SSL to encrypt incoming and outgoing messages.

You can tell if you're connected to an SSL-enabled Web site by the closed lock symbol at the bottom-left or bottom-right corner of your browser. SSL Web addresses always are preceded by the https prefix, not the non-encrypted http prefix.

If you don't care about anyone being theoretically able to view your Web browsing habits, you should feel comfortable about connecting to unencrypted wireless networks. Make sure you're using an SSL connection when conducting business or reading/sending sensitive information. I recommend always using SSL to send and receive e-mail whether using an unencrypted or encrypted connection.

If you're running your own unencrypted wireless network AP, you have to consider uninvited guests mooching your network resources. Anyone in your immediate vicinity, say 100 to 200 feet (or further with advanced wireless equipment) can connect to your access point and use your Internet connection; they can also sniff and possibly attack your private network. If you want to run an unencrypted wireless network, consider using the OpenSSH-based VPN described in Appendix B to protect both your information and resources.

Appendix B shows how to use and build an unencrypted wireless network and use OpenSSH to create a virtual private network (VPN) to authenticate and encrypt all Web and e-mail traffic on that network.

If Ubuntu supports your WiFi network adapter, making the connection is easy. You just need to know the name (ESSID) of the network. Follow these steps:

1. Turn on your computer's WiFi network interface.

o If you're using an external PCMCIA or USB WiFi network interface, plug it into your computer.

o If your desktop PC doesn't have a WiFi interface, install one in your desktop PC.

2. If necessary, log in to your Ubuntu user account.

3. From the GNOME menu bar, choose SystemAdministrationNetworking.

If you haven't recently performed an administrative task, the Enter Your Password to Perform Administrative Tasks dialog opens.

4. Type your password if prompted.

The Network Settings dialog opens. Refer to Figure 7-1 , which shows a typical configuration including a wireless network interface.

5. Select the Wireless Connection option and click the Properties button.

The Settings for Interface dialog opens. Figure 7-1 shows the dialog.

Figure 7-1: The Settings for Interface dialog.

· Type the name of the AP you want to connect to in the Network Name (ESSID) text box.

The AP name isn't case sensitive.

When you're connecting to an unencrypted network, leave the Network Password text box blank.

Figure 7-3 shows an example dialog with the ESSID set to plinky.

Figure 7-3: Example of the Settings for Interface dialog.

· Click the OK button.

Control returns to the Network Settings dialog.

· Select the Wireless Interface check box.

The Activating Network Interface dialog opens while Ubuntu connects to the AP — the WiFi network interface connects to the AP, and the AP gives your computer its IP address and other essential network parameters. The dialog closes when the connection is made, and your Ubuntu computer is connected to the wireless network.

Anyone in the vicinity with a wireless-capable computer with the right — easily obtainable — software can read your communications if you don't use encryption.

WEP-encrypted APs

Using WEP (wired equivalent privacy) to encrypt your WiFi communication is almost as easy as using an unencrypted connection.

Unfortunately, cracking WEP-based encryption is relatively easy, too. WEP gives you enough protection unless someone specifically wants entry to your network.

If the information that you will transmit over the wireless network is too valuable to put at risk, don't use WEP.

Configuring Ubuntu to connect to a WEP-encrypted network is easy. You just need to know the name (ESSID) of the network and the WEP password. Follow these steps:

1. Make sure that your wireless device is ready to use before connecting to a wireless network.

You might need to either turn on your computer's internal WiFi network interface or plug an external PCMCIA or USB WiFi network interface into your computer.

2. If necessary, log in to your Ubuntu user account.

3. From the GNOME menu bar, choose SystemAdministrationNetworking.

If you haven't recently performed an administrative task, the Enter Your Password to Perform Administrative Tasks dialog opens.

4. Type your password if prompted.

The Network Settings dialog opens. Refer to Figure 7-1 , which shows a typical configuration including a wireless network interface.

5. Select the Wireless Connection option and click the Properties button.

The Settings for Interface dialog opens.

6. Type the name of the AP you want to connect to in the Network Name (ESSID) text box.

Refer to Figure 7-1 for a sample ESSID (wireless network name) entry.

7. From the Password Type drop-down menu, choose the Plain (ASCII) option if that's what your AP uses.

If you enter a plain-text password, that password is ultimately converted to binary. However, plain text is much easier to remember than hexadecimal.

Hexadecimal is an easier way to represent a binary number. Rather than work directly with 1s and 0s, hexadecimal (hex, for short) converts four binary bits into an alphanumeric character. For instance, the number 1 (in decimal) is 0001 in binary and 1 in hex. The number 2 is 0010 in binary and 2 in hex, skipping to 9 is 1001 and 9 in hex. However, the number 10 is 1010 in binary but A in hex. The maximum value in hex is F, which is 15 in decimal and 1111 in binary.

8. Type your WEP encryption key (either in hexadecimal or plain text format) in the Network Password text box.

9. Click the OK button.

Control returns to the Network Settings dialog.

10. Select the Wireless Interface check box.

The Activating Network Interface dialog opens while Ubuntu connects to the AP — the WiFi network interface connects to the AP, and the AP gives your computer its IP address and other essential network parameters. The dialog closes after the connection is made.

WPA-encrypted APs

The IEEE designed the 802.11i wireless security standard, which is commonly called WPA2, to solve WEP's shortcomings. The Wi-Fi Alliance represents wireless device manufacturers' adopted parts of the 802.11i standard during its development to create an interim version they called WPA. WPA encryption is better than WEP, and WPA2 improves upon WPA.

WPA doesn't completely protect your wireless network but it's more secure than WEP. WPA2, however, gives you rock-solid encryption. Today, WPA is still more commonly available than WPA2. Use WPA2, if at all possible, and WPA if not.

Configuring WPA2 or WPA is more difficult than using either an unencrypted or WEP-protected connection. Neither WPA2 nor WPA is as widely supported by Linux as WEP. I show you how to use WPA if your WiFi network interface can support it.

Using WPA2/WPA requires a two-step configuration process. You need to do the following to use WPA2:

1. Install the NetworkManager package.

2. Configure your WiFi device for WPA2 or WPA encryption using the NetworkManager.

The following two sections describe how to perform each step.

Installing the NetworkManager

You can use the Synaptic Package Manager to install NetworkManager from an Ubuntu Internet-based software repository. You need to connect to the Internet to access the package. Unfortunately, your Ubuntu disc doesn't contain the package. Follow these steps:

1. Use Chapter 6, 8, or 9 to connect your Ubuntu computer to the Internet — if you don't already have a connection.

The NetworkManager package isn't very large. You can easily use a dialup Internet connection to install the package.

2. If necessary, log in to your Ubuntu user account.

3. From the GNOME menu bar, choose SystemAdministrationSynaptic Package Manager.

If you haven't recently performed an administrative task, the Enter Your Password to Perform Administrative Tasks dialog opens.

4. Type your password in the Password text box and press the Enter key.

The Synaptic Package Manager opens.

5. Click the Search button.

The Find dialog opens.

6. Type network=manager in the Search text box and click the Search button.

The Search dialog exits, and you see the network-manager and two related packages displayed in the Synaptic Package Manager window.

7. Select the Network-Manager-Gnome check box and choose the Mark for Installation option from the drop-down menu that opens.

The Mark Additional Required Changes dialog opens. The dialog tells you that the network-manager-gnome package and several other packages will be installed along with the network-manager-gnome package.

8. Click the Mark button.

Control returns to the Synaptic Package Manager window, which shows the network-manager and network-manager-gnome packages marked for installation.

9. Click the Apply button.

The Apply dialog opens, telling you that you're about to install packages.

10. Click the Apply button.

The Applying Changes dialog opens, showing the progress of the package download and installation process. The Close button activates when the installation process finishes.

11. Click the Close button.

Control returns to the Synaptic Package Manager window.

12. Click the File menu and choose Quit.

You can manually install the NetworkManager using the apt-get command. Open a GNOME Terminal window and type the command sudo apt-get install network-manager-gnome. Enter your password if prompted and apt-get downloads and then installs the network-manager-gnome and network-manager packages.

The NetworkManager is installed but not quite yet ready to use.

Disabling network interfaces to enable NetworkManager

The NetworkManager can't manage preconfigured wireless network interfaces. In order to use NetworkManager to control your network interfaces, you must first disable them.

Disabling a device is simple using the Ubuntu network configuration utility:

1. From the GNOME menu bar, choose SystemAdministrationNetworking.

The Network Settings dialog opens. Refer to Figure 7-1 to see the dialog.

2. Click to select a network interface.

In this case, you should select the wireless network interface that you want to use the NetworkManager to configure. The network interface is highlighted when you click it.

3. Click the Properties button.

The Settings for Interface dialog opens. Refer to Figure 7-1 to see a sample dialog.

4. Deselect the Enable this Connection radio button.

Click the button only if it's already selected (enabled). You want to disable the interface in order to use the NetworkManager to control the interface. Clicking a disabled interface will enable it, which is what we don't want to do.

5. Click the OK button.

Control returns to the Network Settings window.

6. Repeat Steps 2 through 5 to select and disable every network interface that you wish to configure with the NetworkManager.

You could also manually disable devices by editing the /etc/network/interfaces file:

1. Make a backup copy of the file — for instance, cp /etc/network/interfaces /etc/network/interfaces.bak.

2. Delete every line except the two relating to the loopback (lo) device.

The NetworkManager can control and configure every device that you disable. This includes wired Ethernet and dialup modem devices.

Configuring your wireless network interface using NetworkManager

In this section, I tell you how you can configure your wireless network interface to use WPA or WPA2 encryption.

Not all wireless network interfaces can use WPA or WPA2. Older 802-11b-based devices generally can't use WPA or WPA2; the exceptions are ones whose manufacturers provide firmware updates — check your manufacturer's Web site for information about obtaining and installing an upgrade. Newer 802-11g devices can use WPA but not necessarily WPA2. Once again, check your manufacturer's Web site for your device's capabilities.

When you've installed the NetworkManager and disabled any devices you want to control with it, you're ready to go. The configuration process starts with you logging out and then back in to your user account.

By default, Ubuntu displays the Network Monitor icon on the upper GNOME panel. The Network Monitor icon looks similar to the NetworkManager icon. I get easily confused — really easily — so I like to remove the Network Settings icon to ease the strain on my brain. Right-click the Network Settings icon and select the Remove from Panel option, and that bit of confusion ends.

1. From the GNOME menu bar, choose SystemQuit.

2. Click the Log Out option in the dialog that opens.

Ubuntu logs you out of your user account. You're automatically logged back in after 10 seconds if you're working from a live Ubuntu disc. Otherwise, when working from a permanent Ubuntu installation, you must type your username and password to log back in to your user account.

When you've logged back in to your user account, the NetworkManager recognizes your wireless devices — and any others that you disabled in the section "Disabling network interfaces to enable NetworkManager." The NetworkManager icon appears toward the left side of the upper GNOME panel, as shown in Figure 7-1 ; note that the red exclamation symbol indicates that no network interfaces have been configured.

Figure 7-1: The NetworkManager icon in the GNOME panel.

Click the NetworkManager icon and a dialog opens, showing the state of your network interfaces. Figure 7-1 shows an example of a laptop computer with three network interfaces — a wired Ethernet interface, which is inactive, and two wireless networks: blinky and plinky. (In this case, the Broadcom wireless interface is built into the laptop, but Linux doesn't provide a WPA-capable driver. Therefore, I'm using an external PCMCIA Proxim interface, based on the supported Atheros chipset, which is WPA capable. In this example, I use the Proxim network interface to connect to the plinky wireless network.)

Figure 7-1: NetworkManager showing three network interfaces.

Follow these steps to configure the Ubuntu computer to connect to a wireless network:

1. Click the NetworkManager icon.

A dialog similar to the one shown in Figure 7-1 opens, showing the available network interfaces and the available wireless networks.

2. Select the Connect to Other Wireless Network option.

The Connect to Other Wireless Network dialog opens. Figure 7-1 shows an example dialog showing an Atheros wireless network interface.

Figure 7-1: The Connect to Other Wireless Network dialog.

· If you want to use a different wireless adapter than the one shown in the Wireless Adapter drop-down menu, click the menu and choose the network interface you want to use to make your connection.

Figure 7-1 shows the Atheros-based wireless network interface that I happen to be using. You'll see the network interface(s) installed on your computer.

· Type the name of the wireless network you want to connect to in the Network Name text box.

The network name is the ESSID of the AP you want to connect to.

· From the Wireless Security drop-down menu, select WPA2 Personal — or if that's unavailable, select WPA Personal.

You might have to select WPA2 Enterprise or WPA Enterprise if you're connecting to the wireless network of a large- or medium-sized organization. Organizations that allow more than a handful of people to connect to their wireless network almost always use a centrally managed WPA2 or WPA encryption key distribution system. Using individual encryption keys, like we do, is unwieldy and ultimately unmanageable. You need to obtain the necessary information from the organization's help desk or system administrative staff if you're connecting to such a wireless network.

· Type the network name you're connecting to in the Network Name text box.

NetworkManager uses the wpa_supplicant utility when configuring wireless network encryption. The wpa_supplicant might sound like technology borrowed from Blade Runner, but it's really just a Linux program used to configure a wireless network interface to use WPA2 or WPA. Before NetworkManager was invented, configuring a wireless network interface to use WPA2 or WPA was a manual, two-step process. First, you configured the network interface to connect to an AP. Second, you used wpa_supplicant to configure the network to use WPA2 or WPA encryption. You can still perform the manual configuration, but using NetworkManager is much easier.

· If you want to see the password as you type it, select the Show Password radio button.

Selecting to display the password (pass phrase) option displays the characters of the pass phrase as you enter them in Step 8. If you don't select this option, the characters are displayed as dots as you type. Being able to see the actual characters helps avoid mistakes because pass phrases should be at least 20 characters in length.

· Type the WPA2 or WPA pass phrase in the Password text box.

· Click the Connect button.

The NetworkManager icon gyrates as it connects to your wireless network. When connected to the wireless network, the Create Default Keyring dialog, shown in Figure 7-1 , opens.

Figure 7-1: The Create Default Keyring dialog.

Ubuntu wants to encrypt and store the pass phrase you used to make the wireless connection for later use. Storing the pass phrase makes using it in the future much easier. You won't have to retype in the necessarily long — remember, 20 characters or more — pass phrase.

1. Select a reasonable password and type it in the Password text box.

2. Retype the password in the Confirm New Password text box.

The Password Strength Meter shows how hard the password will be to crack. Try to use a password of at least 75 percent difficulty.

3. Click the OK button.

Your WPA2 or WPA encryption key (pass phrase) is saved in the GNOME key ring. You're prompted to enter your GNOME key ring password you just entered whenever you want to configure the wireless network in the future.

If the NetworkManager doesn't make the connection, its icon continues displaying the red exclamation symbol. In that case, you should check that the encryption type and pass phrase of the AP you're trying to connect to are correct. You might, for instance, be trying to use WPA2 when the AP or, more likely, your wireless network interface supports only WPA. I recommend selecting WPA if WPA2 fails.

Congratulations! You're connected to a wireless network using either the reasonably secure WPA encryption or the very secure WPA2 encryption. You can use your wireless network, secure in the knowledge that it is very, very difficult for anyone to sniff your wireless network communications.

Using a Windows Device Driver

The Network Driver Interface Specification (NDIS) standard was co-developed by the Microsoft and the 3Com corporations to develop network interface drivers. Windows network interface adapters — also called network interface cards — all use NDIS-based drivers.

Unfortunately, not all network interface manufacturers provide Linux drivers for their products. Nor do all manufacturers provide the specifications that would allow the open source community to build compatible Linux drivers.

I'd like to take this opportunity to thank the manufacturers who provide Linux drivers or the specifications to construct Linux drivers!

Fortunately, when you can't find a Linux driver for your wireless network interface, you might be able use the proprietary Windows driver. The ndiswrapper utility wraps the Windows driver so it can be used on your Ubuntu computer. That's cool!

The rest of this chapter shows how to locate your Windows wireless network interface and then copy it to and load it on your Ubuntu file partition. When loaded, you can configure your interface using the instructions described elsewhere in this chapter.

If your wireless interface requires ndiswrapper and you're planning to remove Windows from your Ubuntu computer, you need to make a copy of the Windows driver before you remove Windows.

Discovering your Windows wireless network interface driver

You need to find the wireless network interface driver that your Windows computer uses before Ubuntu can use it. The best way to find the driver is to see what your Windows computer says about it. In this section, you can boot to your Windows operating system, locate the device driver, and copy it to an easy-to-remember location.

1. Boot or reboot your Ubuntu computer into the Windows operating system.

The following instructions assume you've either installed Ubuntu on a computer that also contains Windows in a dual-boot configuration, or you're running a live instance of Ubuntu.

2. Log in to an account with administrative privileges or the Administrator account itself.

3. Click the Start button and select the Control Panel.

The Control Panel window opens.

4. Double-click the System icon.

The System window opens.

5. Click the Hardware tab.

6. Click the Device Manager button.

The Device Manager window opens.

7. Click the plus (+) symbol next to the Network Adapters option.

A submenu opens, displaying all the network devices on your computer.

8. Right-click the wireless networking interface and select the Properties option.

A Properties dialog opens, showing the properties and other information about your wireless network interface.

9. Click the Driver tab.

10. Click the Driver Details button.

The Driver Details dialog opens, showing the location of the device driver file.

The file most likely resides in the C:\WINDOWS\system32\DRIVERS folder. For instance, my Windows computer uses a built-in Broadcom wireless network interface that uses the BCMWL5.SYS driver, which is found in the C:\WINDOWS\system32\DRIVERS folder.

11. Write down the location of the driver.

Now that you've identified your computer's wireless network interface and its driver, you can use it with Ubuntu.

Copying the Windows driver files to Ubuntu

The Ubuntu ndiswrapper utility needs access to the driver file and its corresponding information file — such as files with the .inf suffix.

You might be able to find your wireless driver and information files on

· A CD-ROM that came with your computer or your network card

· The network card manufacturer's Web site

· Your existing installation of Windows

The following instructions describe how to copy those files from your Windows hard drive partition to your Ubuntu partition.

1. Reboot your computer to Ubuntu.

2. From the GNOME menu bar, choose ApplicationsAccessoriesTerminal.

A GNOME Terminal window opens.

3. Mount your Windows C: drive.

The mount command depends on your computer's setup. For example:

o If your computer uses the first partition as the C: drive, type the following command:

sudo mount -t ntfs /dev/hda1 /mnt

o If your computer uses the first partition as a recovery partition and the second partition as the C: drive, type the following command:

sudo mount -t ntfs /dev/hda2 /mnt

4. Type your password if prompted.

5. Type the command to copy the Windows wireless network interface driver to your Ubuntu computer, like this:

sudo cp /mnt/windows/system32/drivers/driver.sys /etc/ndiswrapper

Substitute your driver's filename for driver.sys. For instance, to copy my Broadcom driver, I type the following command:

sudo cp /mnt/windows/system32/drivers/bcmwl5.sys /etc/ndiswrapper

6. Type the following command and press the Enter key:

sudo cp `find /mnt -iname driver.inf` /etc/ndiswrapper

If, for instance, your driver filename is m2500, type this command:

sudo cp `find /mnt -iname bcmwl5.inf` /etc/ndiswrapper

This command locates the driver file on the Windows partition and copies it to the /etc/ndiswrapper directory.

7. Type the following command to unmount the Windows partition:

sudo umount /mnt

Next, you need to install the ndiswrapper utility on your Ubuntu computer before using the Windows driver. The following section shows you how.

Installing the ndiswrapper utility

The following instructions install the ndiswrapper packages directly from your Ubuntu disc:

1. Insert your Ubuntu disc in your computer's DVD or CD-ROM drive.

Ubuntu automatically mounts your CD-ROM or DVD disc.

2. If necessary, log in to your Ubuntu user account.

3. From the GNOME menu bar, choose ApplicationsAccessoriesTerminal.

A GNOME Terminal window opens.

4. Type the command to install the ndiswrapper-utils and ndiswrapper-common packages:

o On a permanent Ubuntu computer, type this command:

sudo dpkg -i /media/cdrom0/pool/main/n/ndiswrapper*

o On a live Ubuntu computer, type this command:

sudo dpkg -i /cdrom/pool/main/n/ndiswrapper*

5. The ndiswrapper utility is installed and ready to use.

Loading the Windows driver

Use the ndiswrapper utility to load the Windows wireless network interface driver into your Ubuntu computer's kernel. When installed, you can configure and start using your wireless computer. Follow these steps:

1. From the GNOME menu bar, choose ApplicationsAccessories Terminal.

A GNOME Terminal window opens.

2. Type the following command to install the Windows driver file:

sudo ndiswrapper -i /etc/ndiswrapper/driver.inf

For instance, to load the driver for a Broadcom wireless network interface, type this:

sudo ndiswrapper -i /etc/ndiswrapper/bcmwl5.inf

The ndiswrapper utility uses the Windows information — any file ending in .inf — to load the actual driver file.

3. Type your password if prompted.

4. Type the following command to configure Ubuntu to load the file whenever it's rebooted:

sudo ndiswrapper -m

If you execute this command, your Windows driver will automatically load every time you reboot.

You can see all the Windows drivers loaded on your Ubuntu computer by either

o Typing the command ndiswrapper -l.

The utility lists all the drivers it has loaded.

o Reading information about loaded drivers in the /var/log/syslog file.

5. Load the ndiswrapper kernel module by typing the following command:

sudo modprobe ndiswrapper

You can verify that the ndiswrapper module is loaded by typing the following command:

lsmod | grep ndiswrapper

When ndiswrapper is loaded, Ubuntu makes the wlan0 network interface available for use. You can see the interface by typing iwconfig wlan0.

You configure your wireless network interface using either of these Ubuntu utilities described in this chapter:

· Network Administration Tool (the default Ubuntu configuration utility)

· NetworkManager