-->

How to create IPSec/L2TP psk vpn for android

2020-08-08 11:32发布

问题:

I need to connect a Vpn programmatically in my app, but can't seem to find a way. I see VpnService, StrongSwan, OpenVpn but this seems not IPSec. How do I go about connecting to my already build IPSec and L2TP servers that have a username, password and pre shared key.

回答1:

You can not do it in the latest versions of Android. It could be done via SystemProperties.java class which has API available for these connections, but these API are now hidden in the latest Android versions due to Security risks.

However if the phone is rooted then you can use it via hacks like reflection etc to access those System properties and get everything going.