Monday 9 August 2010

iphone4 Tethering

After receiving my new iPhone4 on the 2nd of August, I was surprised to find my Telco now allowed tethering for free. This was a change from my previous contract for my iPhone 3 which required a call to the telco and an additional charge of $9.99 / month.

So here I am blogging via a tethered connection to my iPhone and I thought I would check what addresses I get on each device. To my surprise, I get a different IP address on each device. I discovered this by using one of those "what is my IP" sites (e.g. here). Yet my laptop locally had an IP in the 172.10.20.0/28 address space and also the next three hops out from my laptop.

traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  172.10.20.1 (172.10.20.1)  24.506 ms
 2  172.22.68.131 (172.22.68.131)  82.246 ms
 3  172.22.68.2 (172.22.68.2)  116.105 ms

This makes me think that my tethered traffic is being tunneled through my iPhones 3G connection. To make matters even more muddy, the ping app I have on my iPhone reports yet another IP address different to that reported by the ip address website. This makes me think perhaps there might be some transparent proxying going on.

Further analysis I find that the address site and ssh connection show consistent results for both devices. The only difference is the laptop is reporting a different local IP than that of the SSH connection or address website. The range allocated is a /28 which makes me think the iPhone supports multiple devices connected via bluetooth tethering to a single IP address which exists on the phone. Thus the ISP allocates one IP for the iPhone and a separate one for the tethering. This still doesn't explain the three hops from the tethered device inside the 172.16.0.0/12 private address space but I'll leave that to someone else to explain.

But the best news is that it works a treat and I no longer have to take a 3G dongle with me to access the 'net on my laptop.

More questions that answers I'm afraid but at least interesting networking. If only I could capture the network packets inside the iPhone.

Perhaps there's a useful document out on the 'net that describes the actual process going on.

I'll leave that to you as an excercise.

No comments: