Share iPhone WIFI with computer over USB?
Due to a water leakage, we had to move offices temporarily. In our temp offices, we have WIFI network, but not cabled network (yet).
Since my computer doesn't have WIFI (it's a stationary desktop) I thought I could see if I could bridge my iPhone WIFI connection over to my computer via USB while I wait for local facilities to set up cabled network here.
Is this possible?
Solution 1:
Sorry, but it's not possible to do this without jail breaking. The "Personal Hotspot" function on an iPhone only allows for sharing the 3G connection, not the wifi connection, so you can't use it as a wifi adapter. It's feasible that Apple could add this functionality, but it's a fairly niche case, so I wouldn't count on it.
More immediately, if you have a laptop with wifi available, you could use Internet Sharing (OS X)/Internet Connection Sharing (Windows) and an ethernet cable to get connectivity to your desktop. Or if you've got a Staples or something similar nearby, they usually have USB wifi adapters for $30 or less.
Solution 2:
Of course this is possible:
- Your iOS device must be joined to wifi connection
- Your iOS device must be jailbroken
- Your PC must have iTunes on it
- Install MyWi 5.0 over Cydia (Cydia will be installed on your iOS device after you jailbreak it)
- Choose USB tethering in USB tab
- Set MyWi USB to ON
- Go to Advanced USB
- Set USB Bridhe to "Bridged to WiFi" so you don't get online via 3G
- Enjoy your wireless internet connection
Solution 3:
which iPhone and iOS versions are you using? you will also need to check that your carrier allows a personal hotspot.
if you are able to turn on a personal hotspot on your phone, just connect the phone to the PC with a USB and enter the Wi-Fi password after finiding teh phone in the network settings.
You could also just get a WiFi USB which would pick up the WiFi from the router.
Solution 4:
Free method that works, with a jailbroken iPhone at least:
1) Install openSSH on your iPhone from cydia, or apt-get
, if you prefer the terminal.
2) Install python 2.7.x.
As of this writing the latest version is 2.7.6.
3) download libusbmuxd.
https://github.com/libimobiledevice/libusbmuxd
You can either do a git clone
or, if you don't have / want to get git
, download
the release from the 'releases' tab.
4) unpack it if you didn't take the git clone
route. If you downloaded the tarball,do
tar zxvf <tarball name>.tar.gz
from a terminal. In windows, use 7-zip or download the .zip version of the tool.
5) cd
into libusbmuxd/python-client
.
6) The following step is platform-dependent:
Windows
If you run windows, you will have to manually type the path to your python.exe
program. If you chose the default location, it will install into C:\Python27
. So, in windows, go to your command prompt and type C:\Python27\python.exe tcprelay.py -t 22:2222
.
Linux/Unix/Solaris/BSD, etc.
If you use Linux (like me), Cygwin in Windows, BSD/Unix, solaris, or basically any platform besides windows and DOS known to man, you will simply type python2.7 tcprelay.py -t 22:2222
.
7) Not quite done yet - You need a SSH client running! This, too, is platform-dependent.
Windows - PuTTY
In windows, cygwin makes this easy, but if you don't have cygwin already, PuTTY is a good option:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Set it up like this:
Be sure to set the login username to 'mobile'.
And, for a little extra speed (lower overhead from the encryption), change the encryption to 'arcfour'. Usually, I would not recommend this, but since you are pushing the encryption over a USB cable and not a network, security is less of a risk.
If you want, you can then save a profile for this, to avoid setting it all back up each time you have a problem. This is done in the 'session' section at the very top.
Linux/Unix/BSD/Solaris/OSX/HP-UX/whatever I'm still missing
You can run ssh -D 8080 -p 2222 [email protected]
The default password for the mobile
and root
accounts on the iphone should be alpine
. Once you are successfully logged in, you should see a xterm
-like window. type passwd
now, to change your password to something more secure. Also, type su
and use alpine
as your password to log in as root
and change the root
password as well. Then, type exit
to go back to your login as mobile
.
8) You're nearly done now, I swear! It's less complex than it appears so far, if you actually do it yourself!
Now, you need to open your web browser of choice; I use firefox, so I will use it as an example. I have used chrome, but as I do not like it and do not currently have it installed, I cannot presently use it for an example. But you set it up as a SOCKS proxy, regardless of browser.
These screenshots were done with a forwarded X11, so the fonts are ugly, but pay it no mind.
First, go to the preferences window (tools -> options
or edit -> preferences
, depending on OS). Then, go to Advanced -> Network -> Settings...
.
Use the following configuration for the browser.
Problems and Solutions
Problem:
Yeah, this isn't really using the iphone as a modem.
Solution:
Get over it; it works.
Problem:
My app doesn't allow setting a SOCKS proxy.
Solution:
I have had this problem with games like Minecraft. Here's some fixes.
For minecraft, I added a argument to ssh
. I regularly play on the nerd.nu reddit minecraft servers (reddit.com/r/mcpublic). Since minecraft 1.6, SSH tunneling and SOCKS proxies set as command line arguments haven't worked. You used to be able to add java parameters -DSocksProxyHost=127.0.0.1 -DSocksProxyPort=8080
and it would work. Now, however, the solution isn't quite as nice, but it does work.
When you start ssh
, instead of ssh -D 8080 -p 2222 [email protected]
, dossh -D 8080 -L 127.0.0.1:25565:p.nerd.nu:25565 -p 2222 [email protected]
.
Then, when you want to connect to the server, instead add the URL 127.0.0.1:25565
to your list of servers! The remote server will appear on 127.0.0.1/localhost thanks to the miracle of SSH tunneling!
For other programs/games, the same rule applies. If you can't set a SOCKS proxy and nothing else works, just add -L 127.0.0.1:<port>:<remote URL to access>:<remote port>
.
There is nothing forcing you to use the same port on 127.0.0.1
that you would normally, so I could have, for example, mapped p.nerd.nu:25565
to 127.0.0.1:1025
and the game wouldn't care as long as I specified the port. Not all programs are so lenient, but it's useful to remember.
Also, remember: Nearly any program can use this. So while it's not as nice as having a simple modem or something, It definitely works. Note that if you lose connection to wi-fi, you will probably start eating into your cellular network's data access. If the cellular network does deep-level packet inspection, be prepared for a charge for enabling tethering. Just be careful, please :) If you have "TetherMe" from Cydia, or something like that, it might mask what you are doing. Also, sometimes if the iphone goes to sleep it will turn off wi-fi. Install insomnia
from cydia/apt to get around that.
Or, to prevent deep packet inspection, you can also SSH from your iphone into a PC at home for encryption, and then SSH into your iphone from your device that you are wired into.