Tethering an iPhone with SSH and Windows 7
I don’t need to tether through my iPhone — I always seem to be near a
hotspot — but nonetheless I thought that spending 10 minutes to set it
up was worth it, because when you need tethering, you really need
tethering. If you’re willing to drop \$10 bucks there are a couple of
apps in Cydia that can do this easy (PhoneModem and MyWi, I think), but
I just wanted something that I could use in an emergency.
Unfortunately, despite the fact that there were some good
on how to do it, it turned out there were a few gotchas, and it took
significantly longer than 10 minutes. So, in the hopes that I can save
someone else the time:
- in Windows 7, you’ll want to use the “Network and Sharing Center”
(right click on your network icon) to create a new
“computer-to-computer” network. This is the one the iPhone will
- When you configure Putty, you’ll want to make sure you go to the
SSH/Tunnels page and a) add a dynamic tunnel to a local port (assume
8080) — you won’t need to specify a destination and can leave that
blank, and b) go to the “Connection” page and specify a keepalive of
5 or so. This keeps the SSH connection between the computer and the
iPhone from dying every 30 seconds.
- You cannot use Chrome right now, because it does not properly
forward DNS requests to the proxy (it took me hours to figure this
out). Use Firefox and specify a SOCKS v5 proxy at port 8080 (or
whatever) for the proxy, but you’ll also need to make sure to go to
the about:config page and change the
network.proxy.socks_remote_dns to “true”.
- Doing things in a particular order makes this work better. If the 3G
connection on the iPhone is not active, then there doesn’t seem to
be a way to activate after it links to your ad hoc connection. So:
turn off wireless, go to a web page (this activates the 3G), turn on
wireless, connect to your computer. This way both the 3G and
wireless connections are established. An easy way to see if the 3G
is active is to run MobileTerminal (or just SSH into the iPhone) and
run ipconfig; if the pdp_ip0 device is pointing to a real IP, then
your 3G is active.
Comments are moderated whenever I remember that I have a blog.