Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2008
    Location
    ::1
    Posts
    618

    PPTP VPN Server on CentOS 6.x

    Obviously, installing a PPTP VPN server on a VPS is nothing new however configuring the service successfully can be tricky. The other day I came across the best installation guide I've seen.

    Full credit to Drew Morris over at http://drewsymo.com/networking/vpn/install-ptpp/

    Installation

    To get started with your own secure VPN, simply execute the following commands at your servers command-line:

    Code:
    yum install -y git
    cd /opt && git clone git://github.com/drewsymo/VPN.git
    cd VPN && bash vpn-setup-vanilla.sh
    Note: OpenVZ users, currently one of the iptables rules used in this script is not virtualised in OpenVZ (masquerade). This means you will need to run this line of code once you have finished installing the CentOS PPTP VPN script for it to work:

    Code:
    iptables -t nat -A POSTROUTING -j SNAT --to-source x.x.x.x
    Where x.x.x.x is your venet0 IP address

    In addition to this, you will also need OpenVZ kernel 2.6.32

    How do I connect to my VPN?

    You can now connect to your VPN using your servers IP as the hostname (this depends on your VPN client)

    The default username and password for your VPN server is:

    Username: myuser
    Password: mypass

    What’s the Code?

    See below for the code in all its glory; keep in mind that you might need to adjust a few of the parameters (localip, remoteip) to suit your requirements:

    Code:
    #!/bin/bash -x
    
    #
    # drewsymo/VPN
    #
    # Installs a PPTP VPN-only system for CentOS
    #
    # @package VPN 2.0
    # @since VPN 1.0
    # @author Drew Morris
    #
    
    (
    
    VPN_IP=`curl ipv4.icanhazip.com>/dev/null 2>&1`
    
    VPN_USER="myuser"
    VPN_PASS="mypass"
    
    VPN_LOCAL="192.168.0.150"
    VPN_REMOTE="192.168.0.151-200"
    
    yum -y groupinstall "Development Tools"
    rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm
    yum -y install policycoreutils policycoreutils
    yum -y install ppp pptpd
    yum -y update
    
    echo "1" > /proc/sys/net/ipv4/ip_forward
    sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf
    
    sysctl -p /etc/sysctl.conf
    
    echo "localip $VPN_LOCAL" >> /etc/pptpd.conf # Local IP address of your VPN server
    echo "remoteip $VPN_REMOTE" >> /etc/pptpd.conf # Scope for your home network
    
    echo "ms-dns 8.8.8.8" >> /etc/ppp/options.pptpd # Google DNS Primary
    echo "ms-dns 209.244.0.3" >> /etc/ppp/options.pptpd # Level3 Primary
    echo "ms-dns 208.67.222.222" >> /etc/ppp/options.pptpd # OpenDNS Primary
    
    echo "$VPN_USER pptpd $VPN_PASS *" >> /etc/ppp/chap-secrets
    
    service iptables start
    echo "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE" >> /etc/rc.local
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    service iptables save
    service iptables restart
    
    service pptpd restart
    chkconfig pptpd on
    
    echo -e '\E[37;44m'"\033[1m Installation Log: /var/log/vpn-installer.log \033[0m"
    echo -e '\E[37;44m'"\033[1m You can now connect to your VPN via your external IP ($VPN_IP)\033[0m"
    
    echo -e '\E[37;44m'"\033[1m Username: $VPN_USER\033[0m"
    echo -e '\E[37;44m'"\033[1m Password: $VPN_PASS\033[0m"
    
    ) 2>&1 | tee /var/log/vpn-installer.log
    Shaun
    "Winners never quit. Quitters never win."

  2. #2

    Thanks!

    Hey sfnz,

    Thank's for the kind comments, and glad you liked the tutorial

  3. #3
    Thank's
    Used with permission
    copy to site

Similar Threads

  1. REQD: Dynamic IP PPTP VPN server in CentOS 5 32bit
    By mac_invictus in forum Employment / Job Offers
    Replies: 8
    Last Post: 10-03-2012, 07:14 PM
  2. Setup private IP's in PPTP VPN in CentOS
    By mark103 in forum Employment / Job Offers
    Replies: 0
    Last Post: 10-17-2011, 05:00 PM
  3. Replies: 5
    Last Post: 09-22-2010, 04:57 PM
  4. Setup PPTP VPN Server
    By HostVillage Sales in forum Systems Management Requests
    Replies: 5
    Last Post: 02-11-2010, 10:09 PM
  5. Setting up PPTP VPN Server on CentOS Linux
    By InfiniteTech in forum Employment / Job Offers
    Replies: 6
    Last Post: 07-08-2008, 12:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •