PPTP VPN Installation

Automatic: 

  1. Copy script using wget https://raw.githubusercontent.com/saaiful/PPTP-VPN/master/install.sh
  2. Run using sudo bash install.sh
  3. Script will ask for username and password for VPN, set them correctly
  4. Connect the VPN and Enjoy 🙂

https://github.com/saaiful/PPTP-VPN

Manual:

Install PPTP using the following command:

sudo apt-get install pptpd

Edit PPTP Configuration Using the following command:

sudo nano /etc/pptpd.conf

add the following lines

localip 10.0.0.1
remoteip 10.0.0.100-200

Edit PPTP Option to add DNS Server using the following command:

sudo nano /etc/ppp/pptpd-options

Add the following lines to add google public DNS

ms-dns 8.8.8.8
ms-dns 8.8.4.4

Add VPN User by Editing ‘chap-secrets’ using the following command:

sudo nano/etc/ppp/chap-secrets

Formate: username * password *

[username] [service] [password] [ip]

Example:

saiful * 12345678 *

Restart PPTP Service using the following command:

service pptpd restart

You need to enable IP forwarding on your PPTP server in order to make you VPN work (This will allow you to forward packets between public IP and private IPs that you setup with PPTP).Enable IP forwarding by using the following command

sudo nano /etc/sysctl.conf

Set`net.ipv4.ip_forward = 1` in the config file. Run the following command to make changes active

sudo sysctl -p

Apply NAT rule for “iptables” using the following commands:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && iptables-save
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

Now all you need is testing your VPN using any PPTP VPN Client.