Wireless Networking Without an Access Point

Hugh Sparks
2011-09-19
www.csparks.com

What's all this?

A way to connect one or more wireless computers to the internet using a gateway computer that has a wired connection to the internet.

Why do this?

You're in a hotel room that provides wired internet access and you'd like to use your iPhone wifi connection. If you have a laptop with both wired and wireless adapters, you're in business.

How it works

Normally, you'd need a wireless access point or access point/router combination box to connect your iPhone to the internet. But it's possible to make your laptop act as a gateway to the internet using Windows Internet Connection Sharing. (ICS) Instead of using an access point, your wireless adapter will talk with other clients using an ad-hoc wireless network.

UPDATE - This method may be obsolte

Although I haven't had time to evaluate the program, it appears that Chris Pietschmann, the author of Virtual Router, has found a better way to do this. Virtual Router is an open-source program, easy to configure with a simple GUI, and it support WPA2, which is far more secure than the method outlined below. In addition, it uses a standard Windows installer and requires no operating system patches. In short, it's an entirely superior solution! It does, however, require Windows 7 or above, so you may still find the following method useful if you're running Windows XP.

Ad-hoc wireless networks

An 802.11x wireless network can operate on one of two modes: Access Point or Ad-hoc. You're probably familiar with access point networks: They're the kind you see in coffee shops or in your home if you have a wifi router.

An ad-hoc network is an alternative way to let a group of computers talk to each other without an access point. If one of the computers in the group has an internet connection, it can be configured as a gateway for the others using ICS.

You may ask yourself, "Self, why would anyone buy an access point if they can do the same thing with any old computer?" Answer: Access points can manage larger numbers of clients and they provide better security features. Microsoft helps out access point manufacturers by not allowing advanced encryption and security protocols for ad-hoc networks.

The wired internet connection

Get the laptop's wired connection working and check that you can access the internet.

Let windows manage your wireless connection

If you're using the value subtracted software™ (VSS) supplied by your laptop manufacturer to make your wireless easy to use, please go elsewhere and learn why and how you should get rid of this awful thing and use the standard Windows wireless management tools instead.

Go to the Wireless Properties window by right-clicking on this menu item:

Start Menu -> Settings -> Network Connections -> Wireless

Select "Properties" from the popup menu.
Select the "Wireless Networks" tab.
CHECK: "Use Windows to configure my wireless network"

This step should let windows take over control of your wireless card. If you have trouble, you may need to uninstall the easy to use wireless software supplied by your laptop's manufacturer. Make sure you don't uninstall the wireless driver itself!

Create a new wireless network

To create a wireless network, press the "Add" button near the bottom of the Wireless Properties page. Enter a network name (SSID) for your new network. For this example, I'll use "MyNet". You only have to do this once - Windows will remember the configuation.

Set the Network Authentication to Open. Set the data encryption to WEP. Uncheck the box: "The key is provided for me automatically".

The key value is a password that you invent and assign to MyNet. Clients have to know this key when they connect to MyNet. WEP keys have a special format: They must contain exactly 40 bits or 104 bits. You can specify the key using either 10 or 26 hexadecimal digits or alteratively exactly 5 or 26 ascii characters. Example: "RobertTheDuck" If you use the ascii method, the characters are case sensitive.

WEP is a very poor encryption protocol, but it's the only available choice for ad-hoc networks on Windows. It will keep out the vast unwashed, but not a determined hacker. The moral: It's probably not a good idea to open a coffee shop using ad-hoc networking. In your hotel room you'll probably be ok. Be sure to turn on your Windows firewall.

Enable the ad-hoc network

Go to the "View Available Wireless Networks" page. (Get there quickly by right-clicking the wireless icon on the taskbar.)

Find your new network "MyNet" and press the Connect button. Windows will grind away for 20 seconds and then show the state as "Not connected": That's ok. It won't be in the connected state until at least one client makes a wireless connection.

Enable internet connection sharing (ICS)

On the wired adapter properties page, advanced tab, check the box Allow other network users to connect though this computer's internet connection.

In the box "Home networking connection" select "Wireless".

Press "OK". If you've never used internet connection sharing before, Windows may go though an automatic installation process and then ask you to reboot.

In any case, a warning will appear about changing the wireless adapter IP number to the static value "192.168.0.1".

Configure the iPhone

On the iPhone select the network "MyNet" which should appear on the list of available wireless networks. Display the properties page using right arrow button on the right side of the network name. On your laptop, the Available Wireless Connections should show the "MyNet" state change to "Connected".

On the iPhone, select the DHCP tab and press the "Renew Lease" button near the bottom of the page. After a few seconds, you will see all the IP information.

At this point you should be connected!

Automatic connections

Once you've successfully connect the iPhone, it will reconnect on demand. When you put your phone away, you'll notice that the wireless icon on the Windows task bar will show a red X to indicate that the connection isn't active. But when you open your phone and use a wifi application, the laptop will activate and reestablish the connection.

Renewing the lease

If your gateway machine is a laptop, it may go to sleep. When the laptop wakes up, you may find it necessary to renew the lease on the iPhone.

Switching back to normal wireless operation on the laptop

ICS assigns the static IP 192.168.0.1 to the wireless adapter. When you want to connect your laptop through a regular access point, you need to change the settings back to DHCP. This can be done on the Wireless Properties page or you can use the scripts shown below.

Scripts to configure the wireless adapter

Put shortcuts to these script files on your start menu and you can switch between static and dynamic configuration very quickly:

	SwitchWirelessToICS.bat:

	:: Configure the ICS static IP on the Wireless interface

	netsh interface ip set address name="Wireless" source=static addr=192.168.0.1 mask=255.255.255.0
	netsh interface ip set dns name="Wireless" source=static addr=none register=PRIMARY
	netsh interface ip set wins name="Wireless" source=static addr=none
	
	SwitchWirelessToDHCP.bat:

	:: Configure DHCP on the Wireless interface

	netsh interface ip set address name="Wireless" source=dhcp
	netsh interface ip set dns name="Wireless" source=dhcp register=PRIMARY
	netsh interface ip set wins name="Wireless" source=dhcp
	

The wireless adapter name

Each script file refers to the name of your wireless adapter. You should edit the script to match your existing wireless adapter name or change the adapter name to "Wireless". If you want to rename your adapter, right-click the adapter name where it appears in:

Start Menu -> Settings -> Network Connections

Select "Rename" from the menu and enter the new name. I like to rename my "Local Area Connection" to "Wired" and my wireless adapter to "Wireless".

Windows XP issues

There is a patch for ICS that's not part of SP3 and you don't get it though automatic updates. You have to download it from Microsoft and install it yourself. Without this patch, your clients won't be able to connect though an XP gateway machine after it goes to sleep and then resumes. Read all about it here:

Microsoft ICS Patch

I believe this issue is fixed in Vista and beyond.

Vista and Windows 7 issues

Vista and Win7 require the expression "netsh interface ipv4" instead of "netsh interface ip" in the scripts shown above.

This article is XP-centric. If you are familiar with wireless setup and adapter configuration on Vista, you'll have no trouble making adjustments. If you need step-by-step instruction on wireless setup or internet connection sharing on Vista, see the references below.

References

Suggestions and complaints

Send me a note