5.5 Ad-Hoc Wireless Networking

So far, we have been talking about wireless networks that involve an access point. While this is primarily the way most wireless networks are constructed and used, there are times where you do not have access to an access point and need to simply connect to another computer wirelessly. This mode of wireless connectivity is known as ad-hoc mode.

To enable two computers to connect wirelessly without using an access point, you would just need a wireless card/adapter on each computer. Then, take the following steps:

  1. Right-click on the Wireless Network connection icon located in the tray and select View Available Wireless Networks. Click on Advanced.

  2. The Wireless Network Connection Properties window will appear (see Figure 5-28).

    Figure 5-28. Adding a new wireless network
    figs/xpuw_0528.gif
  3. Click on Advanced. Select the option "Computer-to-computer (ad hoc) networks only" (see Figure 5-29). (To connect to either an access point or another computer directly, select the option "Any available network (access point preferred)".) Click Close.

Figure 5-29. Choosing the type of network access
figs/xpuw_0529.gif

The change in Step 3 will prevent you from connecting to an access point. When you want to go back to connecting to an access point, return to this dialog and reset it to its original value ? the default is "Any available network (access point preferred)"


  1. Click on Add... and give the ad-hoc wireless network an SSID (see Figure 5-30). Check the option "This is a computer-to-computer (ad hoc) network; wireless access points are not used". Click OK. Click OK again to dismiss the Connection Properties dialog.

    Figure 5-30. Specifying the SSID of the new wireless network
    figs/xpuw_0530.gif
  2. On the other computer, right-click on the Wireless Network Connection icon located in the system tray and select View Available Wireless Networks.

  3. You should now see the SSID of the ad-hoc network. Select the SSID and enter the key for encryption. (If WEP is enabled, see Figure 5-31. The initiating computer will supply the WEP key.) Both computers should share the same key. Click Connect.

Figure 5-31. Connecting to another computer using ad-hoc mode
figs/xpuw_0531.gif

If you don't see the SSID of the ad-hoc network on the second computer, go into the Advanced settings (as in Figure 5-29) and make sure you have not selected "Access point (infrastructure) networks only." This will prevent all ad-hoc networks from appearing in the list.


  1. You should now see that the connection is established (hover the mouse over the Wireless Network Connection icon in the tray). This is shown in Figure 5-32.

Figure 5-32. Confirming the connection
figs/xpuw_0532.gif

When you set up an ad-hoc network this way, there is no DHCP server to hand out addresses, but the computers select temporary addresses called link local addresses. These are chosen from the Class B subnet (see Chapter 1 for more information on IP addressing) 169.254.0.0/16. To determine the temporary IP addresses, use the ipconfig command at the Windows XP Command Prompt.

Note that if you choose to use your own IP address, it will work as well. Also, if you want to share a connection (suppose the first computer is plugged into a broadband connection), you can do so by opening Control Panel Network and Internet Connections Network Connections on the first computer, and then:

  1. Right-click on the connection that you want to share and select Properties from the context menu. This brings up the Connection Properties dialog.

  2. Select the Advanced tab (see Figure 5-33). Check the box labeled Allow other network users to connect through this computer's Internet connection. (If it is already checked, uncheck it, click OK to dismiss the Connection Properties dialog, and start over at step 1.)

    Figure 5-33. Sharing an Internet connection over an ad-hoc wireless network
    figs/xpuw_0533.gif
  3. To allow other computers to access the Internet connection through the ad-hoc network created on the first computer, select the wireless connection from the Home Networking Connection list and click OK.

Now, when another computer connects to the first computer's ad-hoc network, the first computer will act as a DHCP server and assign it a private network address (if you run into problems, see Section 6.5.5.3 in Chapter 6). The first computer will also perform NAT services to permit the other computer to access the Internet (assuming the shared connection is an Internet connection). In effect, this trick turns a Windows XP machine into an expensive wireless access point!