[Update]: If you are looking for automated script for CentOS 6, please visit “One Click Installation of pptpd VPN on CentOS 6” .
What is VPN?
A virtual private network (VPN) is a computer network that uses a public telecommunication infrastructure such as the Internet to provide remote offices or individual users with secure access to their organization’s network. It aims to avoid an expensive system of owned or leased lines that can be used by only one organization.
It encapsulates data transfers between two or more networked devices which are not on the same private network so as to keep the transferred data private from other devices on one or more intervening local or wide area networks. There are many different classifications, implementations, and uses for VPNs.
What can we do with VPN?
- To hide the users’ true IP address
When using VPN connections, your client machine’s IP address will be hidden and your remote server (VPN server)’s IP address will be shown.
- Secure data transferred over the internet
Most of the VPN will have the option to encrypt the data and thus they are safer to be transferred over the internet. This is especially good for company use.
- Access sites that are blocked in certain regions
China is a very good example. Facebook, YouTube, Flickr and so many more websites are blocked in the country and people have to use different methods to bypass the restriction and VPN is one of the common way to achieve what they want.
How to set up PPTP VPN server on CentOS VPS?
Just in case some of the readers don’t know, I have moved my sites from shared hosting to Linode VPS a couple months ago. I was just thinking that my WordPress blogs don’t really need that much of resource anyways, why don’t I just set up a VPN server for my in-need use?
So for today, I will be introducing the easy installation of PPTP (Point-to-Point Tunneling Protocol) VPN on CentOS 5.5, if you want to know the server setup, you should probably ready my LNMP server setup guide first. Technically, you don’t even need a domain or a website, you can use your VPS purely for a VPN server.
Special Note: PPTPD can only be installed on XEN servers, for the difference of OpenVZ and XEN, you can visit http://www.rockia.com/2010/06/go-openvz-or-go-xen-for-vps
To get started, you need to use your root account to access your VPS server via SSH. Then type in the following command lines (pptpd.sh is not created by Rockia, I just host the file here for convenience, credits are back to Diahosting.com )
Then hit “Enter”, the shell files should be downloaded on your server and now you can run it:
The installation will be run and completed automatically, and when it’s done, the VPN username and password will be displayed on your console screen.
Can I change the user name and password? Of course you can.
Change PPTP VPN account setting
The PPTP VPN server’s account information is stored in the file located at “etc/ppp/chap-secrets”, you can use the command line to edit this file directly:
Or you can download the file, edit it and upload it back again, but anyways, you have to follow a simple syntax of the account setting:
Here is the screen-shot of my “chap-secrets” file. All you need to do is to type in the username you want to use (as vpn-user in the picture), then space and type in “pptpd”, and then space and the password (as vpn-password) in the picture and then “*” for the last one if you allow all IP address access your VPN server.
You will need restart PPTPD server when changes are made with the following command line:
This is it. It’s extremely easy to install a PPTP VPN server on your VPS. However, if you are not comfortable with the “easy installation” package written by someone else, there are tons of tutorial online that you can read and try.
Filed Under: Servers