bea2 HOWTO: iPhone internet connection sharing via USB - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Miscellaneous > Howtos & FAQs (Moderated)

Howtos & FAQs (Moderated) Would you like to share some of your solutions for certain problems? Tips or tricks? Post here. All new topics are automatically moderated.

Reply
 
Thread Tools Display Modes
  #1  
Old December 7th, 2010, 14:42
Zare Zare is offline
Member
 
Join Date: Nov 2008
Location: Split, Dalmatia
Posts: 360
Thanks: 26
Thanked 50 Times in 41 Posts
Default HOWTO: iPhone internet connection sharing via USB

This will probably also work for iPod/iPad also, but i don't have those.

Enable "tethering" (don't you just love these web2.0 yuppie words? pfff...) in your device. Go to settings, network, internet tethering, and activate it.

1. Kernel iPhone USB ethernet support

There's a kernel module if_ipheth.ko in FreeBSD 8-STABLE (8.2-PRERELEASE as of writing this text), i'm not sure about earlier versions. I had the file in 8.1-RELEASE, but i can't say would it work because i haven't completed the whole procedure under 8.1-RELEASE.

So just kldload that file and/or include it in your /boot/loader.conf

2. USB libraries needed for communication

We'll need libimobiledevice, libplist, usbmuxd and ipheth_pair. usbmuxd will establish connection to iPhone, and it needs libimobiledevice as a main dependency. libplist comes as libimobiledevice dependency. ipheth_pair will do actual pairing, communicating with device via usbmuxd. Before that happens we can't use iPhone as gateway.

$ wget --no-check-certificate http://github.com/downloads/JonathanBeck/libplist/libplist-1.3.tar.bz2
$ tar xvfj libplist-1.3.tar.bz2 && cd libplist-1.3
$ mkdir build && cd build && cmake ..
$ su
# make install

$ http://www.libimobiledevice.org/downloads/libimobiledevice-1.0.4.tar.bz2
$ tar xvfj libimobiledevice-1.0.4.tar.bz2 && cd libimobiledevice-1.0.4
$ ./configure LDFLAGS="-L/usr/local/lib/"
$ su
# make install

$ wget http://marcansoft.com/uploads/usbmuxd/usbmuxd-1.0.6.tar.bz2
$ tar xvfj usbmuxd-1.0.6.tar.bz2 && cd usbmuxd-1.0.6
$ mkdir build && cd build && cmake ..
$ su
# make install

If all goes ok, you'll have a functioning usbmuxd under /usr/local/sbin/usbmuxd. Now we need to take care of pairing program;

$ git clone git://github.com/dgiagio/ipheth.git
$ cd ipheth/ipheth-pair

Forget the Makefile and just run this;

$ cc -Wall -O2 ipheth-pair.c -o ipheth-pair -L/usr/local/lib -I/usr/local/include -limobiledevice

3. Running / testing procedure

Hook up your iPhone to USB port, and you should see something like this from your kernel output;

Code:
ugen7.2: <Apple Inc.> at usbus7
Now, run usbmuxd as root in foreground mode, so we see it's output

# /usr/local/sbin/usbmuxd -U root -f

This output indicates that communication to device has been established;

Code:
[14:33:13.113][3] usbmuxd v1.0.6 starting up
[14:33:13.119][3] Could not check kernel ownership of interface 0 for device 7-2: -99
[14:33:13.170][3] Connecting to new device on location 0x70002 as ID 1
[14:33:13.170][3] Initialization complete
[14:33:13.171][3] Connected to v1.0 device 1 on location 0x70002 with serial number 37edfec09f8b80ea839ddbf01cf44030d942551b
OK, let's now recheck kernel output via dmesg, kernel driver should now be able to create an ethernet device for iPhone's gateway connection;

Code:
ipheth0: <Apple Inc. iPhone, class 0/0, rev 2.00/0.01, addr 2> on usbus7
ue0: <USB Ethernet> on ipheth0
ue0: Ethernet address: 78:ca:39:75:f8:ab
So the device ue0 is created, but until we pair we won't have connectivity. Go back to the directory where you compiled ipheth-pair and run it. If all goes well it'll just drop you back to prompt without error message, and the blue title "Internet Tethering" will start blinking below the status bar of your iPhone.

Just poll the device via DHCP and you're good to go.

# dhclient ue0

Note : for some reason, DHCP client does not push default gateway to my routing table and DNS server entry into resolv.conf. Default gw is the address you'll get your lease from (in my case 172.10.20.1), but the DNS server isn't, in my case it's 10.48.65.30 (note it's still private scope). I had to connect my phone to Windows machine to see what kind of address USB<->ETH adapter over there gets.

I haven't had time to check stability of this mechanism.
Reply With Quote
The Following User Says Thank You to Zare For This Useful Post:
vermaden (December 9th, 2010)
  #2  
Old December 9th, 2010, 01:02
vermaden's Avatar
vermaden vermaden is offline
Giant Locked
 
Join Date: Nov 2008
Location: pl_PL.lodz
Posts: 2,193
Thanks: 59
Thanked 633 Times in 349 Posts
Default

Does it work for ANY iPhone, or only for older ones, or only for lates ones?
Does it work for hacked/jailbroken iPhones?
__________________
Religions, worst damnation of mankind.
"FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM
http://vermaden.blogspot.com

Last edited by DutchDaemon; December 9th, 2010 at 02:23.
Reply With Quote
  #3  
Old December 9th, 2010, 09:13
Zare Zare is offline
Member
 
Join Date: Nov 2008
Location: Split, Dalmatia
Posts: 360
Thanks: 26
Thanked 50 Times in 41 Posts
Default

I have iPhone 3GS. It should work with 3G and 4 also. And author of ipheth driver says it should work on 2G's with some patches. Since this mechanism is using Apple's protocol (you have same functionality in Windows or OSX), your phone doesn't have to be jailbroken.

I'm sorry, you asked does it work for jailbroken phones? Yes it does, my phone is jailbroken. Because jailed iPhone is really a dumb brick.

Keep in mind that jailbreaking doesn't modify system software, which recent cases against Apple proved. On the other hand, unlocking modifies system baseband code and i'm not sure would it work. There's no sane reason why it shouldn't but my phone isn't unlocked so i can't be 100% sure.

Last edited by Zare; December 9th, 2010 at 15:47.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Internet connection bishop_raven1989 Peripheral Hardware 5 August 26th, 2010 18:55
[Solved] Internet Connection Sharing in FreeBSD? mefizto Networking 4 July 29th, 2010 02:35
how to configure Huawei EC 325 USB modem for an internet connection in Freebsd 8.0 dalfish Peripheral Hardware 2 March 6th, 2010 01:09
[Solved] Internet sharing question... trybeingarun Firewalls 21 February 16th, 2010 13:37
Internet connection with Huawei or other 3G USB modem alie Off-Topic 6 December 9th, 2009 07:27


All times are GMT +1. The time now is 17:37.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0