IPhone Share Internet

From ivc wiki
Jump to navigationJump to search

It's possible to share the EDGE connection on the iPhone using the Wifi connection as a tunnel.

Setup Ad-Hoc Network

The iPhone and laptop can be connected directly using an Ad-Hoc network. This can easily be set up in Windows.

Open the wireless network adapter properties, click the 'Wireless Networks'-tab.

File:Eee iphoneshare wireless properties.png

At the bottom, to into the 'Advanced' settings, and select Computer-to-computer (ad hoc) networks only.

File:Eee iphoneshare wireless properties advanced.png

Now, add an ad-hoc network by clicking Add, typing a SSID like iPhonePipe, and selecting Disable in the data encryption drop-down.

File:Eee iphoneshare wireless properties add network.png

There should be only one network in the Preferred networks list, e.g. iPhonePipe, click Ok to commit the changes.

File:Eee iphoneshare wireless properties ready.png

Configure iPhone

With the ad-hoc network set up, connect the iPhone to the new ad-hoc network.

To keep the iPhone from dropping the Wifi ad-hoc connection, disable Auto-lock under Settings, General, Auto-lock, and set it to Never.

File:Eee iphoneshare iphone autolock.png

To connect to the ad-hoc network, go to Settings and Wi-Fi, wait a moment for the scan to complete, and select the new ad-hoc network, e.g iPhonePipe

File:Eee iphoneshare iphone wifi.png

Once the iPhone is connected with a check next to the name, touch the blue arrow to find the pseudo IP address for the iPhone connection. It's recommended to set a static IP address to avoid clutter later, see next paragraph.

File:Eee iphoneshare iphone wifi ipaddress.png

Alternatively, set a static IP address to skip all the refresh and wait for the pseudo DHCP IP to be set.

File:Eee iphoneshare iphone wifi ipaddress static.png

Next, SOCKS does not allow DNS look ups and the iPhone has to act as a relay or forwarder for DNS queries. I've put together an iPhone applications to easily start and stop a BIND name server.

Extract the Bind.app directory to /Applications, and make the named binary executable and set the SUID bit, chmod +xs named. Also, make FrontEnd.sh executable.

Start the BIND server after the tunnel is active, otherwise the named daemon will refuse incoming queries because the new tunnel interface is unknown. Always stop and start the BIND server if the networks settings has changed.

PuTTY Tunnel

Set up a tunnel via SSH to allow the data requests to be sent to the iPhone end of the ad-hoc connection. The SSH server on the iPhone acts as a SOCKS proxy server.

Open a new session and type the IP address from the iPhone in the Host Name (or IP address)-field.

File:Eee iphoneshare putty newsession.png

Next, go to the Connections, SSH, and Tunnels screen. Add a new forwarded port, first select Dynamic destination, and then enter a random port number in the Source Port-field, e.g. 9999, leave Destination-field empty, and click Add to add the new entry to the list.

File:Eee iphoneshare putty tunnel.png

Now, click Open to start the SSH the connection to the iPhone. Accept the key challenge and login using root as the login. If the password of the jailbroken iPhone hasn't been changed, the password is either alpine or dottie.

If you see a # character and get a command-line, everything is good.

File:Eee iphoneshare putty loggedin.png

Configure Applications

The Internet sharing only works in programs what allow you to set a SOCKS proxy server, e.g. Firefox, Pidgin, Internet Explorer, MSN Messenger, and more.

To surf via EDGE using Firefox, change the proxy settings in Options, Advanced, Network, and Settings. Select Manual proxy configuration and at the second to last field, SOCKS Host, enter localhost. The PuTTY client is the local tunnel to the iPhone, and therefore the localhost-address is used when interfacing with the tunnel.

Use the port set as Source Port in PuTTy, e.g. 9999, in the port field.

File:Eee iphoneshare firefox options.png

A SOCKS trick for Firefox is to set network.proxy.socks_remote_dns to true to do the DNS resolving over the SOCKS tunnel and not regular TCP/IP connection. In the address bar, enter about:config. Then in the filter bar enter socks_remote_dns and double click the preference to change false to true. Re-open Firefox. If you get unable to connect messages, try to set the setting to false and start the BIND name server on the iPhone.

File:Eee iphoneshare firefox socksdns.png

Now, try to open www.google.com and if it doesn't load as fast as normal you know you're on EDGE. :)

If you encounter problems, as you probably will, try to re-initialize the process.

References