How to Set Up a PPTP Service on an Ubuntu Cloud Server?

20-02-2024 03:06:10

PPTP services are commonly utilized for establishing Virtual Private Networks (VPNs), catering to both individual and corporate office scenarios. This guide introduces the method for installing PPTP services on Ubuntu cloud servers, applicable to various versions of the Ubuntu or Debian operating systems. It's important to note that PPTP is just one of the VPN solutions available and comes with certain limitations. Please evaluate other options and choose wisely based on a comprehensive assessment.

Installing PPTP can be accomplished with a single command.

apt-get install pptpd

Subsequent steps involve configuring the PPTP. Initially, we prefer the service not to be public, accessible to everyone; thus, access is restricted via a password to only specific users. Edit the /etc/ppp/chap-secrets configuration file, formatted as: [username] [service] [password] [ip], where "service" refers to "pptp," and "ip" indicates that only specific IP addresses are allowed. If there's no need to restrict by IP address, an asterisk (*) can be used. Fill in "username" and "password" as required. An example is as follows:

wang pptp Password#123 58.215.65.1
zhang pptp ChangePassword *

Additional settings require modifications. Edit the /etc/pptpd.conf configuration file, locate the lines for localip and remoteip, remove the comment symbols (#), and change localip to the cloud server's IP address. Remoteip pertains to the client, i.e., the computer connecting to the VPN. For instance, setting remoteip to 192.168.120.232-235 means only IP addresses 192.168.120.232, 192.168.120.233, 192.168.120.234, and 192.168.120.235 can connect.

Furthermore, edit the /etc/sysctl.conf file, uncomment the line for net.ipv4.ip_forward, and ensure net.ipv4.ip_forward=1 is set.

Once the above settings are completed, restart PPTP to apply the changes.

service pptpd restart

This concludes the installation and configuration process for PPTP services.