Jailbreak your iPhone. iPhone Hacks provides excellent guides to jailbreaking your iPhone. I used the instructions on this page to jailbreak mine.
Install Mobile Terminal, OpenSSH and 3proxy from Cydia..
Install PuTTY on your PC from http://www.putty.org and UltraVNC Client from http://www.uvnc.com. If you don't have Firefox on your PC, you probably should not be doing this.
Go to Contol Panel (Classic View) -> Network and Sharing Center:
The menu is like the classic Adventure maze inentifications: "a maze of twisty little passages", "a maze of little twisty passages", "a
little maze of twisty passages", etc., until you undersand that there are two configurations involved:
The following instructions will obliterate your current configuration. Be sure you are know your current working wireless configuration. You will want to return to it when you are done.
In "Manage wireless Networks" click on "+ Add":
You may get a security prompt to continue. Of course you must OK it.
Select "Create an ad hoc network":
Click "Next" in the noise window:
Provide a network name, disable security, and check "Save this network".
When this procedure has become routine, you need to work through the details of creating a secure Ad-Hoc wireless network. In the meantime, you will have to disable the Ad-Hoc network whenever it is not in use. I found that WEP would work, but WPA-2 would not.
In "Manage Wireless Networks" it is important to disable automatic connections for other networks. Either "Remove" them or right click on them, select properties in the dropdown and:
Clear the check boxes regarding enabling and connecting. Then click "OK". Close the "Manage Wireless Networks" panel.
Return to"Network and Sharing Center" click on "Manage network connections":
Right click on "Wireless Network Connection", and select "Properties" from the dropdown list.
You may get a security prompt to continue. Of course you must allow it.
In "Wireless Network Connection Properties" highlight "Internet Protocol Version 4(TCP/IPv4)" and click "OK". Here you want to change your existing wireless connection to make a connection to the iPhone over the Ad Hoc network.
If you are not using automatic configuration via DHCP, keep a record of the information in this panel and in the associated "Advanced" panels. You will need that information later to restore your original Wi-Fi connection. Select the top radio buttons in each set. When you are done the panel should look like this:
Click "OK" and "Close".
In the Manage Network Connections panel right click on Wireless Network Connection. Disable the connection, wait about a minute then Enable the connection. Th
On your iPhone select “Settings”
Change it to "Never" then to back to "Settings".
In "Settings" select "Network".
Set "Enable 3G" to "ON",
Set "Data Roaming" to "OFF".Select "Wi-Fi" ">".
Set “Ask to Join Networks” to “ON”
Select the ad hoc network that was created on the laptop. Touch the blue “>” arrow.
Record the IP Address of the iPhone on the ad hoc network. The IP Address should be between 169.254.0.0 and 169.254.255.254. (I believe that other addresses on the laptop or the iPhone may confuse the proxy server.)
If "DHCP" is not selected, an IP address will not be shown. In that case you must select DHCP, return to the Wi-Fi Networks panel, toggle Wi-Fi to OFF, wait twenty seconds, and toggle it back to "ON" again. Then when you return to the Network Details you should see an IP Address and Subnet Mask.
You should see a connection icon in the system tray of your PC in the lower right hand corner of the screen. It looks like two terminals, one in front of another. (If you have turned this feature off, you will have to use less convenient means to observe the connection status.) When you toggle the Wi-Fi Networks to OFF the icon will acquire e a red "X". When you toggle it back on, there will be a yellow "!" while the connection is being established and a clean icon showing two terminals when the Ad Hoc network has been established.
At this point there are two more things you can do to confirm the connection.
You can use PuTTY on your PC to connect to the iPhone using the IP address that is shown on the iPhone. The IP address was provided to the iPhone by the PC's DHCP when the Ad Hoc connection was established.
When you run an SSH connection for the first time with a given IP address you will get the following screen for SSH to exchange secure keys and create a secure connection on the IP address. (This is a critical security point where a "man in the middle" security attack could occur.)
After clicking "Yes" you may receive a "logon" prompt in a terminal window:
The standard iPhone 3G user ID is "root", and the password is "alpine". (You may want to change the default password at some point, but that entails other risks.)
A much more interesting test is to use UltraVNC:
(The iPhone's IP address is inconsistant in this documentation.)
When you click "Connect" a permission panel will pop up on the iPhone. When you authorize it, you can take iPhone screen shots on your PC, navigate on your iPhone from your PC, etc.
These two mechanisms confirm that the Ad Hoc network between your PC and your iPhone are working.
Just to confirm the capabilities enter the command “ps -ef” to show the processes running in the iPhone:
Return to the iPhone, go to the Safari Browser and browse to any page. This is necessary to establish DNS addresses in the iPhone for using the 3G network.
Note the “3G” in the upper left hand corner of the page.(This capture of the PuTTY web site is accidental. PuTTY has no special meaning here.)
Start a terminal session on the iPhone:
You may or may not be prompted for a userid and password when you start terminal. The userid is “root”, the password is “alpine” unless it has been changed.
Next start the socks demon (server) in the terminal window:
You need to leave this terminal session up and running. You can navigate away from it on the iPhone and return to it any time. When you want to shut it down, hold down the iPhone menu button for about ten seconds until the terminal window vanishes and the other buttons appear. This kills the terminal session.
You can use the PuTTY connection to confirm the running socks server:
Note that process number 374 is the socks process. It can be terminated and started in two ways.
On your PC, open a command window and enter the command: "ipconfig /all"
Windows IP Configuration
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) Wireless WiFi Link 4965AGN
Physical Address. . . . . . . . . : 00-1F-3B-3E-BD-7B
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::41f0:330d:67a4:6c5%11(Preferred)
Autoconfiguration IPv4 Address. . : 169.254.6.197(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
NetBIOS over Tcpip. . . . . . . . : Enabled
In the extract above (scraped from the command window) you can see that an IPv4 address has been assigned begining with 169.254.*.*. This is an Ad Hoc network assigned address. It is interesting ot see, as well as the null DNS server address. You do not need to re-enter them anywhere.
Navigate to Tools → Options → Advanced → Network (tab) → Settings (button)
Fill out the panel as shown above. DO NOT fill in the HTTP Proxy. Fill in the SOCKS Host information and port number “1080”. Select SOCKSv5. Supply the IP address obtained from the Wi-Fi Ad Hoc connection setting on the iPhone.
In the URL box of Firefox enter the command: “about:config”
Sign your life away by promising to be careful. (I had to do a cold reinstall of Firefox when it stopped working wile I was writing this.)
As above, enter “socks” in the Filter window.
Confirm that the IP address and socks proxy port were entered correctly earlier.
If the entry “network.proxy.socks_remote_dns” has the boolean value of “false” double click on it and it will change to true.
You must stop and re-start your Firefox browser.
It should be working through your iPhone 3G connection now.
It is unlikely that AT&T can see clearly that you are using a PC based version of Firefox instead of an iPhone based version of Safari. It is also unlikely that they will care. Although 3G performance is excellent, Wi-Fi is a far better choice. Making this switch to an iPhone modem is not easy. Very few people would go through this much trouble to use their iPhone as a modem. If AT&T and Apple seriously care about jailbreaking, they probably care about Skype and jailbroken SMS messaging solutions more than they care about 3G modem connections.
For me, this was a technical exercise that would make it possible to use the iPhone this way on an emergency basis. When it was done, I decided I needed to document it so I wouldn't forget it and so that others could use it.
If you are using your iPhone as a modem, you are essentially using it to translate your web surfing activities to a more convenient keyboard, and a larger screen. You will not increase your traffic on the internet by switching from a small iPhone screen and keyboard to a computer screen and keyboard. But, when you make the screen and keyboard more appealing and useful, you might use your 3G connection more.
HOWEVER, there are many things that will consume significant bandwidth, could create problems and attract the attention of AT&T. Flash is something that is not supported in iPhone Safari and could create problems. This means you should stay away from YouTube. Bit-torrent and other massive downloads are obviously things to avoid. Automatic updates are also a problem. If you want to stay out of trouble you shou be very careful when using this mechanism. I fell asleep with my connection enabled. When I woke up many hours later I noticed that the byte count on the PC connection had soared. I don't know how much of this was traffic through the internet.
Rules are guidance to the wise, ignored by fools at their peril.