Internet passthrough on Ubuntu | HTC Desire S | XDA Forums xda-developers.com

Print Friendly, PDF & Email

Internet passthrough on Ubuntu | HTC Desire S | XDA Forums xda-developers.com

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

Last edited by haz3lnut; 22nd July 2012 at 07:36 PM. Reason: may need to sudo arp
#COPIED HERE INCASE xda-developers.com ever disappears without trace. Please call +447855129142 if this repost breaks copyright etc.
Posted in Pure Tech.

Leave a Reply

Your email address will not be published. Required fields are marked *