2

I am working on an Android app using Android Studio v 1.4 and the minimum sdk version is 14 and what I am trying to do is building a simple VPN client that implements PPTP and L2TP protocols.

I have googled and searched here in Stack Overflow and I have looked at the Android sdk VPN sample called toyvpn and also looked at the official documentation for the VPN Service class.

How to implement PPTP or L2TP with VpnService on Android Platform? Is there any code samples,libraries or even a starting point to such an implementation.

Waxren
  • 2,002
  • 4
  • 30
  • 43
  • 2
    I don't have a degree in cryptography and I am not aware of the implementation level of complexity.This why I am searching for source code or libraries. – Waxren Nov 26 '15 at 11:13
  • 1
    According to a quick [`cloc`](https://github.com/AlDanial/cloc) over the latest version of http://www.openl2tp.org/downloads there are 27798 lines of C code in that implementation. I'd look for a library like that to integrate because actually implementing such a protocol is quite complex :) – zapl Nov 26 '15 at 11:52
  • 1
    Thanks for the reply. Of course that is over complex.Does this library require root access? And is there any others for the PPTP protocol? – Waxren Nov 26 '15 at 12:10
  • I don't know. This just came up via google when searching for "l2tp library" or so – zapl Nov 26 '15 at 13:44
  • Beyond library: Think to establish a PPP connection a public network server is required https://www.cisco.com/c/en/us/td/docs/wireless/asr_5000/21-12_6-6/PDSN-Admin/21-12-PDSN-Admin/21-12-PDSN-Admin_appendix_010101.html – Sam Ginrich Feb 15 '22 at 09:08

1 Answers1

1

The question is an interesting one. There is a fundamental flaw though in how it is phrased. I think the question is too general. However, I still think it is useful for direction.

First as others are saying VPN's are very complicated and I am sure many others would recommend not taking that on. However, there are many solutions for your needs. You mention PPTP.

"Don’t use PPTP. Point-to-point tunneling protocol is a common protocol because it’s been implemented in Windows in various forms since Windows 95. PPTP has many known security issues..." taken from this article.

The going recomendation is to use OpenVPN. Now if you go to their site they ofter already built software at a price. I assume this is not what you are looking for in the end.

What you can do is leverage the OpenVPN libraries and build it out yourself. Since it is opensource you can use the libraries for your benefit but you have to do the implementation work. What I have found for you is the GitHub repository where OpenVPN is leveraged in Android.

Source

I would certainly take a look here. It is probably a useful example that you can build from. This way you can come back and ask code specific questions if you are hitting a wall.

Lastly, VPN's are a two way street. Having it on the Android( client ) side still requires a server side implementation. So I would also think this article would be a beneficial part of the learning process.

I hope this helps.

Mark
  • 911
  • 13
  • 30