Install PPTP VPN on CentOS 5 in 1 Minute

[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?

  1. 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.
  2. 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.
  3. 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

To get started, you need to use your root account to access your VPS server via SSH. Then type in the following command lines ( is not created by Rockia, I just host the file here for convenience, credits are back to )


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:

nano /etc/ppp/chap-secrets

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:

/etc/init.d/pptpd restart

Post Note:

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.

Happy VPNing.

Filed Under: Servers


RSSComments (94)

Leave a Reply | Trackback URL

  1. Hadi says:

    It was great script.

    Thank you.

  2. Jon Davis says:

    Thank you *very* much for making this script available.

    I’ve been trying to set up a PPTP VPN server for weeks and this worked on the first try.

  3. Philip says:

    Excellent, makes setting up a VPN server a no brainer.

  4. GaMePro127 says:

    I’m getting an error while installing on my XEN VPS. Its something to do with iptables. Do you think you can help? It would be great if you could. Thanks so much!

    • Rockia says:

      What kind of errors are you getting? The script should set up the iptables automatically. If you can print your error here, maybe I can take a look of it.

  5. Mo ravan says:

    its amazing

    thanks for your great work.

    please let me know ,how can we change the encryption type 128bit to 40bit

    i really appreciate your help

    King Regards.
    Mo Ravan

  6. Mark says:

    hey, thanks for the guide… but the problem im having… not all sites are opening… i tried opening some sites but its just stock there.

    • Rockia says:

      Hi Mark,I am not sure what OS you are using exactly, but if you are using Mac, you should check “Send all data via VPN” in “advanced” options. I believe there will be similar settings on other OS as well. Give it a try, otherwise, let me know the detail so I can try to narrow down the problem.

  7. Mark says:

    after installing vpn on my centos server at, i tried surfing the web some where working and some weren’t. so i am connect vpn from windows 7 pc to server centos… i checked to solved problem online but what i see is that i need to add this /sbin/ifconfig $1 mtu 1400 to /etc/ppp/ip-up. i cant even find /etc/ppp/ip-up its not showing up on my ssh. help


    • Rockia says:

      Hi Mark, if this is the case, it’s easy, just create a file under /etc/ppp and copy the code to it. Then of course, you need to restart your PPTPd server.

  8. Robert says:


    First of all, let me thank you for making the script available.

    I could install everything on the xen vps successfully however when trying to connect from a windows machine, it goes through till verifying username and passwords and it gives error that connection cannot be established.

    Any ideas about that?

    Thanks in advance.

  9. Michael says:

    Great script… Thanks
    Worked well on my VPS with basic CentOS 5.5 install

  10. Mo ravan says:


    can you please guide me ,how can I limit bandwidth for an account from my CentOs VPN?

    or if there is any software to managed the VPN accounts


  11. Meshal says:

    thanks for this script.

    However, after installation i didn’t find any ‘ppp’ folder under ‘etc’. I created it and created the chap-secrets file.

    when i tried to restart it says :

    /etc/init.d/pptpd restart No such file or directory

    what’s wrong ?

  12. AFDownload says:

    dear Rockia

    i have installed it on my openvz vps and not working!
    but i have another dedicated server runnign centos 5.5.
    before try to install it there i want to know will it work there just fine?

  13. yogat says:

    how to add additional ip addres if i have more then one ips’s on the vps?

  14. Vee says:


    ive installed you script and is working brilliantly except for 1 thing:

    After a while of working finely, it slows down and then completely stops. Its comes back up when I disconnect then connect again.? Is there a solution for this?

    This isnt a problem but I want to know how I connect my pptp server IP to a subdomain like for e.g., so for the server hostname (on client) I dont have to put the IP?

    Thank you

  15. ed says:

    i have installed using ur script but when trying to connect from client im getting error 800

  16. Rockia says:

    as long as your subdomain could be resolved to your VPN IP, I don’t see why you can’t use the subdomain as your VPN server hostname

    • Vee says:


      Ive tried creating a subdomain and trying to forward it to the vpn ip but it doesnt work, ive even tried creating a host summary for it but that doesnt work either.

      I will try installing LAMP on the vpn server then try it again. That I believe should work.

      Anyways thank you.

  17. greg says:

    Thanks Rockia, that was easy!

  18. anonym says:

    how to create single sign on PPTP server?

  19. silverboy says:

    thanks for this great script
    i want setup it to only 1 person can connect with 1 username
    now , in the same time some peapole can connect with one username

  20. shopboy says:

    Hi Rockia thanks for the great script.

    I can’t get my MAC to connect but not my PC. Any idea where the problem is ?

  21. majid says:

    hi , i try to connect my vpn server but i get 619 error ? what can i do ?

  22. soccer blog says:

    good shell program, it is very nice!

  23. BABAK says:

    When want to connect to the server this message show:
    The PPP link control protocol was terminated.

  24. ITs GREAT! says:

    Man, THANKS A LOT!

    I had a real headache with all this server vpn software stuff.
    Now it becomes really easy as 1-2-3!

  25. Arvendu says:

    Getting error 800 can u please tell me how to fix it

  26. Edmund Tee says:

    Hi, great tutorial.
    Wanna ask, aftet setring up the vpn on centos, how can other pc (win7 or winxp) connect to the vpn on centos?

    Your help is much appreaciate .


  27. can says:

    I got error 800. could you please tell me what’s wrong with me :D ?

    • can says:

      Hi There,
      I know It was stupid but the problem was my firewall :) I turned off it and I successfully connected my vpn.

      but I have different problem right now. When I connected vpn, I can not access anywhere. It looks like a DNS problem but I don’t know how can made it. I also can’t send ping or trace-route.

  28. mohamed says:

    every body
    it’s amazng way
    and it worked
    but thire is a problem
    when i connect i lose my internet connection and just ping to the server ip working
    and i don’t have ant internet
    but when i uncheck ( use defult gateway on remote network )
    my internet back but when i go to
    i found my real ip
    i need to have a full internet access from the centos server can you help me?
    and thx again

  29. Owen says:

    Thanks for sharing your knowledge and skills. I tried your script after spending countless without success trying to get a vpn running with poptop. Your script ran first time without issue on my Centos Server. VPN worked first time

    Nice one !!!!!!! And thanks again you made the impossible, possible for me at least being a Linux babe!

  30. mahdi says:

    thanks for great tutorial.
    i have question if i want a user connect with static ip
    should i only type the static ip on etc/ppp/chap-secrets
    under ip addresses
    thank you

    • Rockia says:

      That’s true. If you type an IP address instead of “*” (* means any or don’t care) then only that user with that IP can connect.

  31. JP says:

    If I will be using an internal networks with – .255 and what can I change to be able to connect to the internall network?

    Than ks,

  32. hi
    i install the script in centos 5.5 , and every thing is OK
    when i try from my laptop to connect vpn
    tell me “VPN connection filled”
    (i follow this tutorial
    info : i use ubuntu , control panel of server veportal

  33. morteza says:

    i have a dedicated server centos 5.5,without any vps
    after install this script server was down.please help me fast.thanks

    • Rockia says:

      Do you mean the VPN server or the VPS? If the VPN is down you can use “/etc/init.d/pptpd restart” to restart the server. If it’s regarding to the VPS itself, please contact your VPS provider.

  34. morteza says:

    thanks for your good script.
    my firewall block connection port.
    what port use for this vpn?

  35. Ntini says:


    I’m novice to this, I have installed the script and the process has gone successfully till end, could you please assist me how I can connect to this VPN using my local machine connected to internet?

    Thanks in advance.

  36. Ali says:

    How can i have a user manager program with this?

    • Rockia says:

      Sorry, this script is currently on command line only. But hey, you know what? I think it’s a good idea to develop a GUI to manage the VPN users. I will get my hands on this project when I am less busy at my daily work. I know you might not come here very often, but I promise you, once I am done, I will email you a copy.

  37. James says:


    Great script btw, I have setup and can connect with no problems, is there a way multiple accounts can be setup to connect?


    • Rockia says:

      Hello James, yes, you can edit the chap-secrets file and add multiple users (one per line, including name and password).

      I will probably make a GUI manager for it and send you once it’s done.

  38. saeid says:

    thanx Rockia,god save you for us

  39. Samuel says:

    Could u help me install it in Centos 6, 32 bit? it did not create the chap secrets file or its directory. Some conflict with ppp version.

  40. Centos USER says:

    hi im still downloading now.. hope it great!

  41. Mark R says:

    Thanks for this man, saved me so much work with openvpn, made a few modifications to the script to fit me exactly and I am well happy with it.

    One slight issue, (and im 100% its not a problem with your script). I tried to add echo “/sbin/ifconfig $1 mtu 1400″ >> /etc/ppp/ip-up

    When i checked that file afterwards it showed /sbin/ifconfig mtu 1400

    any chance you could help me there bud?

  42. Samuel says:

    please post the tutorial for centos 6? thank you!

  43. Jonathan says:

    Thanks very much for this, made it so easy!

  44. Arnie Nelson says:

    The CentOS setup went smoothly. When I try to set up the VPN on my iPad 2, it asks for a “Secret” setting in addition to the user name and password. What is the “Secret” setting as established on the host computer?

  45. Arnie Nelson says:

    The secret problem is solved. I was using the L2PT tab instead of the PPTP tab. However, neither the iPad or my local Windows Vista systems will establish a connection to the CentOS server. Everything looks OK, pptd is running, the iptable contains the line
    “TCPMSS tcp — anywhere tcp flags:FIN,SYN,RST,ACK/SYN TCPMSS set 1356″

    Any ideas? Thanks.

  46. vijay says:


    Thanks very much for this, it is working very fine.

  47. Jake says:


    thank you very much for your script, every thing is working fine except that I could not surf any where !!
    I have traced by Microsoft tracert and I am 100% sure that packets are routed through my pptp connection through my VPS . but unfortunately surfing is impossible , I have 2 different VPS and I have this issue on both of them .

    Would you please Help me !

    Thank you

  48. Amir says:

    Hi Rockia,

    Was a perfect and 1 command togo toturial.
    Thanx for your Script and Good Luck :)


  49. amir says:

    Great… thanks bro!

  50. amir says:

    Great… thanks bro
    works great in mac for me (tested on centos 5.7) ..but i wonder if you can change this line ” nano etc/ppp/chap-secrets” to this “nano /etc/ppp/chap-secrets ”
    the first one, not work..

  51. joaca jocuri cu bile says:

    Good job writing Easy Installation of PPTP VPN Server on CentOS. I would like to read more about this topic.

  52. Faraz says:

    I have installed PPTPd on Centos 5.6 and clients are connecting from windows XP. it was working fine , now from last 1 week My sessions are disconnecting after some time. I tried installing fresh pptpd but the issue is still there. Now i did capture PPP packets on client machines by Wireshark and got to know that when the disconnection occurs the PPP LCP protocol is showing Protocol reject messages where destination is the client IP. Any body encountered the same problem please share the solution.

  53. Michal says:

    Great!!!! I have set up this with my Trixbox server – so I can call using mobile networks in the Netherlands – this is a country where all sip connections are blocked in the network.

    Thanks a lot!!!!

  54. INJ3CTORE says:


  55. Andi says:

    GREAT! Please keep it up!

  56. martin says:

    on Centos 6 , i have this error, someone have a easy way alternative ???

    Loaded plugins: fastestmirror, refresh-packagekit, security
    Loading mirror speeds from cached hostfile
    * base:
    * extras:
    * updates:
    Setting up Install Process
    No package openvpnwget available.
    No package available.
    Error: Nothing to do
    [root@centos-box ~]#


    • rockia says:

      First of all, this script won’t work with CentOS 6′s kernel.

      I think the result you posted as actually network issue. There might be network issue when you were trying to download the script from my site. If you run it again, it should download and installs. But like I said, it’s not for CentOS 6. I will post the CentOS 6 version once I tested it.

  57. Amit says:

    Thank you!

    Anyone succeeded in connecting to this VPN with a DD-WRT router? I think I “just” need the correct options.pptp file, so if anyone succeeded in connecting to this VPN from a CentOS or any other linux, perhaps you can share the commands and configuration files you have that’s working.

    I keep getting errors like:

    LCP terminated by peer (MPPE disabled)
    Modem hangup
    MPPE required, but MS-CHAP[v2] auth not performed.
    or others.

    Thanks a lot,
    Would very much appreciate your help.


  58. atmoner says:

    good work ! very good work ;)

  59. Mufaddal says:

    Installed pptpd as above procedure.. able to connect vpn server.. but unable to browse internet.. so please help me from where i can change gateway IP?
    also is it possible if i can allow to open few url only.. and block other.. what about opening ports like 5060 and 5061

  60. Lukas says:

    It took me a long time to find a simple and working solution to enlable VPN on my VPS.

    I tried many times, without any visible effect.

    It took me just few minutes ;) and works perfectly.

  61. Andy says:

    Thank you for good script. Please keep it up!

  62. uzer says:

    thanks! very helpful… :)

  63. ng says:

    hi, thanks for your sharing

    any limited for how many user can use this vpn server ?

    any way to monitor vpn server status ?

  64. Izzy R says:


    This script has always worked for me so far but today for a new VPS server I received the following error:

    error: Failed dependencies: is needed by ppp-2.4.4-9.0.rhel5.i386
    warning: pptpd-1.3.4-1.rhel5.1.i386.rpm: Header V3 DSA/SHA1 Signature, key ID 862acc42: NOKEY
    error: Failed dependencies:
    ppp = 2.4.4 is needed by pptpd-1.3.4-1.rhel5.1.i386
    mknod: `/dev/ppp’: File exists line 25: /etc/ppp/options.pptpd: No such file or directory line 26: /etc/ppp/options.pptpd: No such file or directory line 33: /etc/ppp/chap-secrets: No such file or directory
    iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
    error reading information on service pptpd: No such file or directory
    pptpd: unrecognized service

    Any ideas what’s happening there to prevent that final step?

Leave a Reply

If you want a picture to show with your comment, go get a Gravatar.