Tuesday, May 28, 2013

Setup your own PPTP VPN server for Android


A. PPTP VPN server setup


1. Install the VPN server

#> apt-get install pptpd


2. Assign IP address for VPN client
#> vi /etc/pptpd.conf

localip 10.0.0.1
remoteip 10.0.0.100-200


3. Create VPN User &Password
#> vi /etc/ppp/chap-secrets

# client        server  secret                  IP addresses
user1 pptpd password1 *
user2 pptpd password2 *


4. Define DNS for VPN client
#> vi /etc/ppp/pptpd-options

ms-dns 8.8.8.8
ms-dns 8.8.4.4


5. PPTP setup completed, Restart the service.
#> service pptpd restart


6. Enable IP Forwarding, and apply changes.
#> vi /etc/sysctl.conf

net.ipv4.ip_forward = 1

#> sysctl -p


7. Create NAT for iptables (most important!!!)
#> iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && iptables-save


8. Optional, enable communication between VPN clients
#> iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
#> iptables -I INPUT -s 10.0.0.0/8 -i ppp0 -j ACCEPT
#> iptables --append FORWARD --in-interface eth0 -j ACCEPT



  • Steps above assume you have basic Linux Knowledge
  • Steps are based on Ubuntu 11.04
  • PPTP log was in "/var/log/syslog".
  • use "last |grep ppp" to show users logged in

B. Android VPN setup


1. In Android, go to "Setting" > "More" > "VPN", and type in Info as below.


2. Click on the connection your just created and type in username & password as defined in A.3.


3. After successful login, you will see a Key icon in Notification bar, plus a "VPN Activiated" message.




Ref : https://www.digitalocean.com/community/articles/how-to-setup-your-own-vpn-with-pptp


No comments:

Post a Comment