twitter
    Find out what I'm doing, Follow Me :)

Wednesday, February 23, 2011

How to Configure VPN (PPTP) Server on CentOS

In this document you will find the steps on how to build a Linux Point to Point Tunneling Protocol (PPTP) server using Poptop.
This allows roaming users to connect to their corporate network from anywhere on the Internet securely and inexpensively.
It supports Windows 95/98/Me/NT/2000/XP PPTP clients and Linux PPTP clients.
Requirements: -
Server: CentOS 5.3
kernel-2.6.18-128.el5
ppp-2.4.4-2.el5
pptpd-1.3.4-1.rhel5

Kernel version 2.6.15 or above has MPPE built-in which is required for MSCHAPv2. CentOS 5 kernel version is 2.6.18 that means you do not need to install the MPPE module. CentOS 5comes with ppp-2.4.4-1.el5 and it is MPPE support enabled.

Step-1: Install ppp if already not installed and Check if kernel supports MPPE
#yum install ppp
Run the command below to test if your kernel supports MPPE and you should get a return an “ok”: -
#modprobe ppp-compress-18 && echo ok

Step-2: Install PPTPD
You cannot install the pptpd using yum utility because it’s not in yum repo. Download the RPM file pptpd-1.3.4-1.rhel5.1.i386.rpm from http://poptop.sourceforge.net/yum/stable/packages/

#wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.x86_64.rpm
Install the RPM by running this command: -
#rpm -ivh pptpd-1.3.4-2.rhel5.x86_64.rpm

Step-3: Configuration
Change the /etc/ppp/options.pptpd as below: -
#vi /etc/ppp/options.pptpd
name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd

Change the following file /etc/pptpd.conf
#vi /etc/pptpd.conf
option /etc/ppp/options.pptpd
logwtmp
localip 192.168.2.1
remoteip 192.168.2.11-15

Add the following username (johndie) and password (passwrd) in /etc/ppp/chap-secrets as below: -
# Secrets for authentication using CHAP
# client server secret IP addresses

shamsul pptpd passwrd *

Step-4: Run the following command to enable the pptpd to start automatically in runlevel 3 and 5 as below: -
#chkconfig --level 35 pptpd on
Now, you can start the pptpd service as below: -
#service pptpd start

Step-5: For pptpd to work, the packet forwarding must be enabled. Edit /etc/sysctl.conf and change the line to below: -
#vi /etc/sysctl.conf
net.ipv4.ip_forward = 1

To enable it immediately, run following command: -
#sysctl -p
Now test your setup by creating a vpn connection from any windows or linux pc.

credit to: http://almamunbd.blogspot.com/2009/06/how-to-configure-vpn-pptp-server-on.html

Thursday, February 10, 2011

Setup VNC Server on CentOS


  1. yum install vncserver 
  2. vi /etc/sysconfig/vncservers
  3. VNCSERVERS="1:tiger 2:albatros 3:leopard"                                      VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"                                      VNCSERVERARGS[2]="-geometry 800x600 -depth 8"                                      VNCSERVERARGS[3]="-geometry 1024x768 -depth 16"
    3.  vncpasswd tiger
    4.  vi /home/tiger/.vnc/xstartup (uncomment below line)
         unset SESSION_MANAGER
         exec /etc/X11/xinit/xinitrc
    5. /etc/init.d/vncserver start