With a PPTP server, you can setup a VPN server easily. Having a virtual private network is beneficial to both individual users and businesses alike.
This tutorial explains how you can install a PPTP server on Ubuntu. The steps are generic, they should apply to almost all versions of Ubuntu.
Step 1: Installing pptpd
The first thing that we need to do is, naturally, install pptpd.
apt-get install pptpd
Installing PPTPD is that easy! Now we need to actually setup the PPTP server.
Step 2: Adding users
We don’t want everyone to be able to access our VPN of course; because of this, you can create users so that only the users with the correct password will be able to access your VPN. To add users, edit the file:
The format is:
[username] [service] [password] [ip]
Username and password are pretty straightforward, service and IP are not though. Service is usually pptpd. If you just want to setup a VPN, use pptpd for the service – it will work. If you want to restrict the IP that a user can login from, you can use his/her IP. If you want connections from that account to be made from all IPs, you can use *.
# Secrets for authentication using CHAP # client server secret IP addresses user001 * password001 * user002 pptp password002 * user003 * password001 22.214.171.124 # The first * means you can use both pptpd and l2tpd
Step 3: Edit the pptpd settings
There are a few things that we need to edit. Start by editing the following file:
Look for the localip and remoteip settings. Remove the # (comment character) for both so that these settings will actually be recognized. Change localip to your server IP. If you don’t know your server IP, use ifconfig command
The remoteip is basically the IP range that clients (computers that are connected to your VPN) will be assigned. For example, if you want the following IP range: 192.168.120.231-235, your VPN server will be able to assign 192.168.120.232, 192.168.120.233, 192.168.120.234, and 192.168.120.235 to clients. It’s up to you what you want to use for this field.
Step 4: Update sysctl.conf
Find the line net.ipv4.ip_forward in the sysctl.conf file. We need to uncomment this line, so open the following file:
Make sure that it says net.ipv4.ip_forward=1, and not net.ipv4.ip_forward=0.
Then make changes active:
Step 5: Restarting pptpd
At this point, everything will work. Restart pptpd.
service pptpd restart
Congratulations, you now have a PPTP server!