Difference between revisions of "IPhone Share Internet"

From ivc wiki
Jump to navigationJump to search
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
It's possible to share the EDGE connection on the iPhone using the Wifi connection as a tunnel.
It's possible to share the EDGE connection on the iPhone using the Wifi connection as a tunnel.
'''Update 2009-07-14:''' It's now easier to either use the official Apple '''tethering''' provided in the v3.0 software (only for 3G/3GS models) or the Cydia application called '''PdaNet'''. As for PdaNet the ''Setup Ad-Hoc Network'' section below is still valid.


== Setup Ad-Hoc Network ==
== Setup Ad-Hoc Network ==
Line 27: Line 29:
To keep the iPhone from dropping the Wifi ad-hoc connection, disable ''Auto-lock'' under ''Settings'', ''General'', ''Auto-lock'', and set it to ''Never''.
To keep the iPhone from dropping the Wifi ad-hoc connection, disable ''Auto-lock'' under ''Settings'', ''General'', ''Auto-lock'', and set it to ''Never''.


[[Image:Iphone share iphone autolock.png]]
[[Image:Iphone share iphone autolock.png|240px]]


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''
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''


[[Image:Iphone share iphone wifi.png]]
[[Image:Iphone share iphone wifi.png|240px]]


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.
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.


[[Image:Iphone share iphone wifi ipaddress.png]]
[[Image:Iphone share iphone wifi ipaddress.png|240px]]


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


[[Image:Iphone share iphone wifi ipaddress static.png]]
[[Image:Iphone share iphone wifi ipaddress static.png|240px]]


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.
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.


* [http://beta.ivancover.com/eee/bind_app.zip Download BIND for iPhone]
* [http://beta.ivancover.com/eee/Bind_app.zip Download BIND for iPhone] ([http://beta.ivancover.com/eee/bind-9.4.2_arm-apple-darwin.tar.gz original tarball])


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.
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. Reload SpringBoard to load the new app, ''killall SpringBoard''.


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.
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.
Line 57: Line 59:
Open a new session and type the IP address from the iPhone in the ''Host Name (or IP address)''-field.
Open a new session and type the IP address from the iPhone in the ''Host Name (or IP address)''-field.


[[Image:Iphone share putty newsession.png]]
[[Image:Iphone share putty newsession.png|342px]]


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.
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.


[[Image:Iphone share putty tunnel.png]]
[[Image:Iphone share putty tunnel.png|342px]]


Now, before clicking ''Open'', save the session in the ''Sessions'' screen. Enter a name and press ''Save''. The next time, just select the saved session to bring up the tunnel.
Now, before clicking ''Open'', save the session in the ''Sessions'' screen. Enter a name and press ''Save''. The next time, just select the saved session to bring up the tunnel.
Line 69: Line 71:
If you see a ''#'' character and get a command-line, everything is good.
If you see a ''#'' character and get a command-line, everything is good.


[[Image:Iphone share putty loggedin.png]]
[[Image:Iphone share putty loggedin.png|500px]]


== Configure Applications ==
== Configure Applications ==
Line 79: Line 81:
Use the port set as ''Source Port'' in PuTTy, e.g. 9999, in the port field.
Use the port set as ''Source Port'' in PuTTy, e.g. 9999, in the port field.


[[Image:Iphone share firefox options.png]]
[[Image:Iphone share firefox options.png|310px]]


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.
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.
Line 101: Line 103:
When you want to connect to a regular wireless access point, in the wireless network properties, set ''Advanced'' to ''Any available network'' and the TCP/IP settings to ''Obtain an IP address automatically''.
When you want to connect to a regular wireless access point, in the wireless network properties, set ''Advanced'' to ''Any available network'' and the TCP/IP settings to ''Obtain an IP address automatically''.


On the iPhone, just select the network you wan to join and stop the BIND server.
On the iPhone, just select the network you wan to join, stop the BIND server, and set the Auto-lock.
 
== References ==
== References ==
* [http://lifehacker.com/software/feature/use-your-iphones-internet-connection-on-your-laptop-327066.php Use Your iPhone's Internet Connection On Your Laptop]
* [http://lifehacker.com/software/feature/use-your-iphones-internet-connection-on-your-laptop-327066.php Use Your iPhone's Internet Connection On Your Laptop]
* [http://thinkhole.org/wp/2006/05/10/howto-secure-firefox-and-im-with-putty/ HOWTO: Secure Firefox and IM with PuTTY]
* [http://thinkhole.org/wp/2006/05/10/howto-secure-firefox-and-im-with-putty/ HOWTO: Secure Firefox and IM with PuTTY]
* [http://www.iphoneatlas.com/2008/02/18/better-iphone-tethering/ Better iPhone tethering]
* [http://www.iphoneatlas.com/2008/02/18/better-iphone-tethering/ Better iPhone tethering]

Latest revision as of 19:13, 14 July 2009

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

Update 2009-07-14: It's now easier to either use the official Apple tethering provided in the v3.0 software (only for 3G/3GS models) or the Cydia application called PdaNet. As for PdaNet the Setup Ad-Hoc Network section below is still valid.

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.

Iphone share wireless properties.png

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

Iphone share 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.

Iphone share 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.

Iphone share 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.

Iphone share 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

Iphone share 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.

Iphone share 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.

Iphone share 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. Reload SpringBoard to load the new app, killall SpringBoard.

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.

Iphone share 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.

Iphone share putty tunnel.png

Now, before clicking Open, save the session in the Sessions screen. Enter a name and press Save. The next time, just select the saved session to bring up the tunnel.

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.

Iphone share 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.

Iphone share 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.

Iphone share firefox socksdns.png

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

Iphone share firefox myip.png

Troubleshooting

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

The iPhone has a tendence to drop the data connections when idle, try to open Safari on the iPhone to bring up the EDGE connection. An E should show in the systray when both the tunnel and EDGE connection is active and ready, a Wifi icon means the EDGE connection is dropped.

Try to reload the BIND server is you can't ping yahoo.com or resolve hostnames.

Revert Settings

When you want to connect to a regular wireless access point, in the wireless network properties, set Advanced to Any available network and the TCP/IP settings to Obtain an IP address automatically.

On the iPhone, just select the network you wan to join, stop the BIND server, and set the Auto-lock.

References