FORUMS
Remove All Ads from XDA

[Q] Internet passthrough on Ubuntu

5 posts
Thanks Meter: 1
 
By Rabih-Sy, Junior Member on 14th May 2012, 07:52 AM
Post Reply Email Thread
Hi guys,

I want to use my PC running on Ubuntu 12.04 64Bit to access the internet.
Usually in Windows i use the HTC tool.

my phone is not rooted.
thanks for help
The Following User Says Thank You to Rabih-Sy For This Useful Post: [ View ] Gift Rabih-Sy Ad-Free
 
 
15th May 2012, 01:50 PM |#2  
OP Junior Member
Flag Damascus
Thanks Meter: 1
 
More
??
39 views, 0 reply !!!!
15th May 2012, 02:29 PM |#3  
suku_patel_22's Avatar
Senior Member
Flag Mumbai
Thanks Meter: 1,301
 
More
Coz maybe the ones who viewed the thread didn't know a solution hence not answered

May be someone who uses Ubuntu world know...
Most of us user windows...

Sent from a Desire S waiting for Kernel 3. WAKE UP HTC!!!!
16th May 2012, 03:56 PM |#4  
Senior Member
Flag Lagos
Thanks Meter: 6
 
More
if u hv HTC sense on ur device, just tick the INTERNET PASS THROUGH option from the notification tab
and the system will do the rest

cheers
16th May 2012, 04:14 PM |#5  
Senior Member
Flag Lagos
Thanks Meter: 6
 
More
check out screenshot below
Attached Thumbnails
Click image for larger version

Name:	Screenshot at 2012-05-16 11:04:33.jpg
Views:	1190
Size:	26.6 KB
ID:	1064749  
17th May 2012, 06:09 PM |#6  
OP Junior Member
Flag Damascus
Thanks Meter: 1
 
More
thanks for your replies

lynxnoon : yes I'v tried to do that, it will be connected to the PC but without internet connection.
18th May 2012, 10:24 AM |#7  
Senior Member
Flag Lagos
Thanks Meter: 6
 
More
ensure the adapters (esp the wired) are updated online and then try again.
Also ensure theres is pass through connection on ur fone and then try to browse with the in-built browser.
If all these still doesnt work then u have to find out if the internet service provider alllows tethering or the modem u r using.

cheers
22nd July 2012, 05:54 PM |#8  
Junior Member
Thanks Meter: 6
 
More
Quote:
Originally Posted by Rabih-Sy

Hi guys,

I want to use my PC running on Ubuntu 12.04 64Bit to access the internet.
Usually in Windows i use the HTC tool.

my phone is not rooted.
thanks for help

When I connect my phone and choose internet passthrough, the phone chooses ip address in the 192.168.99.0/24. If yours creates a different subnet you will have to change below accordingly.

I hope this solves your problem.

Edit /etc/rc.local sudo nano /etc/rc.local and add the following:

echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null
iptables -P FORWARD ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.99.0/24
iptables -A FORWARD -i eth0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT
#forward all dns queries from usb0 to google's dns server
iptables -t nat -I PREROUTING -i usb0 -p udp --dport 53 -j DNAT --to 8.8.8.8


then at terminal type:
sudo /etc/rc.local

that will get you connectivity, but it will be short lived because htc is stupid and will disconnect if it doesn't detect the winblows htc software crap.
So you will need to fake it out. Turns out the phone is listening for htc software on port 6000 for 00 02 00 00 hex.

first you have to find the ip address of your phone (if arp doesn't work or you get command not found, you probably need to sudo arp):
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')

then you tell the phone that htc software is listening:
echo -n -e "\x00\x02\x00\x00" | nc $phoneip 6000 > /dev/null

To make that automagic each time us a script. Call it htcfaker or whatever:

#!/bin/bash

while :; do
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
while [ -z $phoneip ]; do
sleep 15
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')

done
echo -n -e "\x00\x02\x00\x00" | nc $phoneip 6000 > /dev/null

while [ "$phoneip" != "" ]; do
sleep 15
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
done
done


Then in your startup applications, point to that script.

Hope it helps!
The Following 5 Users Say Thank You to haz3lnut For This Useful Post: [ View ] Gift haz3lnut Ad-Free
7th November 2012, 01:32 AM |#9  
Senior Member
Thanks Meter: 17
 
More
I'm using unrooted HTC Sensation XE and Ubuntu 12.04 64-Bits, with these scripts Internet Pass Through works beautifully!

Quote:
Originally Posted by haz3lnut

When I connect my phone and choose internet passthrough, the phone chooses ip address in the 192.168.99.0/24. If yours creates a different subnet you will have to change below accordingly.

I hope this solves your problem.

Edit /etc/rc.local sudo nano /etc/rc.local and add the following:

echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null
iptables -P FORWARD ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.99.0/24
iptables -A FORWARD -i eth0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT
#forward all dns queries from usb0 to google's dns server
iptables -t nat -I PREROUTING -i usb0 -p udp --dport 53 -j DNAT --to 8.8.8.8


then at terminal type:
sudo /etc/rc.local

that will get you connectivity, but it will be short lived because htc is stupid and will disconnect if it doesn't detect the winblows htc software crap.
So you will need to fake it out. Turns out the phone is listening for htc software on port 6000 for 00 02 00 00 hex.

first you have to find the ip address of your phone (if arp doesn't work or you get command not found, you probably need to sudo arp):
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')

then you tell the phone that htc software is listening:
echo -n -e "\x00\x02\x00\x00" | nc $phoneip 6000 > /dev/null

To make that automagic each time us a script. Call it htcfaker or whatever:

#!/bin/bash

while :; do
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
while [ -z $phoneip ]; do
sleep 15
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')

done
echo -n -e "\x00\x02\x00\x00" | nc $phoneip 6000 > /dev/null

while [ "$phoneip" != "" ]; do
sleep 15
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
done
done


Then in your startup applications, point to that script.

Hope it helps!

4th January 2013, 05:42 PM |#10  
Junior Member
Thanks Meter: 0
 
More
Did anyone experienced the problem that this stopped working after a day or so?
When I plug into the phone now it just wont give a ipv4 address therefore theres nothing to re-route through the pc?
9th January 2013, 10:02 AM |#11  
Senior Member
Thanks Meter: 17
 
More
Mine still working without any problem after 2 months. I can only suggest you to check 2 things:
  1. Ensure your /etc/rc.local file is not changed due to any Ubuntu update
  2. You have to run the "htcfaker" script in Terminal before plugging in your phone. Do not close this Terminal until you want to disconnect.

Quote:
Originally Posted by fruity12

Did anyone experienced the problem that this stopped working after a day or so?
When I plug into the phone now it just wont give a ipv4 address therefore theres nothing to re-route through the pc?

Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes