VPNs (Virtual Private Networks) have become an essential tool for securing internet connections and protecting privacy. One of the older VPN protocols is PPTP (Point-to-Point Tunneling Protocol), which, despite its age and some known security weaknesses, remains popular due to its ease of setup and speed. This guide will walk you through installing and configuring a PPTP VPN server on CentOS 8.
Prerequisites
Before you begin, ensure you have the following:
- A CentOS 8 server with root or sudo access.
- Basic knowledge of the Linux command line.
- An active internet connection.
Step 1: Update Your System
First, it’s a good practice to update your system packages to the latest versions. Run the following commands:
sudo dnf install epel-release -y
The epel-release
package is needed to enable the Extra Packages for Enterprise Linux repository, which contains additional software for CentOS.
Step 2: Install PPTP
Next, install the PPTP server package using the dnf
package manager:
sudo dnf install pptpd -y
Step 3: Configure PPTP
3.1 Edit the PPTP Configuration File
Open the main PPTP configuration file in a text editor:
sudo nano /etc/pptpd.conf
Uncomment and set the local and remote IP addresses for the VPN. Add the following lines to the end of the file:
remoteip 192.168.0.100-200
localip
is the IP address of the PPTP server.remoteip
is the range of IP addresses that will be assigned to VPN clients.
3.2 Configure DNS Servers
Edit the pptpd-options
file to configure the DNS servers for the VPN clients:
sudo nano /etc/ppp/options.pptpd
Add the following lines:
ms-dns 8.8.8.8
ms-dns 8.8.4.4
These are Google’s public DNS servers. You can replace them with your preferred DNS servers.
3.3 Set Up User Authentication
Create a user for the VPN by editing the chap-secrets
file:
sudo nano /etc/ppp/chap-secrets
Add a line in the following format:
username pptpd password *
Replace username
and password
with your desired credentials.
Step 4: Enable and Start the PPTP Service
Enable and start the PPTP service to make it start on boot and run immediately:
sudo systemctl enable pptpd
sudo systemctl start pptpd
Check the status of the service to ensure it’s running:
sudo systemctl status pptpd
Step 5: Configure Firewall
To allow PPTP traffic through the firewall, run the following commands:
sudo firewall-cmd --permanent --add-service=pptp
sudo firewall-cmd --permanent --add-masquerade
sudo firewall-cmd --reload
Step 6: Enable IP Forwarding
Enable IP forwarding to allow the server to route packets between the VPN clients and the internet. Edit the sysctl
configuration file:
sudo nano /etc/sysctl.conf
Add or uncomment the following line:
net.ipv4.ip_forward = 1
Apply the changes:
sudo sysctl -p
Step 7: Test the VPN Connection
Your PPTP VPN server should now be up and running. To test the connection, configure a PPTP VPN client on your operating system of choice (Windows, macOS, Linux) using the server’s IP address and the credentials you set up in the chap-secrets
file.
Conclusion
Setting up a PPTP VPN server on CentOS 8 is straightforward with the right steps. Although PPTP is not the most secure VPN protocol available, it can be suitable for applications where speed and ease of setup are more critical than security. Always consider your security requirements and the potential risks when choosing a VPN protocol.