Step 1 – PPTP Installation
Update the APT repository and install the PPTP daemon
[[email protected] #] apt update
[[email protected] #] apt install pptpd
Step 2 – Configuration & Authentication
Edit the config file
[[email protected] #] nano /etc/pptpd.conf
Add the following lines to this file:
remoteip: Will be used as VPN gateway/server IP address.
localip: These IPs will be assigned to VPN clients.
Now we need to setup authentication (usernames/passwords) for VPN clients.
[[email protected] #] nano /etc/ppp/chap-secrets
Modify this file according to your needs.
# Secret for authentication using CHAP
# client server secret IP addresses
username1 pptpd zxD2z8uc *
username2 pptpd P3zCuP1s *
username3 pptpd 9wStTqU7 *
You can also replace * (asterisk) with specific IP address that will be assigned to particular username.
Save the file & exit the editor.
Step 3 – DNS
Now we need to specify the DNS servers that will be used by the VPN clients.
[[email protected] #] nano /etc/ppp/pptpd-options
Add the following lines to the end of this file.
Save it, and exit the editor.
Now you can start the PPTP service.
[[email protected] #] service pptpd start
Step 4 – Enable IP Forwarding
We need to enable IP forwarding to allow packets transfer between public & private IP addresses.
[[email protected] #] nano /etc/sysctl.conf
Add the following line to the end of this file.
net.ipv4.ip_forward = 1
Save & exit the text editor.
Run the following command to activate IP packets forwarding without rebooting the machine.
[[email protected] #] sysctl -p
Final Step – Firewall Rules
Now you should be able to connect to VPN but won’t be able to access the internet.
We need to create some firewall rules to allow internet access for VPN clients.
[[email protected] #] iptables -t nat -A POSTROUTING --out-interface ppp0 -j MASQUERADE
[[email protected] #] iptables -I INPUT -s 192.168.25.0/24 -i ppp0 -j ACCEPT
[[email protected] #] iptables -A FORWARD --in-interface eth0 -j ACCEPT
You’re all set! Let me know in the comments below if you run into any issues during this process.