yashsingh1/xdaforums huggingface dataset:
[Android Software Development] D!T:
Ah, I forgot to mention that I did push tun.ko to /system/lib/modules as lamaz says in post #59, even though I'm using tap. But I will try adding a path to the config before searching for a different tun.ko
[Android Software Development] jwickers_1234:
Then does the module loads ?

Try in a console:

su

insmod /system/lib/modules/tun.ko

If it loads it then appears in:

lsmod
[Android Software Development] D!T:
You rock.

Issuing the commands worked (sort of, more later) and it's only after doing so that I realized that OpenVPN Settings has an "advanced" settings area that allows loading the tun kernel, loading it using insmod, and selecting the path as /system/lib/modules/tun.ko

Though I get an internal address and OpenVPN Settings allows me to set DNS, nothing is getting routed and there is no address resolution. Not even direct ping to 8.8.8.8 works. My config file worked before under Eclair, so where should I look for the problem?
[Android Software Development] jwickers_1234:
Depends, what ROM/device are you using ?

Check the routes are ok in the console (as root), what's the output of:

route

ip ro

ip ru
[Android Software Development] D!T:
Nexus One

2.6.32.9-27227-g3c98b0d

android-build@apa26 #1

Without OpenVPN, route gives me "Invalid Argument". I have busybox and it is in /system/bin as well as /system/xbin, both places as 777, so I don't know why it doesn't run.

ip rule comes up empty

ip route
192.168.0.0/24 dev eth0 src 192.168.0.44
default via 192.168.0.1 dev eth0

And there's a difference in OpenVPN binaries between what is posted in lamaz's post.

***********

With Install OpenVPN's binary, I get a connection to the VPN, don't get internal address message (Just like GldRush98, apparently).

ip route
xxx.78.98.149 via 192.168.0.1 dev eth0
67.207.131.118 via 192.168.0.1 dev eth0
192.168.0.0/24 dev eth0 src 192.168.0.44
default via 192.168.0.1 dev eth0

There is address resolution, and ping works, but apparently I'm not really connected or something, because facebook.com still gives me round-robin bogus IPs (yes, I am in China, too).

***********

With Lamaz's link, I do get an internal address, ip rule is empty, and

ip route
xxx.78.98.149 via 192.168.0.1 dev eth0
192.168.0.0/24 dev eth0 src 192.168.0.44
10.0.0.0/8 dev tap0 src 10.19.99.255
0.0.0.0/1 via 10.19.96.1 dev tap0
128.0.0.0/1 via 10.19.96.1 dev tap0
default via 192.168.0.1 dev eth0

There's no address resolution and pinging 8.8.8.8 returns a message from the 10-net that the destination host is unreachable.

************

I assume "default via" should have that 10-net address after it, but don't understand why it's not happening.
[Android Software Development] jwickers_1234:
Well the last ip route results looks good. Do not worry about the default route, i have the same (set to my wifi router), instead the 0.0.0.0 via your vpn gateway will take precedence as it is before it on the list.

So i guess your end of the vpn works, since your phone tries to route your 8.8.8.8 ping to the 10-net as it should. But your VPN gateway is not set to route your traffic to external networks.

You may want to recheck your VPN server configuration to allow that.
[Android Software Development] D!T:
Ok, so if I understand this correctly, then really everything is fine on my, the client, -side. It is the server config that needs checking. But the problem is that this is the same config file I've been using since Eclair and is essentially the same config I am using (sans a passfile.txt call) on a Windows machine (and on the same network, no less). Worse, the server side is a pay-for outfit in the US, so their servers are not likely wrong.

Could there be some other service or something that is somehow blocking my routing? Does the fact that i can't even call "route" as a command make any difference?
[Android Software Development] jwickers_1234:
So the same config works on other machine of yours if i understand properly...

Ok then can you compare the routing table on those machine that works ?

Can you try a traceroute to some ip addresses from the phone ? and same from the working machine ?
[Android Software Development] D!T:
Yeah, that's right. From a windows machine with the same config file, I get

Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 128.0.0.0 10.19.96.1 10.19.96.131 1
0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.45 25
10.19.96.0 255.255.252.0 10.19.96.131 10.19.96.131 30
10.19.96.131 255.255.255.255 127.0.0.1 127.0.0.1 30
10.255.255.255 255.255.255.255 10.19.96.131 10.19.96.131 30
XXX.207.131.118 255.255.255.255 192.168.0.1 192.168.0.45 1
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
128.0.0.0 128.0.0.0 10.19.96.1 10.19.96.131 1
192.168.0.0 255.255.255.0 192.168.0.45 192.168.0.45 25
192.168.0.45 255.255.255.255 127.0.0.1 127.0.0.1 25
192.168.0.255 255.255.255.255 192.168.0.45 192.168.0.45 25
224.0.0.0 240.0.0.0 10.19.96.131 10.19.96.131 30
224.0.0.0 240.0.0.0 192.168.0.45 192.168.0.45 25
255.255.255.255 255.255.255.255 10.19.96.131 10006 1
255.255.255.255 255.255.255.255 10.19.96.131 3 1
255.255.255.255 255.255.255.255 10.19.96.131 10.19.96.131 1
255.255.255.255 255.255.255.255 192.168.0.45 192.168.0.45 1
Default Gateway: 10.19.96.1
===========================================================================
Persistent Routes:
None

A tracert to 8.8.8.8 is no problem at all; the first hop goes to 10.19.96.1, and everything after that is US-based.

On the phone, the traceroute gets nothing but stars and eventually winds up at 10.19.99.255
[Android Software Development] jwickers_1234:
Well the routes are different.

In the phone you have 10.0.0.0/8 via 99.255 which I wonder where it came from...

Also I don't the equivalent to the .131 there.

I guess you can try removing that and manually add routes to be similar to the windows ones.
[Android Software Development] jwickers_1234:
But if your service is paid for, you ask there support. Then can check the logs and tell you if there is any thing wrong with your client.
[Android Software Development] D!T:
Yes, I think I see the point now. I will try their support forums, but I sort of doubt they'll be able to see any problems because it seems that they'd be sending me all necessary information, but it's getting altered on my end so that no data I send/recv ever reaches them.
[Android Software Development] D!T:
Well, my provider's troubleshooting admin wasn't able to figure out the cause of the problem. For some inexplicable reason, everything is getting routed to the broadcast address of 10.19.99.255.

At first, I thought there was a difference in openvpn binaries, so I tried Friedrich's 2.1 version and got the same result.

The symbolic links for bb to get ifconfig and route are there;

busybox says it's installed;

I re-pushed tun.ko from here apparently appropriate for my kernel (2.6.32.9-27227-g3c98b0d).

How are you guys getting this working?
[Android Software Development] jwickers_1234:
So you should be able to manually set the correct routes.

For me it works as it should, but i manually configured my vpn server :)

Perhaps you can try to use "adb logcat" while connected to your PC and check the routes that openvpn is getting. I am still thinking your server is doing strange things that confuses openvpn somehow.

Or perhaps this is because your tap, can you switch to using tun instead ?
[Android Software Development] jwickers_1234:
I don't see anything useful ... normally you should see the pushed routes, and where the 255 gateway is set.
[Android Software Development] D!T:
I'm not sure, but that seems to look consistent with the Windows routing and what one would expect, yes?
[Android Software Development] jwickers_1234:
Yes, seems alright. Maybe it is simply confused by the broadcast address ?

I dont see why you would have:

10.0.0.0/8 dev tap0 src 10.19.99.255

instead of

10.0.0.0/8 dev tap0 src 10.19.96.1

If you manually remove that route and create the correct one would the VPN routing work ?
[Android Software Development] D!T:
FIXED!

Ever since you asked for the output of "route", which never gave me anything, I'd suspected something was amiss, especially since I could now see from "logcat" that route was what was actually being called to perform the routing (duh, I know now) and suspected that there was something wrong with it (for whatever reason).

Uninstalled busybox and reinstalling it didn't do anything, so I deleted "route" and "ifconfig" and reinstalled busybox. It didn't put those binaries back in place. So, I backed up busybox, uninstalled it, then ran it again, but this time denied it "su" until the INSTALL button showed up. Ran the install, checked OpenVPN Settings' advanced bit and determined that one absolutely HAD to select /system/xbin/bb as the location for ifconfig+route. After that, it worked!

THANK YOU VERY MUCH jwickers1234 FOR YOUR HELP!!!
[Android Software Development] jwickers_1234:
Well good to hear, although i am not sure what you did to fix it, was the route binary not the good one ? i would have though openvpn would just failed miserably if those were missing.
[Android Software Development] D!T:
yeah, it doesn't make sense that the route binary would sort of work, but that seems to be what happened: the binaries were all there, but I could never call them from the command line, though there were otherwise no other errors. After I forced BusyBox to put things back, everything magically worked without any tweaks.
[Android Software Development] royal66:
installing openvpn binaries

Hello

Trying to install Openvpn on HTC Desire rootet with 20/Jul r5 - MoDaCo Custom ROM for HTC Desire with Online Kitchen - Froyo with Sense (FRF91)

I have downloaded openvpn and tun.ko to my win computer (doesnt I need some TAP driver? i use TAP config on my openvpn server)

But I Cant copy the files to system/bin(openvpn) system/lib/modules(tun.ko) because of directory rights, I use teminal emulator from marked:

su chmod 777 /system/lib/modules

"permission denied"

su cp /sdcard/tun.ko /system/lib/modules/tun.ko

"permission denied"

Openvpn support was the main reason for rooting the device but I cant work this one out.

All help are very much appreciated :)
[Android Software Development] D!T:
try doing "su" first, when you get proper superuser access, then cp and chmod the files
[Android Software Development] jwickers_1234:
No this does not work on a Desire, /system is protected. You need to put those files in recovery mode using adb push (look for how to push files from your PC to the phone if you do not know how to use adb)
[Android Software Development] royal66:
Okay, learning something new every day with this phone :)

SDK and adb installed, but somethings not working. I still do not have the premission top copy the file:

"c:\android-sdk-windows\tools>adb push y:\appz\htc\tun.ko /system/lib/modules

failed to copy 'y:\appz\htc\tun.ko' to '/system/lib/modules/tun.ko': Read-only f

ile system

"

Am I doing it wrong, any ideas guys?
[Android Software Development] royal66:
Have tryed some more..

Boot the phone on recovery mode with usb too pc.

It says transfer ok:

"c:\android-sdk-windows\tools>adb push y:\appz\htc\tun.ko /system/lib/modules/tun

.ko

1706 KB/s (202759 bytes in 0.116s)"

but when i reboot the phone I cannot find the file in system/lib/modules.

Strange?
[Android Software Development] rgawenda:
Try doing one of these before the "adb push" command:

adb remount

adb shell mount -a
adb shell mount -o remount,rw /system
[Android Software Development] royal66:
Thank you very much that did the trick :)
[Android Software Development] royal66:
Connect problems

wasnt that easy to connect to my server :(

Have put my openvpn files in /sdcard/openvpn

The program OpenVPN finds the config(tomato router.ovpn)

When i try to connect it only says:

"OpenVPN Settings has been granted Superuser permission"

And after this nothings happend, no connection fail or errors display it just wouldnt connect

config file:

dev tap

proto udp

dev-node dev/tun

remote 192.168.10.10 1194

tls-client

keepalive 15 120

verb 3

ca ca.crt

cert xxx.crt

key xxx.key

tls-auth ta.key 1

ns-cert-type server

cipher AES-128-CBC

nobind

explicit-exit-notify 3

#comp-lzo

#fragment 1500

OpenVPN settings:

Path to configurations: /sdcard/openvpn/

Path to openvpn binary: /system/xbin/openvpn

Load module using: modprooe

Path to tun module: /system/liv/modules/tun.ko

Not making any sense to me, are there any obvious mistake her?
[Android Software Development] jwickers_1234:
You have: remote 192.168.10.10, so you use your VPN on your local net only ?
[Android Software Development] royal66:
No this its just for testing I have 2 openvpn locations :)
[Android Software Development] jwickers_1234:
Normally you should see the status in Openvpn Settings (either Wait / Auth / Get Config / Connected / .. etc ...)

You may want to check if the tun modules is indeed properly loaded (in console: 'su' then 'lsmod').

Else whatever it is doing should be in your openvpn server logs.
[Android Software Development] royal66:
I certain that Openvpn doesnt connect, it doesnt says it is connected in OpenVPN setting ether, nothing happens when i push connect, no activity at all and the green V isnt showing on the config file.

lsmod:

bcm4329 211631 0 - Live 0xbf000000

I have copied tun.ko to system/lib/modules but it does not show in lsmod.

Is anything else i need to setup?
[Android Software Development] jwickers_1234:
try manually loading the module from the console, normally i use insmod instead of modprobe:

insmod /system/lib/modules/tun.ko
[Android Software Development] royal66:
Thanx for helping :)

insmod: can`t insert system/lib/modules/tun.ko: in valid module format
[Android Software Development] royal66:
IP DHCP

I reflashed with this new rom:

[ROM] Official 2.2, with: busybox, old A2SD+, OpenVPN (TUN), EXT4 support, 802.11N

And it worked instantly :)

New problem :p

My OpenVPN server pushes DHCP IP addresses, this works great on win pc.

But the android phone doesn't get IP from the server?
[Android Software Development] blackxored:
Have you tried to check remote set addresses on the openvpn app on the phone. Also setting dhcp won't enable you to get vpn ip addresses by itself.
[Android Software Development] royal66:
What do you mean? VPN DNS preferences can`t help me here?

Remote adress are set in openvpn client config file and works fine as its connect to server.

Openvpn server push dhcp but the phone does not recieve dhcp from server.

On Pc this works fine.

I do not need DNS as I only access to my home and work network. Openvpn server

dont push internet traffic just local access.

Openvpn server: 192.168.10.1

Gateway: 192.168.10.1

DHCP range: 192.168.10.100-192.168.10.200

In Win 7 Openvpn create a virtuell network adapter that get IP from Openvpn server, maybe i need to config TUN to recieve ip from server?

Admit that i am on thin ice here, but hope someone understand my problem and have a solution?
[Android Software Development] rkantos:
I also want to know how to get the traffic going trough OVPN.. :rolleyes:
[Android Software Development] Crusoe86:
Do you want to know how to route the full traffic (Internet etc. to the VPN tunnel)?

ATTENTION!!! You have to modifiy the adresses to fit in your system :)

dhcp-option DNS 192.168.1.1 (it sets the DNS to the specified address)

route-gateway 192.168.1.1 (this sets the gateway address)

redirect-gateway def1 (and this one routes the full traffic (including Internet) through the VPN tunnel)

I use this parameters in my Win7 config and it works well. These commands are available in Linux, too.

I hope this was what you searching for :)

BTW: I want to buy a Desire (with Froyo) and play with andriod on my HD2.

Is the "recovery mode" or what you all talking about also available on the "HD2 MOD". Or is this not possible? I mean these "adb" commands.

I need OpenVPN because my APN "wap.vodafone.de" is not support all needed features of the Desire (like HTC Weather for e.g.). On WM 6.5 I use "ProxyCap" but that is not available for Android. It makes the proxy available for all apps, also those who have no own proxysettings (like Live Messenger (please no alternatives to messengers with proxysupport ;))

If somebody has an alternative, then OpenVPN has a lower priority for me :p
[Android Software Development] fiftyclick:
OpenVPN connected & routed, but no browser?

Seems like i have an odd issue -- my browser seems to be the only thing that doesn't work right now. Emails, the XDA app, etc.. all work fine, just not the browser app..

traceroute is valid too, and the gateway is setup properly. On my laptop, using the same setup, it can access http just fine (and the XDA app shows that my phone is doing it fine too).

any suggestions? Could it be related to apn settings?
[Android Software Development] Crusoe86:
Hey :)

Take a look at my tutorial :)

Maybe it helps you with your configuration :)
[Android Software Development] jeroen__online:
dns problem

Hi, I'm having a rather strange problem with OpenVPN-settings on OpenDesire 4.0.x. Openvpn works fine through Wifi, but it fails when I try to connect through 2G/3G. It seems like it has something to do with DNS resolving of the Openvpn monitor interface, but I don't know how to resolve it. Here's the relevant logcat part:

D/OpenVPN-DaemonMonitor[/sdcard/openvpn/myserver.ovpn]-mgmt( 833): attach():using management port at 53105
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/myserver.ovpn]-mgmt( 833): attaching to OpenVPN daemon
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/myserver.ovpn]-mgmt( 833): java.net.UnknownHostException: localhost
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/myserver.ovpn]-mgmt( 833): at java.net.InetAddress.lookupHostByName(InetAddress.java:504)
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/myserver.ovpn]-mgmt( 833): at java.net.InetAddress.getLocalHost(InetAddress.java:459)
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/myserver.ovpn]-mgmt( 833): at de.schaeuffelhut.android.openvpn.service.ManagementThread.attach(DaemonMonitor.java:4
05)
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/myserver.ovpn]-mgmt( 833): at de.schaeuffelhut.android.openvpn.service.ManagementThread.run(DaemonMonitor.java:351)

V/OpenVPN-DaemonMonitor[/sdcard/openvpn/myserver.ovpn]-mgmt( 833): Could not attach to OpenVPN monitor port
D/OpenVPNDaemonEnabler( 833): Received OpenVPN daemon state changed from Unknown to Disabled
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/myserver.ovpn]-mgmt( 833): terminated

It fails on a "java.net.UnknownHostException: localhost", so it looks like disabling Wifi is breaking DNS (even for localhost) resolving? It works fine when I start OpenVPN-settings when Wifi is connected, then disable wifi and enable 'myserver.ovpn' in the app, but fails when wifi hasn't been connected. There is an entry linking 127.0.0.1 to 'localhost' in /etc/hosts.

Any help is very much appreciated!

EDIT: this was solved by removing the line "::1 localhost" from both /etc/hosts and /system/etc/hosts, I'm not sure why it's there but it solves my issue.
[Android Software Development] buckminst:
FYI, ::1 is the IPv6 version of the local loopback address.

If the ::1 localhost definition was the only one and your kernel doesn't have IPv6 support, name resolution will fail.
[Android Software Development] laozilaile:
Get OpenVPN work on Moto ME501(Cliq XT or Quench)

After several hours work, I get OpenVPN work on my ME501. lamaz 's post help me lot when I working on it. Thanks! lamaz.

Following are operations I've done excepted those mentioned by lamaz.

1. create the link to "busybox cp" in bin folder. ME501 doesn't have the cp command there. It is needed by the OpenVPN installer.

2. change the link destination of "ifconfig" and "route". On ME501, they are linked to "toolbox" instead of "busybox". The ifconfig came with phone is can't assign IP to tun0 interface properly.
[Android Software Development] emil73:
Hi,

New to android and would like to know if you can get a VPN client solution for android? Tried to search the forum and this thread is the closest I get.

What I want is to use a HTC Desire Z and get access to a server through a VPNtunnel.
[Android Software Development] bahman2000:
cyanogenmod has built-in support for openvpn.
[Android Software Development] art_sn00p:
It seems that it could be a MTU problem with UDP configuration. Try to make --udp-mtu larger or smaller than the default, and test again.
[Android Software Development] deathero:
hi guys, i need to retrieve the dns settings pushed by the server into my android phone. Anyone has managed to do so?
[Android Software Development] programatix:
Hi,

I successfully connected to the VPN server. However the tap doesn't seems to retrieve the IP address from the DHCP at the server. So, every time I connect to the VPN, I'll need to manually refresh the tap device ip manually by running "netcfg tap0 dhcp" using Terminal.

I tried putting in this line in the conf file,

up "netcfg tap0 dhcp"

but it doesn't run.

Any help would be greatly appreciated.
[Android Software Development] ddarvish:
so i had another random question. i am using my htc thunderbolt in a 4G area and when connected to my vpn using vpn settings the data is a lot slower than usual. I also then tested it by wifi tethering to the computer and using my computer to connect to the same vpn server and saw much higher speed results. BTW the server is on a 1Gbps up/down line. any ideas why the openvpn software on the phone is limiting the speeds. with it on i get 4-5mbps without it close to 15
[Android Software Development] bombadier:
Hope this is the right thread,dont shoot :p

Have a open vpn account and have the client.ovpn file on my phone (desire Z running ILWT CM 7) and the openvpn installer app,it says no tap/tun module installed,how to install this as I thought CM 7 had support built in,and what are the settings if I wanted to enter them manually,already searched,albeit not thorough ly,Thanks for any help with this matter
[Android Software Development] bombadier:
Any help chaps?
[Android Software Development] plarser48:
AT&T

Just curious. Has anyone been able to consistently use an openvpn connection over AT&T 3G networks?

I ask because I've been experimenting a lot lately and discovered that some networks work well for VPN (wap.cingular) while others do not allow DNS resolving (pta APN).

How have you experiences been?
[Android Software Development] harisit2005:
does any one know...how to save the Username and password in OpenVPN ?..

Am using OpenVPN in CM7 nightly
[Android Software Development] randrew2:
just create a file named 'pass.txt' then enter your username and password like this:

place the file inside the same folder with config

then on your config, add this line:

I hope that might help :)
[Android Software Development] Guanfy:
I'm trying to connect to an openvpn connection via the openvpn app available on the market. I'm running an Archos 70IT rooted with churli's root. When I try using a tcp connection, the status in the app switches to unknown and stays that way until timeout. If I try using a udp connection, I get "error: Cannot allocate TUN/TAP dynamically".

According to the installer app I have tun.ko installed, and I know that I have busy box installed. I've looked all over the place trying to find an answer to this and i'm stumped. Can anyone help me out?
[Android Software Development] randrew2:
have you tried to check "load the tunko modules" and choose "load tun.ko modules" -> insmod

and set the tun.ko location to "tun" (default)

if you have tried that but this's still not working, I guess the problem's because ifconfig and route didn't symlinked with busybox

try this:

- mount your /system/xbin (using root explorer)

- then, try to execute this command on terminal emulator:

- then unmount your /system/xbin

hope this helps :)