VPN Server on Android

If you’re not using a VPN, you should consider using one. A Virtual Private Network (VPN) extends a private network across a public network. This gives you an added layer of security and privacy. Imagine if you are sitting at a Starbucks on their free public WiFi. Well, someone could have a program such as Wireshark or any other application open and sniff traffic across the network. Potentially, information such as usernames, passwords and other sensitive data could be exposed. Now let’s say you are using a VPN to connect to your home network while you are at Starbucks. Now, anyone who might be sniffing traffic will only see you connect to the IP address of your home network and not any other sites that you connect to. For more information about VPNs, check out this useful lifehacker article.

Now that you understand what a VPN is, let’s talk about running one on Android. Most tutorials will tell you how to connect to a VPN server from your Android, but not actually how to run one on your Android device. To do this, we will be using the power of Linux along with a automatic OpenVPN installer script. So before we get starting running a VPN Server on Android, make sure that you have Linux installed on your Android device.

What You Will Need:

Step 1: Making Directories

Let’s jump right into this. Launch the Linux chroot on your Android device. I am using Linux Deploy in combination with terminal emulator. The first thing that we need to do is create a new directory in the /dev folder. This is because we need a file called tun. However, tun is located underneath /dev/net. So rather than cariously moving it, we will simply be symlinking it. Type in the following:

cd .../

mkdir /dev/net

ln -s dev/tun /dev/net/tun

The last line symlinks the tun file. So now the OpenVPN program will think the tun file is in the dev directory when it is really in the net directory.

Step 2: Install

To take all the hassle out of setting up OpenVPN, we will be using an automated installer script. Type in the follow:

wget http://git.io/vpn --no-check-certificate -O openvpn-install.sh; chmod +x openvpn-install.sh;

This will begin the installer. From this point everything is self-explanatory. Input your IP address and generate keys for the clients that you want connecting to your VPN server. It will also output a corresponding .ovpn file that we will need to use if we want to connect using OpenVPN from another android device. It will also start the OpenVPN service.

OpenVPN Automated Installer

Step 3: Transferring Keys

Finally, you need to move the generated keys to somewhere that you can access from within Android. Remember, the Linux environment and Android environment don’t share the same folders in your Chroot. One simple way around this is to copy the generated .ovpn file to the /dev folder (that is shared between the Linux environment and Android). Then, from within Android, use root explorer to grab that .ovpn file and move it to somewhere save, like your downloads folder. In any case, make sure you are able to get that .ovpn file so that you can send it to the client that you need.

Step 4: Connecting

OpenVPN Connect Android App

If you want to connect to your OpenVPN server from another Android device, download the OpenVPN connect app. From within the app, import the file that you transferred from the previous step. When you hit connect, it should connect you to the OpenVPN server running on your (other) Android device.

7 thoughts on “VPN Server on Android

  1. Connecting to a VPN server running on the same device does not hide your traffic. IF you use OpenVPN connect with a service like proxy.sh it does. You obviously don’t know how VPN works.

    1. Im quite confused by your comment here…

      OP clearly reiterated several times (yes, that’s a grammatical double positive, because apparently more repitition is needed for clarity.) about connecting to vpn with “OTHER” android (ie… Connecting to the vpn SERVER android via a SEPERATE android as vpn CLIENT.)

      So idk why you’ve even commented about such, as such was never mentioned.

      Furthermore, you state that this will work “IF you use OpenVPN connect with a service like proxy.sh”

      …Proxy.sh is literally a vpn server that then runs through tor proxies. Why on earth would you vpn a vpn? Trying to set World’s Record for slowest internet?

      And as far as the tor proxy routing, that can easily be done on linux in combination with OpenVPN WITHOUT paying for a 2nd vpn.

      Also, the whole beauty of OpenVPN, is that you have full control of logs, not needing to worry whether or not your vpn provider will give you up in case of a warrant.

      If I’m missing something here, please, do inform me. I obvioulsy have no idea how vpn works.

      1. He is talking about anonymizing yourself using a VPN server on one android phone. If you own that phone you are NOT anonymous in anyway because VPN traffic would go out the phones, say 4G connection, which you own.

        Further more – proxy.sh is NOT a “tor vpn”, tor is a proxy, VPN and proxies are completely different.
        proxy.sh does include tor bridges as part of the service, but they also include OpenVPN servers for using VPN instead of tor.

        To anonymize your traffic online using OpenVPN you need to use a server that has no connection to you. So using a device you own, on a phone service that is tied to your name will simply not work as implied in the video. Now, if you wanted to just use that Android VPN server as a way to circumvent content filters at say your local library, school, work, etc, and having the phone bridge its wifi and 4G connections and then use a VPN that way, sure it would work for that purpose. But using a VPN server you own on an IP address you own, or is tied through your name to try and be anonymous online is NOT going to work.

        As a Linux server administrator who sells anonymous VPN and tor proxy bridges for a living, the best way to do this is via a 3rd party, or setting up your own tor bridge at home. Just make sure your DNS and ipv6 does not leak and you are good to go.

Leave a Reply

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

Name *