Tuesday, October 07, 2008

Sharing a Mobile Internet connection via an Ad-hoc Network

Networking these days is as versatile as you want it to be. You can get online practically anywhere. But the problem arises when you want to use one internet connection on two PCs without additional hardware.
This tutorial is a step by step guide of setting up two laptops onto one GPRS/EDGE internet connection.
A week ago I opted on getting a new internet access contract via mobile network. I went to my cell phone provider and got a HDSPA/GPRS/EDGE USB modem, hooked it up on my laptop and the installation was over in matter of minutes. Then I wanted to use the built in WiFi to share the GPRS/EDGE connection with wife’s laptop by setting up an ad-hoc network.
I tried for several days to do this but it simply did not work. I posted a question on several forum sites but I got no working solution. Some even said that it is impossible to do this. So I opted for a simple crossover connection while I worked on a wireless solution. Today, I finally made it. I established an internet access on my wife’s laptop via the ad-hoc wireless connection, and decided to share my experience so that you would not have to waste time in rediscovering the wheel. So, here it goes, a step by step guide to set up a wifi-shared mobile internet.
The solution consists of two basic concepts: ad-hoc networking, and connection sharing. Lets go to the first step and establish an ad-hoc connection. Look at this good guide I used for this step up the ad-hoc connection: http://www.microsoft.com/windowsxp/using/networking/expert/bowman_02april08.mspx
Go through all the steps as described in the tutorial. When you are done with this step, you should have the two computers in an ad-hoc connection.
Next step is sharing the GPRS/EDGE connection. For a detailed description, go to this page: http://www.home-network-help.com/ad-hoc-wireless-network.html. or follow my lead. I assume you have read the two links, so I will not go through all the details.
To share the connection, go to the WLAN icon made by the GPRS/EDGE connection, double-click it and go to Properties.
When you click Properties, you see on the right of this photo, the Properties display will open and you should go to the Advanced tab. Then, check the Internet Connection Sharing to allow other network users to connect through the connection, and from the “Home networking connection” select your wireless network card that is already connected in ad-hoc connection. Click OK and you could be done.
Try to get online from the second computer. If you get a connection, that’s it. You got lucky. Your ISP probably is more friendly than mine. I had to go a step further and manually set up the IPs on both wireless cards so that I can get online. Do not ask me why I had to do this, because I don’t know.
To set up the IP manually on my laptop, I double-clicked the icon for the ad-hoc network, went to Properties-Internet Protocol (TCP/IP) properties, and entered the IP settings as shown on the picture.

Then I did the same on my wife’s laptop. Of course, on her laptop I set the IP to, subnet mask is the same, and I set the Default gateway to I also had to set up the Preferred DNS server, in my case Only then I could get online with my wife’s laptop. You can discover your ISP’s DNS server by double-clicking the WLAN icon from the GPRS/EDGE connection, and checking the Details in the Support tab.
As you can see, the DNS server is within the local network of the ISP, and probably this is why the automatic settings for the IP did not work for me. To complete the IP settings for the second PC, simply type in the DNS Server IP from your ISP in the TCP/IP tab of the wifi card on your second PC. This fixed the problems for me, and now I have one GPRS/EDGE USB modem hooked up on my laptop, and my wife has internet connection via the wifi ad-hoc network with manually assigned IP settings.
So, in order to share my mobile internet connection, I first built an ad-hoc network following the instructions of the website I mentioned previously. Then, I shared the WLAN connection made by the GPRS/EDGE modem, by following the steps in the second link I mentioned. Thirdly, I had to manually set the IP addresses and set my wife’s laptop to connect to the internet through my laptop’s wifi by setting the Default gateway to And finally, I had to manually assign the IP of the DNS server.
If you want to know the theory behind the needed steps, read on.
In order to understand why I had to do the extra setting on my wife’s laptop, you will need some intro to networking.
The default gateway is basically the gate which my wife’s laptop uses to get out of our ad-hoc network and roam the internet. This gate is the IP of the wifi card on my laptop, which is tied up to the GPRS/EDGE internet connection. Also, for my wife to be able to type in “google.com” and go to that page, her wifi card had to be set up to know which computer to contact with the request for the desired website, in our case, google.com. This computer is called the Dynamic Name Server, or DNS server. This server gets the request from my wife’s laptop that says “get me to google.com” and translates the web name into an IP, and establishes the connection. This DNS server is set up by the ISP, and you will need to know his IP. You can find it by typing “ipconfig /all” in the command prompt of the computer that is on the internet, or follow the step-by-step guide I gave above.
Here is a diagram of how the network solution looks. This will help you understand how the structure of the network is designed, and how my wife’s laptop gets to talk to google.com, or any other web site.

When my wife types in “google.com” her wifi card communicates to my laptop via the WiFi Ad-Hoc network. Her wifi is set up to go to “the gate of the Internet” (my wifi card) and yell “hey, get me google over here!” My wifi then forwards this request via the GPRS/EDGE network to the ISP’s DNS Server. Then the DNS server, which is somewhere in our ISP’s facilities, figures out that “google.com” is actually a server with its own IP, and establishes a connection between google.com and my laptop, which forwards the connection to my wife’s laptop. As you can see, My Laptop is a part of two different networks, the GPRS/EDGE Network and the WiFi Ad-Hoc network. To the GPRS/EDGE Network, Wife’s Laptop is not visible. It only sees one computer, and gives out one IP, which is set up on my USB GPRS/EDGE modem. In this case, My laptop serves as a router in the WiFi Ad-Hoc network. With this ad-hoc setup, I can get up to 9 PCs online via my GPRS/EDGE connection, which is pretty cool knowing that a router can cost quite a bit.

If you find my blog posts helpful please consider a small donation.

Let your friends know about this blog post


Kevin Andrew Lipscomb said...

This is the best article on this topic that I have found, and I've been searching for hours.

If anyone can advise what exactly enables or prevents the client computer from receiving its IP and DNS addresses automatically, it would be a big help.

My experience so far is exactly that of the author -- I had to make those setting manually on both the ICS host and the client machines.

Thomas S said...

I agree, this it the most useful article i've found.

I had it working... briefly, and my second pc showed it was connected to the internet via my network and 3G dongle, however, it was unable to load pages in internet explorer. i then disconnected, and reconnected the 3G internet, and came across another problem... everytime i reconnect, the modem has a different ip adress. and this results in the second laptop not being able to connect (because the DNS server details will be incorrect)

any ideas... Anyone?

Igor Mateski said...

First of all, thanks for reading my blog and for the comment.

The IP address of the 3G modem will change, but that does not affect your connectivity because the second PC uses the static IP of the WiFi card on the first PC. The DNS Server IP is always the same. It is not a dynamic address.
Check to see if the IP settings on both PCs are in the same IP range:
PC 1:

PC 2:
Subnet 255.2552.55.0
Default Gateway
Prefered DNS (see it from the 3G connection)

Of course, you shouldn't forget to allow Internet Connection sharing on the WiFi of PC1.
Make sure you put the two PCs into a home network.

It must work with these settings.
If IE still doesnt want to load pages, you may need to check your Firewall settings on both PCs and the Internet Options in IE.
Good luck