Setting up a temporary ‘ad hoc’ network

Fred langa By Fred Langa

When you need a quick way to share files between two Windows PCs that aren’t normally connected, an ad hoc wireless network is the way to go.

Everything you need is already built into Windows 7, Vista, and XP. Here’s how to set up an ad hoc network on wireless PCs.

The Latin phrase ad hoc means for this. It refers to a technique or process that’s designed for a very specific purpose — often, a short-term goal. Microsoft describes an ad hoc network this way in the Windows 7 Help file:

Subscribe to our Windows Secrets Newsletter - It's Free!

Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

PC Drive Maintenance (Excerpt)

Subscribe and get our monthly bonuses - free!

Your hard drives store photos, books, music and film libraries, letters, financial documents and so on. This ebook is aimed at helping you understand your hard drives, expand their capacities and length of life, and recover what you can from them when they fail. We're offering you a FREE Excerpt! Get this excerpt and other 4 bonuses if you subscribe FREE now!



  • “An ad hoc network is a temporary connection between computers and devices used for a specific purpose, such as sharing documents during a meeting or playing multiplayer computer games. You can also temporarily share an Internet connection with other people on your ad hoc network, so those people don’t have to set up their own Internet connections. Ad hoc networks can only be wireless, so you must have a wireless network adapter installed in your computer to set up or join an ad hoc network.”
Ad hoc networks can be very handy. I recently set one up when I was traveling and needed to transfer a massive number of large digital photos from a netbook to my more capacious laptop system. An ad hoc network let my PCs communicate directly with each other, via Wi-Fi, without having to involve any extra hardware at all (no cables, routers, access points, and so on). I did not have to connect to the Internet and laboriously upload the photos from one PC and then download them to the other.

In addition, an ad hoc network is much faster than using a flash drive or some other sneakernet option for transferring large collections of files or data. Simply put, when you need to move files between two (or more) PCs that are not otherwise networked, an ad hoc connection is a great tool.

However, Microsoft’s how-to instructions for setting up ad hoc networks are far from complete. (You just knew there had to be a catch.) For example, the Win7 Help system offers only these basic instructions for setting up an ad hoc network:

  1. Click to open Network and Sharing Center.

  2. Click Set up a new connection or network.

  3. Click Set up a wireless ad hoc (computer-to-computer) network.

  4. Click Next, and then follow the steps in the Wizard.
These instructions are accurate, as far as they go — your PCs will most likely be networked together. But your new network will be of limited use due to various security settings and other protective properties. You won’t, for example, be able to share files. Getting an ad hoc network to function fully requires a bit more work than Microsoft initially lets on.

Below, I’ll fill in the missing details and show you — step by step — how to connect two Wi-Fi–equipped Windows 7 laptops via an ad hoc network. Don’t be discouraged by the number of steps; after you know the process, setting up an ad hoc network takes only a few minutes!

By the way, you use essentially the same process for setting up an ad hoc network in Win7 and in Vista. The steps with XP are similar, but including them here makes this article too long. Instead, I suggest XP users follow the step-by-step instructions in these articles:
  • Microsoft Download Center page: “Ad hoc Internet sharing with Microsoft Windows XP” (a downloaded Word document)
  • Labnol.org article: Set up ad hoc wireless network in Windows XP
  • Home-network-help.com story: Setting up ad hoc wireless network in Windows XP
Let’s get started!

First steps: Get your wireless-enabled PCs ready

These first three steps aren’t always mandatory; after you’re familiar with ad hoc networking, you might wish to skip them. But networking often involves many variables, so it makes sense to try to simplify your networking setup before creating your first ad hoc connection. It’ll improve your odds of success.

  • Step 1: Reboot both of the systems you’ll be connecting.

  • Step 2: After the PCs restart, shut down or disable as much software as possible, especially network-using programs such as e-mail, messaging, browsers, auto-updating software, and so on. Ideally, you want to begin with two quiescent systems, neither of which is trying to communicate via any network.

  • Step 3: With laptops, set both systems’ power options to High Performance, which lets them communicate at maximum speed and transmission power. You can set the power options by navigating to Control Panel/Hardware and Sound/Power Options.

  • Step 4: Here’s where the ad hoc setup process really starts: on each system, open the Network and Sharing Center (Control Panel/Network and Internet/Network and Sharing Center). Click on Connect or disconnect. A list of available networks will appear.

  • Step 5: Make sure both PCs are disconnected from all networks. If any connections are active (the dialog box will be labeled Currently connected to:), click to select the active connection and then click the Disconnect button. (See Figure 1.)

    Disconnect both pcs
    Figure 1. Use the Disconnect button to close all network connections. (Please excuse the whimsical name of my home-office network: whatchulookingat.)

  • Step 6: Next, in the left pane of the Network and Sharing center dialog box, click Manage wireless networks, as highlighted in Figure 2.

    Manage wireless networks
    Figure 2. Click the Manage wireless networks link.

  • Step 7: After a moment, the Manage wireless networks that use (Wi-Fi) dialog box will open. Click the Add button highlighted in Figure 3.

    Add a new network
    Figure 3. Click the Add button.

  • Step 8: Next, you’ll see the Manually connect to a wireless network dialog box. Click Create an ad hoc network, as shown in Figure 4.

    select ad hoc network
    Figure 4. Clicking this button begins the actual process of setting up an ad hoc network.

Time to configure your ad hoc network

  • Step 9: The Set up a wireless ad hoc network Wizard will open. Read the introductory screen (shown in Figure 5) and then click Next.

    ad hoc wizard
    Figure 5. This is one of the more self-explanatory screens in the process.

  • Step 10: In the Give your network a name and choose security options dialog box (see Figure 6), fill out the Network name, Security type, and Security key fields.

    supply the requested information
    Figure 6. Completing this information defines your ad hoc network.

    In this case, I’ve selected WPA2-Personal as the encryption type. You also can use the less-secure WEP encryption or an insecure Open connection, but WPA2 is the safest security option. Your WPA2-Personal security key (or passphrase) must contain between 8 and 64 case-sensitive alphanumeric characters.

    If you think you might want to reuse the same connection in the future, tick the Save this network box.

  • Step 11: You’ll next see a Setting up the {name} network dialog box, illustrated in Figure 7.

    initial setup
    Figure 7. The initial setup should take less than a minute.

    After a moment, you’ll see another dialog box, The {name} network is ready to use, shown in Figure 8.

    Network is ready
    Figure 8. Your new ad hoc network should now be available for connections.

Configuring the second wireless system

  • Step 12: On the second machine, open the Network and Sharing Center (Control Panel/Network and Internet/Network and Sharing Center). Click Connect or disconnect — a list of available networks will appear. Click to select the new network you just created, then click the Connect button. (See Figure 9.)

    new network should appear
    Figure 9. Your new network should appear on the second laptop’s list of available connections.

  • Step 13: You’ll be asked for the security key you created for the ad hoc network. (Remember: A WPA2 passphrase/key is case-sensitive.)

    The second PC will churn briefly as it identifies the new network and establishes an encrypted link. Once the connection is made, Windows will automatically assign the new network to the Public network profile — a safety precaution.

    However, with Public networks, network discovery and file sharing are turned off by default — again, as a safety precaution. So although your two PCs are now connected, you can’t really do much with the connection; you can’t browse one PC from the other or share files, for example.

    The solution is to switch to Home or Work network profiles, which do allow file sharing and are safer than Public. Unfortunately, this is where you might run into a bug — one I’ve discussed before in the May 12 article, “Win7 network stuck in ‘Public’ mode.” There’s no obvious way to change to Home or Work, or to create a homegroup.

    Here’s the workaround:

  • Step 14: Open the Network and Sharing Center, and in the lower part of the dialog box, select Choose homegroup and sharing options, as highlighted in Figure 10.

    unstuck from public mode
    Figure 10. A few extra clicks get your ad hoc connection unstuck from Public mode.

  • Step 15: In the next dialog box, click the What is a network location? link. (See Figure 11.)

    What is a network location?
    Figure 11. Click What is a network location? to access your Home and Work network profiles.

  • Step 16: When the Set Network Location dialog box opens, you can select the network profile of your choice, as shown in Figure 12. I usually select Home for ad hoc connections between PCs that I own and know to be safe.

    choose location
    Figure 12. Choose either the Home or Work profile to facilitate file sharing.

  • Step 17: If you want to continue setting up a homegroup, follow the remaining prompts. (Need more info? See the October 1, 2009, article, “Sharing is easy with Windows 7′s homegroups.”)

    No homegroup is required; you can use conventional networking, if you prefer. If that’s your choice, simply abandon/cancel the Create a homegroup dialog boxes. (If you want more information on setting up conventional networking for best results, see the October 14, 2010, article, “Simple change in settings pumps up Win7 networks.”)

    Note that when you make changes involving Location profiles and sharing options, your ad hoc network will hiccup and reset itself. This adjustment is the normal response of the network when you apply new settings.

  • The final step: Now go back to the other machine and repeat Steps 14 through 17 to set the location correctly. When you’re done, both PCs should have their network Location set the same way (either Work or Home). If you set up a homegroup on one PC, you can now join it from the other.

    With that, you should be good to go, and you can now use your ad hoc network normally. (See Figure 13.)

    Success
    Figure 13. Here, you can see my two demo laptops connected and available to each other via an ad hoc network.
When you’re through using your new network, simply disconnect both laptops from the ad hoc connection. That’s it! You’re done!

Spelling out the steps in detail, as I have in the preceding paragraphs, makes the process look harder than it actually is. After you’ve been through the procedure once or twice, you’ll be able to cobble together an ad hoc network in just a few minutes — far less time than it took you to read about it!

Feedback welcome: Have a question or comment about this story? Post your thoughts, praise, or constructive criticisms in the WS Columns forum.

Fred Langa is a senior editor of the Windows Secrets Newsletter. He was formerly editor of Byte Magazine (1987-91), editorial director of CMP Media (1991-97), and editor of the LangaList e-mail newsletter from its origin in 1997 until its merger with Windows Secrets in November 2006.
= Paid content

All Windows Secrets articles posted on 2011-12-15:

Fred Langa

About Fred Langa

Fred Langa is senior editor. His LangaList Newsletter merged with Windows Secrets on Nov. 16, 2006. Prior to that, Fred was editor of Byte Magazine (1987 to 1991) and editorial director of CMP Media (1991 to 1996), overseeing Windows Magazine and others.