Ad-Hoc Networking

Ad-hoc networking means that each computer talks to each other directly without the "supervision" of a device such as a router. This arrangement is sometimes called peer-to-peer networking.

graphics/arrow.gif Refer to Figure 13.1 on p. 165 in Chapter 13 for an example of an ad-hoc network.

If there are enough computers involved, an ad-hoc, or peer-to-peer network, can begin to form a kind of grid, or mesh. This gives peer-to-peer networks in some applications a great deal of power, although there's no really good way to administer a peer-to-peer network, and security remains an issue.

The Wi-Fi standards specify two different configuration modes, infrastructure and ad-hoc. The access point/router style network that I showed you in Chapter 14 is an example of using Wi-Fi in infrastructure mode, while (as you'd probably expect) peer-to-peer Wi-Fi access uses ad-hoc mode.

In infrastructure mode, communication between two nodes on the network flows through the access point. Computer A actually "talks" to the access point, which in turn talks to Computer B. The access point also performs a number of other roles, such as connecting the nodes to the Internet or other WAN (Wide Area Network), connecting multiple wireless networks, connecting the wireless nodes to a wired network, and providing management and security functionality (such as a firewall).

In contrast, in ad-hoc mode, Computers A and B communicate directly without an intermediary, and none of the other functionality provided by the access point is present.

The primary drawback of using Wi-Fi in ad-hoc mode is signal strength and range. Ad-hoc mode might make sense to use if you had two computers close to one another that you didn't expect to move much, the advantage being that you wouldn't need to spend $50 on an access point.

I wouldn't maintain a fixed Wi-Fi network using ad-hoc connections with more than two computers, and I wouldn't expect to be able to maintain an ad-hoc connection if one of my computers were mobile. When my wife carries our Wi-Fi laptop out to the garden, it goes way out of ad-hoc range, but well within the broadcast range of our routers.

Ad-hoc connectivity is good for, well, ad-hoc situations in life. Using Wi-Fi's ad-hoc mode, you can connect two computers when you are on the road even though no wireless networks are present, which can be very useful. For example, a colleague might have a wired network connection and access to the Internet, which I might be able to share using an ad-hoc connection with my colleague. (Sharing an Internet connection is explained in Chapter 16, "Sharing an Internet Connection.")

Ad-hoc networks are also good for quickly and easily setting up a Wi-Fi network in situations where flexibility is essential and a wireless infrastructure is not available (or needed). An example of this might be a temporary meeting or convention, or perhaps a group of consultants working on-site but without access to the "official" network might decide to set up an ad-hoc network.


If you do not assign password protection to the ad-hoc network, there is no security mechanism other than any protections you have assigned to file sharing generally. Anybody with Wi-Fi capability within range can access your ad-hoc network.

Later in this chapter I'll also show you a hybrid form of networking, which uses a Wi-Fi access point and an ad-hoc mesh to blanket a large area and extend the range of the core configuration.

Ad-Hoc Apple

To turn on ad-hoc networking, with an AirPort Extreme?equipped Apple computer, open the AirPort menu by clicking the AirPort icon in the menu bar. Select Choose Network. From the drop-down list, select Create Computer to Computer Network.

In the Computer to Computer window, enter the name of the network you want to create. Click More Options if you want to password-protect the ad-hoc network.



If you cannot access files on another computer using the ad-hoc network, make sure that file sharing is turned on in the other computer's System Preferences control panel.

You connect to the ad-hoc network as you would to any Wi-Fi network within range. On an Apple machine, this means selecting the ad-hoc network by name from the AirPort menu and supplying the password, if one is required. Barring obstructions and interference from other wireless devices such as microwaves and cordless phones, connection should be possible within about one hundred feet.

Ad-Hoc Mode on Windows

The process of establishing an ad-hoc network involves two steps:

  • Setting up the network on one machine

  • Connecting to the ad-hoc network from one or more other machines

As you may know, setting things up on Windows XP tends to be cosmetically different than doing so on older versions of Windows. It's also true that some setting up under Windows 98/Me depends largely on the software that came with the Wi-Fi card you are using.

Whichever operating system you are using, connecting to an ad-hoc network is no different than connecting to an infrastructure access point Wi-Fi network from the viewpoint of the device doing the connecting.

Even so, as an example, I'll show you how to set up an ad-hoc network using a Windows XP machine and connect to it using an older Windows 98 machine.


By the way, you can certainly mix and match Apple and Windows operating systems. A Windows computer can join an infrastructure network where the access point is an AirPort Extreme Base Station (which is made by Apple). Similarly, you can set up an ad-hoc network with a Windows machine, and Apple users can join it. Or, you can set up an ad-hoc network with an Apple and join it from a Windows machine.

The operating system doesn't matter; it could be Linux for all Wi-Fi cares. The only requirement is that the computers on the ad-hoc network be Wi-Fi?capable.

Of course, sharing files and resources across operating systems is a different?and potentially more painful?matter (that goes beyond the scope of this book).

Setting Up an Ad-Hoc Network on XP

Open the Network Connections window either by right-clicking on My Network Places in the Windows Start menu, or by selecting Network Connections from the Windows Control Panel. Within the Network Connections window, select Wireless Network Connection, right-click, and choose Properties from the context menu. The Wireless Network Connection Properties window, shown in Figure 15.1, will open.

Figure 15.1. The Wireless Network Connections Properties window is the starting place for creating an ad-hoc network.


Highlight the Wireless Networks tab, which you can see active in Figure 15.1, and click the Add button. The Wireless Network Properties window, shown in Figure 15.2, will open.

Figure 15.2. The Wireless Network Properties window is used to assign properties to a wireless network.


In the Wireless Network properties window, enter a name for the ad-hoc network (the wireless network's SSID). (In Figure 15.2, I've given the ad-hoc network the name "theHoc".) Next, select the check box at the bottom of the window labeled "This Is a Computer-to-Computer (ad-hoc) Network; Wireless Access Points Are Not Used." Check the Data Encryption check box if you want to provide WEP encryption protection for the ad-hoc network. Finally, click OK to create the ad-hoc network.

If you were to connect to this network from a Windows XP machine, you would do so like connecting to any other Wi-Fi network, using the Wireless Network Connection Properties window. But note that if you click the Advanced button in the Window, the Advanced dialog, shown in Figure 15.3, determines which kinds of networks are displayed.

Figure 15.3. Using the Advanced dialog, you can display all wireless networks, only infrastructure networks, or only ad-hoc point networks.


Using the Advanced dialog, you can decide to display all kinds of networks, only access point networks, or only ad-hoc networks. It might make it easier to see the ad-hoc networks if you select Computer-to-Computer (Ad-Hoc) Networks Only, as in Figure 15.3.

With Computer-to-Computer (ad-hoc) Networks selected in the Advanced dialog, it's easy to spot the new ad-hoc network in Figure 15.4.

Figure 15.4. The new ad-hoc network is shown in the Wireless Network Connection properties window.


Connecting to the Ad-Hoc Network from Windows 98

Now it's time to connect to the new ad-hoc network from a Windows 98 machine within range of the machine that created the ad-hoc network.


The new ad-hoc network isn't shown as active in Figure 15.4 because there's nothing connected to it, and no other ad-hoc node broadcasting to connect to. If there were a node broadcasting, the ad-hoc network would appear in the Available Networks pane shown in Figure 15.4, and you would connect to it normally (by clicking the Configure button).

As opposed to Windows XP, where you make a connection to the ad-hoc network using Windows dialogs in the same way you would connect to any other wireless network, in older Windows operating systems the connection specifics are dependent on the client software that comes with your Wi-Fi card.

Generally, the client software can be launched from a taskbar icon (see Chapter 8, "Adding Wi-Fi to a Mobile Computer," for more details).

Figure 15.5 shows using the typical client software for one Wi-Fi card to start adding a configuration profile for an ad-hoc network.

Figure 15.5. You can add a configuration profile for an ad-hoc network by selecting Peer-to-Peer.


The configuration is given a name?theHoc?which should not be confused with its network name, and "Peer-to-Peer Group" is selected from the drop-down list (rather than Access Point).

Next you need to enter the network name (SSID), as shown in Figure 15.6.

Figure 15.6. The network name is needed to connect to an ad-hoc network.


You'll see in Figure 15.6 that a channel needs to be entered. The default for this setting, unless you set it differently when the ad-hoc network was created, is Channel 1.

If the ad-hoc network uses encryption, the key should be entered in the Set Security screen shown in Figure 15.7.

Figure 15.7. If the ad-hoc network uses encryption, you'll need to enter the key in the Set Security screen.


Because I set the ad-hoc network named theHoc up without security (a pretty poor idea usually), to connect to the Hoc, the Enable Data Security box shown in Figure 15.8 should be unchecked.

Figure 15.8. The Windows 98 client configuration software shows a peer-to-peer (ad-hoc) connection.


With the configuration information completed, the client computer (the one running Windows 98) can easily connect to the ad-hoc network, which is shown in Figure 15.8.

Meanwhile, back at the Windows XP ranch, the computer that created the ad-hoc network now has something to connect with. Figure 15.10 shows the ad-hoc network connection from the viewpoint of Windows XP (note the details of the connection in the lower left of Figure 15.9).

Figure 15.10. Ipconfig /all shows the network settings for a computer on the network.

[View full size image]

Figure 15.9. The Network Connections and the Wireless Network Connection Status windows show the strength of the ad-hoc network connection, as well as details about the connection.