It may not be a fast data-connection, but your iPhone’s EDGE data service can prove invaluable if you’re stranded and in need of wireless data ASAP. Jonathan “NerveGas” Zdziarski has just released a new method to tether your iPhone to your Leopard computer (laptop). For the uninitiated, “tethering” your iPhone to your laptop allows you to share (connect) your iPhone’s data connection – your laptop is essentially using your iPhone as a wireless modem. The new method should be more reliable than previous iPhone tethering solutions.
The solution requires that you <a href=”http://www.intomobile.com/2008/11/23/iphone-dev-team-does-it-again-pwnage-tool-22-jailbreaks-iphone-22-os.html”>jailbreak</a> your iPhone, install SSH and BSD Subsystem packages, and use a Leopard computer. NerveGas has also ported BIND 9.4.2 for use on the iPhone to make this new tether method work on your laptop.
Props to NerveGas!
WHAT YOU WILL NEED
1. A WiFi-enabled notebook running Leopard
2. A jailbroken iPhone, running the BSD Subsystem
3. My port of BIND/DNS from here: http://www.zdziarski.com/iphone/
Step 1: Create an Ad-Hoc Network
Leopard has the ability to easily create ad-hoc networks on-the-fly. You’ll
need to create one of these so that the iPhone and your notebook can share
a WiFi network connection.
To create an ad-hoc network, click on the airport icon on the menubar in
Leopard. Select “Create Network…”. You will be prompted to “Create a
Computer-to-Computer network”. You can name the network anything you like –
we will use “Tethering”. Once you have named it, click “OK”.
NOTE: The iPhone appears to have difficulty connecting to an ad-hoc network
that is password-protected (e.g. WEP encrypted). You’ll want to avoid
requiring a password to join the network.
Step 2: Set the Notebook’s Local IP
At this point, your ad-hoc network has been created and your notebook is
connected to it, but because your notebook doesn’t run a DHCP server, a
nonroutable IP address will be assigned. You’ll need to manually set an
IP address and netmask so that the iPhone and the notebook can talk to each
other. The easiest way to do this is by manually configuring the wireless
interface from a terminal window.
Open a terminal window and type the following command in Leopard:
# sudo ifconfig en1 inet 192.168.0.1 netmask 255.255.255.0
The IP address of your wireless interface will now be set to 192.168.0.1.
Step 3: Connect the iPhone to the ad-hoc network
Now connect your iPhone to the ad-hoc network. Go to Settings -> WiFi.
You should see the name of your ad-hoc network on the network list (in
our example, “Tethering”). Tap the network and you should connect.
Once connected, you’ll need to configure the iPhone to have a static address
on the network. Tap the blue disclosure arrow to bring up the iPhone’s
network settings. Tap “Static” to set the information manually. Now enter:
IP Address: 192.168.0.2
Subnet Mask: 255.255.255.0
DNS: [ IP of your ISP’s DNS Server ]
Press the back button (labeled “Wi-Fi Networks”) for these changes to
You should now be able to ping 192.168.0.2 from your notebook. If you
can’t, you’ve done something wrong. Go back and repeat these steps.
Step 4: Run SOCKS Relay Daemon
Once both devices are connected to the ad-hoc network, you can start up
the SOCKS daemon on the iPhone. If you have the BSD subsystem installed,
you should be able to just type ‘srelay’ from MobileTerminal, or ssh into
your iPhone and run it from there. It will launch into the background.
To confirm that it is running, you can run:
# netstat -an | grep LISTEN
You should see:
tcp4 0 0 *.1080 *.* LISTEN
Step 5: Set up DNS
If you are tethering specifically to use Firefox, you won’t need to set up
the iPhone’s DNS server. Instead, go into Firefox’s configuration by
typing “about:config” into the URL window and hitting enter. Scroll down
to find the network.proxy.socks_remote_dns option and set it to true.
If you’re using any other applications over our tethered connection, you
may need to run a DNS server from your iPhone to provide name resolution.
Install the BIND/DNS package from http://www.zdziarski.com/iphone/ and
extract it onto the iPhone:
# cd /
# tar -zxvf bind-9.4.2_arm-apple-darwin.tar.gz
You should now be able to start the DNS server by running:
# named -c /var/named/named.conf
If you have any problems, try running it with the -g argument to run it
in the foreground, to display stderr.
You’ll need to set /etc/resolv.conf to use 192.168.0.2
Step 6: Configure your Applications
Apple has made some recent changes to Leopard so that setting the iPhone
as a SOCKS server in the network preferences will cause the connection to
be lost. This means you’ll have to configure your applications individually
to use the iPhone as a SOCKS proxy. Some of the more popular applications
Go into Firefox preferences -> Advanced -> Network Tab. Click the
“Settings…” button in the “Connection” section. Select
“Manual proxy configuration”. For SOCKS host, use 192.168.0.2 Port 1080
Use the -L flag in SSH to port forward any ports to the iPhone, and
then from the iPhone to your destination machine. This will allow you
to tunnel your IMAP/POP mail and whatnot.
That’s it – you should be able to connect via SOCKS
[Via: iPhone Atlas]