iPhone Tethering HOWTO

If you have a Mac with Wireless, and have set up your own SSH into the iPhone, you can easily configure tethering for those nerd emergencies when you need a data connection on your laptop, but can’t find a hotspot. When tethering, your iPhone acts like a WiFi SOCKS proxy, and routed over AT&T’s Edge Network.

NOTE: AT&T Does not, by policy, permit tethering. I claim no responsibility should these instructions void your calling plan with AT&T, or cause any other damage to your device.

Step 0. SSH Access

First, if you have not done so already, you will need to set up an SSH sheel into the iPhone so you can run programs from the commandline. Follow these instructions to get that part set up:

http://iphone.fiveforty.net/wiki/index.php/Dropbear-ssh

Step 1. Download and install srelay

The srelay project is a project to build an open source SOCKS proxy server. This is the tool we’ll use to proxy the connection onto the Edge network. We will be using a binary distribution of srelay, but if you would like to build from sources using the iPhone developer toolchain, the source code may be found here:

http://socks-relay.sourceforge.net/

For those who want to keep it simple, srelay is included in the iPhone Binary Kit distribution found here:

http://iphone.natetrue.com

Use scp or iPhoneInterface to upload iphone-binkit/usr/bin/srelay onto the iPhone, and then log in via ssh. Move the file to /usr/bin and then “chmod 555 /usr/bin/srelay” to set execute permissions.

Turn on srelay by executing “/usr/bin/srelay” from the commandline. This will give you a warning message about a missing configuration, and then execute srelay into the background with default settings. If you want to kill it later, you can simply kill the process (NOTE: You’ll need the ps and kill binaries, also available in the binary kit).

Step 2. Create a new Network

Now that srelay is running, we’ll set both your laptop and your iPhone up on a private, ad-hoc network. In OSX on your laptop, click the wireless icon from the menubar, and select the “Create Network” option. This will allow you to create a new ad-hoc wireless network. You can use the default options or set up a WEP key if you are concerned about privacy. You’ll only be hosting the ad-hoc network while you’re tethering, so this may not be necessary.

Click ‘OK’ to create the new network, and your laptop will be automatically joined to it.

Step 3. Join your iPhone to the new network

Go to your iPhone’s WiFi settings, and select the name of the new network you created. Once joined, you’ll need to click the > arrow to set additional settings.

Choose the “Static” IP Address option, and enter the following information:

IP Address: 192.168.1.100
Subnet Mask: 255.255.255.0

Then return to the main menu.

Step 4. Configure your laptop on the new network

Now we’ll configure a static IP on the laptop and configure the SOCKS proxy.

1. Go into your laptop’s network preferences
2. Double-click the AirPort connection to bring up the proeprties
3. Click the TCP/IP Tab
4. Select “Manually” from “Configure IPv4”, enter the IP address: 192.168.1.101, subnet mask 255.255.255.0.
5. Click the ‘Proxies’ tab. Scroll down the list of proxy servers until you come to “SOCKS Proxy”, Check the checkbox, and in the “SOCKS Proxy Server” box to the right, enter the IP address of the iPhone: 192.168.1.100, and a port number of 1080.
6. Click ‘Apply Now’ for the changes to take effect

Now you should be able to open a web browser, like Safari, and connect to web pages, as well as use any other tools that can be used over a SOCKS proxy. To break down the network, simply choose ‘Disconnect from Network’ from the Airport menu on the menubar, uncheck the SOCKS proxy, and revert your TCP/IP settings back to ‘Using DHCP’

Enjoy!

Credits to: natetrue & NerveGas


WordPress Appliance - Powered by TurnKey Linux