Tuesday, January 11, 2011

Beginners' Guide to setting up a computer-to-computer network

Computer-to-computer networks, also called ad-hoc networks are really useful things. The only requirements are multiple computers, Wi-Fi adapters in them (or USB dongles) and a few minutes. Ad-hoc networks can be used for several purposes. Some of them are:
  • Sharing a wired (or 3G) Internet connection with multiple people
  • File transfer over Wi-Fi (it's faster than Bluetooth or flash drives)
  • Playing multiplayer games
Ad-hoc networks are made to be temporary networks to quickly and efficiently do the things listed above. Consider this scenario: You are at the airport with a few people. You don't have a secure wireless network at hand and you want to send a very large file to someone. You don't have any media at hand. You quickly fire up your laptops. You create an ad-hoc network (in a minute) and others connect to you. You drag the huge file to the others' public folders (or they grab it from yours). You have transferred lots of megabytes in just a couple of seconds.

Here's the structure of an ad-hoc network if you haven't understood already:

Before you begin
Ad-hocs can be set up only wirelessly. You cannot connect two computers via an ethernet cable. You need an ethernet crossover cable for that, and it is a very different thing. And for this computer-to-computer network, you will need the following:
  • At least two computers (duh!)
  • Wi-Fi support in all your machines (they're built into every laptop these days)
  • Windows installed on all of them. Note: Macs and Linux machines would work too, but this article focuses on Windows. I'll link to instructions for Mac and Linux later.
Important note: The computer with the Internet connection (where you set the network) is called the Host Computer (HC) and the other computers are called Client Computers (CC).

Ad-hoc on Windows XP
Let's begin at the beginning. Windows XP is the oldest edition of Windows that I'm supporting here. 

To set up a computer-to-computer network for Windows XP, you need to enable Internet Connection Sharing (ICS) separately first. If you are not doing this for an Internet connection, please skip this section.

Enable ICS:

On the host computer, go to the Control Panel. In Category View, click Network and Internet Connections. In there, go to Network Connections. Right-click the network connection that you get your Internet from. Click Properties. In the Advanced tab, look for a section named Internet Connection Sharing. Under that, check the checkbox that says Allow other network users to connect through this computer's Internet connection. If the connection in question is a dial-up connection, also check the box that says Establish a dial-up connection whenever a computer on my network attempts to access the Internet. Click OK and close everything.

Set up the ad-hoc (skip to here if not sharing Internet connection):

On the HC, go to the Control Panel and again (as above), navigate to Network and Internet Connections, Network Connections. This time, right-click your Wireless Network Connection and hit Properties. In the tab named Wireless Networks, click the button that says Add... under the section Preferred Networks.

A new dialog will pop up. Set it up as shown in the image to the left. The name of your network should be entered in the first text box, i.e. Network name (SSID). You can choose a stronger encryption by choosing WPA or WPA2 (or any of its variants) instead of WEP. Or you can keep the connection open (not recommended, as anyone else can connect to it). Remember to check the checkbox in the end to indicate that it is an ad-hoc.

Click OK for both the dialogs and close everything. Now when you search for available wireless networks on your client computers, you should be able to see your network and be able to connect to it with the password you set.

Ad-hoc for Windows Vista
In Windows Vista, setting up an ad-hoc is relatively simpler. You don't even need to enable ICS separately. On your host computer, click Start, then click Connect To. In the list of options, click Set up a connection or network. Select Set up an ad hoc (computer-to-computer) network and click Next.

Now the wizard should guide you to set the ad-hoc network up. Somewhere in the process, you will be required to click a button to share your computer's Internet connection. Click it to set up ICS, or don't click it if you're setting your network up for file sharing or for gaming.

Ad-hoc for Windows 7
For some reason, if you're on Windows 7, you'll be required to set up ICS separately, as in Windows XP. But this isn't very hard.

Skip this section if you don't want to share an Internet connection.

Enable ICS:

Click the Start button and type in View Network Connections. Press Enter and your network connections should be shown. Right-click the network you get your web connection from and select Properties. Go to the Sharing tab and Check the first box. Click Settings... and check the protocols you want to enable for your client computers. If not sure, at least check HTTP and HTTPS.

Set up the ad-hoc:

Click the Start button on your HC and type in Manage Wireless Networks. Press Enter. You should be able to see a list of saved wireless networks on your machine. Click the button Add at the top. Click Create an ad hoc network. Go through the wizard to set up your network.

Your CCs should now normally see the network you just set up.

For Mac, see this documentation for setting up an ad-hoc network.
For Ubuntu, see this page for ICS and this one for setting up the network.

Good luck and enjoy the convenience.

See also:
Beginners' Guide to BitTorrent
Enable checkboxes again in iTunes 10
Beginners' Guide to Windows 7 - Step-by-step
Set up a Linksys router without the CD
Sit around airline lounges for free Wi-Fi - Travel Tip