Installing and configuring PPTP VPN on CentOS

I’m gonna show you how to install and configure a VPN server on CentOS. Also you can use Windows VPN Client to connect this is server.

There are some easier ways to install a VPN server on CentOS but can be usable from just Linux clients or needs client applications installed on Windows to connect. I’m going to tell you how you can connect from a Windows client to Linux VPN Server without a client application.

Using OpenVPN as server is easier than installing VPN server with this article but you have to connect from Windows with OpenVPN client. OpenVPN client has to be installed on every Windows client.  If you dont wanna strive with installation just read above.

Windows comes with a VPN support that works with PPTP (Point-to-Point Tunneling Protocol). So we can use it in our VPN server.
I’m working on CentOS 5.5 x86 and gonna give rpms suitable with that system.

Download rpms to your server

wget http://out.ahm.gen.tr/rpm/dkms-2.0.17.5-1.noarch.rpm
wget http://out.ahm.gen.tr/rpm/kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
wget http://out.ahm.gen.tr/rpm/libpcap-0.8.3-12.el4_6.1.i386.rpm
wget http://out.ahm.gen.tr/rpm/ppp-2.4.3-5.rhel4.i386.rpm
wget http://out.ahm.gen.tr/rpm/pptpd-1.3.3-1.rhel4.i386.rpm

PPTPD needs something more installed on server but we can use benefits of yum here :) but first we have to add rpmforge repo to yum now.

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Now use this command to get necessary things installed.

yum -y install gcc glibc make perl

You will need iptables installed too. If you dont have just type this command.

yum -y install iptables

Now we have everything that we need. We can start to install.

rpm -ivh dkms-2.0.17.5-1.noarch.rpm
rpm -ivh
kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
rpm -ivh libpcap-0.8.3-12.el4_6.1.i386.rpm
rpm -ivh ppp-2.4.3-5.rhel4.i386.rpm
rpm -ivh pptpd-1.3.3-1.rhel4.i386.rpm

From now on our VPN server is ready to use but one more thing we have to do.
Setting up users, IP address configuration and ms-dns string.

Edit /etc/pptpd.conf with your favourite editor and add this lines to end.

localip 192.168.0.1
remoteip 192.168.0.2-100

Open /etc/ppp/options.pptpd file and uncomment lines that starts with ms-dns. Change them with this.

ms-dns 208.67.222.222
ms-dns 208.67.222.222

OpenDNS would be great to use in VPN system.

We have to route traffic that comes from VPN clients to outside. Iptables will help us here.

iptables -t nat -F
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 –out-interface eth0 –jump MASQUERADE
echo 1 >/proc/sys/net/ipv4/ip_forward

Time to create VPN users :) edit /etc/ppp/chap-secrets file. Every new line that written in the format will be a user.
Format is simple, here a example.

# Secrets for authentication using CHAP
# client        server  secret                  IP addresses
ahm     pptpd   123456  192.168.0.20

We have a user that named ahm and uses 123456 as password. 192.168.0.20 assigned to ahm. When client connected that IP addresses will be defined for client.
Start pptpd now, set it to start on boot with this commands.

service pptpd start
chkconfig pptpd on

Thats all :) you can connect from Windows clients to your new VPN server.

1 Response to “Installing and configuring PPTP VPN on CentOS”


  1. 1 Uçan Sapık

    bu olaylar kara tahtada geçiyor dimi

Leave a Reply




Ahm is Digg proof thanks to caching by WP Super Cache