The Problem: The iPhone USB Ethernet Driver (ipheth) kernel module
has been accepted upstream as of Apr 21 2010 for kernel 2.6.34; however, the ipheth kernel module is missing support for the iPhone 4.

"This is a Linux Kernel driver that adds support for iPhone tethering through USB cables. Unlike other solutions out there, you don't need to jailbreak your phone or install third-party proxy applications."

There has been a patch released in Kernel 2.6.36 to include support for iPhone 4; however, in Backtrack 4 r2 we're currently only to kernel 2.6.35.

Once BackTrack is updated to use Kernel 2.6.36 or later the ipheth module included with the kernel should natively support the latest iPhones. See the below links for an overview of the issue:

(https://bbs.archlinux.org/viewtopic.php?id=107388)
(LKML: David Miller: Re: [PATCH] drivers/net/usb: Add new driver ipheth)
(git.kernel.org - linux/kernel/git/torvalds/linux-2.6.git/commitdiff)

The Fix: To enable native USB tethering for the iPhone 4 in BackTrack 4 r2 using an updated ipheth driver and pairing utility.

Regardless of whether or not you have an iPhone 4 or an older version (2G, 3G, 3GS) you'll also still need a user-space pairing program for the driver to work.

"The pairing program is necessary in order to do a handshake and pair the device with the computer, otherwise it won't respond to kernel driver requests and thus won't work."

Currently there are two main options for pairing:

1. The ipheth-pair utility packaged with the ipheth-driver:
(Diego Giagio :: Personal Website - iPhoneEthernetDriver)

2. The newly added idevicepair utitlity packaged with libimobiledevice (aka libiphone).
(libimobiledevice - Teaching Penguins to talk to fruits)
(ipheth - Page 4 - Linux Archive)

In this tutorial we'll be using the ipheth-pair utility as it's already included in the package with the ipheth-driver. Keep in mind though, that the idevicepair utility will be the one supported in future releases; however, it currently has very limited documentation and does not include a udev rule to automatically pair the iPhone upon connection. We could easily create our own udev rule until an official one is released; however, I still had some issues getting idevicepair to actually give me an internet connection. More on udev in Part 3 below.

Overview: This fix/tutorial will be largely based on the following tutorials with customizations specific for BackTrack 4 r2. Look these pages over first:

(https://wiki.archlinux.org/index.php...Native_Support)
(Abort, Retry, Hack? » Blog Archive » iPhone syncing on Linux, part 2)

Warning: "If you are a new or inexperienced user, or you are not used to compiling things from source, editing configuration files, and doing some basic troubleshooting, stop here. This isn’t ready for you. In the not too distant future, distros will package this, it will be delivered with your usual dose of healthy and working open source software, and it will all work automagically as soon as you plug in your device."

Background: View the following links for descriptions and comprehensive diagrams of the software architecture/stack that we will be compiling.

(usbmuxd: iPhone/iPod Touch Linux Syncing Support | FSMdotCOM)
(libiphone)
(http://www.libimobiledevice.org/am-stack-fig-4.png)

As there is a 10,000 character limit per post, I'll be posting the tutorial in three separate parts:
  • Part 1, Compiling package dependencies and Install
  • Part 2, Test, Debug, and Manual Pairing
  • Part 3, Automatic Pairing using udev rules