USB tethering without root (not SOCK5)

Search This thread

lilithpro

Senior Member
Oct 11, 2008
89
0
Nice one, this works great for me. I have ovpn installed anyway and with a simple self-written script it only takes 1 click and a connected phone to be online. Many thanks for this one!
 

Dimath

Senior Member
Nov 5, 2008
77
1
Los Angeles
I have "Connected to host" in status, but Internet does not work and I am getting error to ping command:
From 192.168.56.2 icmp_seq=1 Destination Host Unreachable.
What can be wrong?
I use linux and OpenVPN 2.1_rc10.
 

mochabyte

New member
Feb 25, 2009
1
0
I'll see if I can give it a quick test on a Mac sometime tomorrow.

EDIT: I managed to get it working, although T-Mobile's so-called "transparent" web proxy is barely working today so I was having trouble accessing websites without getting errors. SSH was working fine, though. Anyway, here's what I did:

1- Installed a MacOS port of OpenVPN called Tunnelblick (didn't have XCode handy to compile my own and it's got a pretty GUI)
2- Copied azilink.ovpn to /users/azi/library/openvpn or whatever it is
3- Click the Tunnelblick icon in the upper-right, go to details, click "set nameserver"
4- Remove the TCP_NODELAY line because it was complaining that my kernel didn't support it (and would cause my connection to timeout after about 30 seconds).
5- Clicked connect

If you want to see what traffic's going over openvpn, you can just run "sudo tcpdump -n -i tun0"

After wresting with this a bit today, I think I've got this working on OS X. Making the vpn connection worked fine with both the openvpn2 client from MacPorts and Tunnelblick, but getting proper DNS resolution setup was the only tricky part.

Setting your DNS resolver on OS X Leopard is a bit trickier than just adding an entry in /etc/resolv.conf, since that file is auto generated by the networking system, and really only exists for backwards compatibility with older tools like 'host' and 'dig'. Properly setting up DNS requires messing with some entries in the 'scutil' command line tool.

I didn't have much luck with Tunnelblick's supposed "Set nameserver" feature, as it only seemed to work when I had an existing wired, wireless, or some other kind of primary connection. So I dug around in the Tunnelblick.app to see if there was anything worth looking at, and came across /Applications/Tunnelblick.app/Contents/Resources/client.up.osx.sh. Tunnelblick calls this script after setting up the vpn connection to apply and DNS settings from your openvpn config to the existing primary adapter (e.g. wired, wireless). Since I'm using this to tether to the phone and don't have an existing primary connection, I think the the client.up.osx.sh script fails when it's unable to find an existing connection.

So, you could modify Tunnelblick's client.up script to do something a little different, but I actually just decided to whip up a custom script that uses the openvpn2 from MacPorts so I could just run one command on a terminal to set the whole thing up for me (including adb port forwarding), and tear it down when I ctrl+c it.

Have a looksie if interested:
http://pastie.org/405289
 

snetsplit

Member
Jan 30, 2009
24
7
Just want to say this app is a God-send. Thanks heaps aziwoqpd! Now I have the whole internet again.

I'm attaching some auto connect scripts. put these in your openvpn config folder with adb.exe and winapi.dll in your windows folder. Then you can open the openvpn gui and connect with a single double click. It'll automatically start adb up, then close it when you disconnect.

Also included is a copy of the openvpn gui called "net connector.exe" with modded android icons. I gave it a new name so you could copy it in there and keep your old openvpn gui too.

Again this freaken rocks! You go aziwoqpd!
 

FraMu

New member
Nov 25, 2008
1
0
This app is excellent

Hi,
I found this very useful when used with Ubuntu. The openvpn is stable with repeated connection and disconnections of the USB cable and the link comes back up almost always. Wifi speeds through the G1 were around 2Mbps which is the wire speed for my broadband link. 3G is pretty good also and I could run IPSec and VoIP over the link making it very useful.

There were a couple of things that tripped me up:
1) If I connect Ubuntu to G1 the openvpn link comes up as expected. If I then disconnect the USB cable and reconnect within 10s or so the openvpn link comes up momentarily. However in adb logcat I then see a message from azilink indicating it is closing the connection because it didn't see a keepalive in the previous 30s. This is odd because data is being sent/received after the reconnection. Either openvpn on Ubuntu has stopped sending keepalives or azilink has stopped receiving. Longer disconnect times do not exhibit this behaviour.

2) Change of WAN link from Wifi<->3G
During an active connection if I change from Wifi to 3G or vice versa I need to restart the azilink service to complete the switchover. From the azilink byte counter the send count continues to rise but the receive stays on zero until I restart the service.

Thought aziwoqpd may find the feedback useful.
Regards,
Frank
 

snetsplit

Member
Jan 30, 2009
24
7
Hi,
I found this very useful when used with Ubuntu. The openvpn is stable with repeated connection and disconnections of the USB cable and the link comes back up almost always. Wifi speeds through the G1 were around 2Mbps which is the wire speed for my broadband link. 3G is pretty good also and I could run IPSec and VoIP over the link making it very useful.

There were a couple of things that tripped me up:
1) If I connect Ubuntu to G1 the openvpn link comes up as expected. If I then disconnect the USB cable and reconnect within 10s or so the openvpn link comes up momentarily. However in adb logcat I then see a message from azilink indicating it is closing the connection because it didn't see a keepalive in the previous 30s. This is odd because data is being sent/received after the reconnection. Either openvpn on Ubuntu has stopped sending keepalives or azilink has stopped receiving. Longer disconnect times do not exhibit this behaviour.

2) Change of WAN link from Wifi<->3G
During an active connection if I change from Wifi to 3G or vice versa I need to restart the azilink service to complete the switchover. From the azilink byte counter the send count continues to rise but the receive stays on zero until I restart the service.

Thought aziwoqpd may find the feedback useful.
Regards,
Frank

I think that might be an OS issue. I forget to turn the wifi off and try tethering with it a lot. Never had a problem with it in XP, win7, and hackentosh versions of OS X.
 

thecrazier

New member
May 5, 2009
1
0
hey guys i need some help with this "configuration bit'' im really stuck here and confused, i started this project on the website he made and came across this forum becuase i looked for the help; in the website it doesnt mention anything about the AziLink.ovpn but it does here. i installed the program to the phone and the eclipse/driver to my laptop along with the openVPN, but how do i run "adb forward tcp:41927 tcp:41927" ? when i use command prompt, i get the message that it is not a command, internal nor external nor is it recognized as a operable program/ batch file. thanks also, does eclipse have to be running while i tether?
 

9a3eedi

New member
Jul 7, 2009
3
0
Hi,

I seem to be the only one getting this problem. I've google'd with no results. On the openVPN command line, I keep getting this:
Code:
Tue Jul 07 01:09:57 2009 read UDPv4: Connection reset by peer (WSAECONNRESET) (code=10054)

repeatedly,

and on AziLink on the phone, it stays on "waiting for connection" the entire time.

I'm pretty much stumped. Can anyone help?
 

ben@M

New member
Jul 8, 2009
4
0
After wresting with this a bit today, I think I've got this working on OS X. Making the vpn connection worked fine with both the openvpn2 client from MacPorts and Tunnelblick, but getting proper DNS resolution setup was the only tricky part.

Setting your DNS resolver on OS X Leopard is a bit trickier than just adding an entry in /etc/resolv.conf, since that file is auto generated by the networking system, and really only exists for backwards compatibility with older tools like 'host' and 'dig'. Properly setting up DNS requires messing with some entries in the 'scutil' command line tool.

I didn't have much luck with Tunnelblick's supposed "Set nameserver" feature, as it only seemed to work when I had an existing wired, wireless, or some other kind of primary connection. So I dug around in the Tunnelblick.app to see if there was anything worth looking at, and came across /Applications/Tunnelblick.app/Contents/Resources/client.up.osx.sh. Tunnelblick calls this script after setting up the vpn connection to apply and DNS settings from your openvpn config to the existing primary adapter (e.g. wired, wireless). Since I'm using this to tether to the phone and don't have an existing primary connection, I think the the client.up.osx.sh script fails when it's unable to find an existing connection.

So, you could modify Tunnelblick's client.up script to do something a little different, but I actually just decided to whip up a custom script that uses the openvpn2 from MacPorts so I could just run one command on a terminal to set the whole thing up for me (including adb port forwarding), and tear it down when I ctrl+c it.

Have a looksie if interested:
http://pastie.org/405289

You are a genius, Thanks a lot for your script...working perfectly for me
 

fanaticsurf

New member
Aug 25, 2009
3
0
Hi,

nice work. :)

I wonder if it is possible to do it in the other direction?

Android using the internet connection over usb of a laptop/pc connected over ethernet.

This will help to save some mobile data traffic.

fanaticsurf
 

fanaticsurf

New member
Aug 25, 2009
3
0
Thanks for your hint lbcoder,

but I am looking for a Windows solution, because my office pc/laptop just has Windows installed.
 

xda-vinnie

New member
Sep 9, 2009
1
0
Hi there,

Just thought I'd register and confirm that after some trial and error I successfully tethered my android phone (no SOCKS, no rooting) to a MacBook pro. Additionally, I got it working using the Tunnelblick openvpn app.

I did this by mainly following the instructions in this thread and here, which got me most of the way (i.e. AziLink showed a connected to host status).

A few notes about my settings and the Tweak I need to do in order to actually get a working 3G Internet connection.

1) I addition to the USB and AziLink setup, I have to turn off WiFi on the phone. (this is fine because if I am able to connect to a WiFi network I might as well do it directly from my MacBook).

2) I created a separate network location to use when tethered with the following settings:
a) deleted all services except Ethernet
b) configured IP4 manually, using the following settings:
i) IP address 192.168.0.20
ii) Subnet Mask: 255.255.0.0 (this varies, see Tweak below)
iii) Router: 192.168.0.1
iv) DNS Server: 192.168.56.1
v) Search Domains: (leave blank, see Tweak below)
c) Apply settings and leave the network preference pane open.

3) After running the adb forward command, opening the Tunnelblick application and connecting to the azilink vpn, the phone will show a Connected to host status. However, I was unable to successfully able to connect to the Internet until I did the following.

4) Tweak: After everything's setup as it should be, I found the following network preference change would actually enable the Internet connection.
a) Go back to the open network preference pane and change the third octet of the Subnet Mask field. i.e. if you originally set the Subnet Mask to 255.255.255.0 change it to 255.255.0.0. Press Apply to activate the changes. At this point you should see a light grey 'openvpn' entry show up in the search domains field. Note that the Tunnelblick icon will show its connecting status and then return to its connected state.

It took a while to get it working today, but at least I can connect my computer to the Internet via the cellular networks if I ever find myself needing to use my laptop in a spot without freely-available Internet access.

I like the idea of the shell script above since once configured it seems more convenient overall. However, since I already use Tunnelblick to connect to my work VPN, and wanted to stay away from the command line, I'm happy knowing I can get a 3G data connection by performing these extra steps.
 
Last edited:

pippocannelunghe

Senior Member
Jul 4, 2009
241
18
Roma
Hi all,
i have this error..

Code:
Mon Sep 28 12:53:04 2009 OpenVPN 2.0.9 Win32-MinGW [SSL] [LZO] built on Oct  1 2
006
Mon Sep 28 12:53:04 2009 IMPORTANT: OpenVPN's default port number is now 1194, b
ased on an official port number assignment by IANA.  OpenVPN 2.0-beta16 and earl
ier used 5000 as the default port.
Mon Sep 28 12:53:04 2009 WARNING: --ping should normally be used with --ping-res
tart or --ping-exit
Mon Sep 28 12:53:04 2009 ******* WARNING *******: all encryption and authenticat
ion features disabled -- all data will be tunnelled as cleartext
Mon Sep 28 12:53:04 2009 TAP-WIN32 device [Connessione alla rete locale (LAN) 5]
 opened: \\.\Global\{545116FE-5567-40C3-8325-D659C7E7D665}.tap
Mon Sep 28 12:53:04 2009 Notified TAP-Win32 driver to set a DHCP IP/netmask of 1
92.168.56.2/255.255.255.252 on interface {545116FE-5567-40C3-8325-D659C7E7D665}
[DHCP-serv: 192.168.56.1, lease-time: 31536000]
Mon Sep 28 12:53:04 2009 Successful ARP Flush on interface [131076] {545116FE-55
67-40C3-8325-D659C7E7D665}
Mon Sep 28 12:53:04 2009 UDPv4 link local (bound): [undef]:1194
Mon Sep 28 12:53:04 2009 UDPv4 link remote: 127.0.0.1:41927
Mon Sep 28 12:53:04 2009 read UDPv4: Connection reset by peer (WSAECONNRESET) (code=10054)
Mon Sep 28 12:53:04 2009 read UDPv4: Connection reset by peer (WSAECONNRESET) (code=10054)
Mon Sep 28 12:53:04 2009 read UDPv4: Connection reset by peer (WSAECONNRESET) (code=10054)
Mon Sep 28 12:53:04 2009 read UDPv4: Connection reset by peer (WSAECONNRESET) (code=10054)

any suggestion?

thanks in advance
 

kornys

New member
Sep 30, 2009
3
0
So, you could modify Tunnelblick's client.up script to do something a little different, but I actually just decided to whip up a custom script that uses the openvpn2 from MacPorts so I could just run one command on a terminal to set the whole thing up for me (including adb port forwarding), and tear it down when I ctrl+c it.

Have a looksie if interested:
http://pastie.org/405289

Thank you! This was exactly what I needed. I had gotten all the way through installing tunnelblick, with it all working, except for DNS - and there I got stuck.
Your script however worked perfectly, first time. I might try back-porting it to tunnelblick though - my experience with MacPorts has been mixed, and I'd hate to depend on this and then find that a port upgrade screwed it up totally... :-}