Build a VPN Server under CentOS6.2

Source: Internet
Author: User
Tags vps

Build a VPN Server under CentOS6.2

1.Install using yumPpp:

$ yuminstallppp-y

2. Download and install pptpd. You can obtain it on this website.Http://poptop.sourceforge.net/yum/stable/packages/:

(Depends on the number of digits in the operating system. Here is the 64-bit x86_64 version)

$cd/usr/local/src $wgethttp://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.el6.x86_64.rpm $ rpm -Uhvpptpd-1.3.4-2.el6.x86_64.rpm

3. After installation, open/Etc/pptpd. confAdd or modify the following Configuration:

localip 192.168.0.1 remoteip 192.168.0.234-238

4. Open/Etc/ppp/options.ppt pdAdd the dns of the vpn (use google dns ):

ms-dns 8.8.8.8

5. Add an account to the vpn and open/Etc/ppp/chap-secretsAdd the user name and password in the following format:

vpnuser pptpd myVPN$99 *

The format is as follows:[Username] [space] [server] [space] [password] [space] [IP addresses]

6. We need to enable IP Forwarding for the service./Etc/sysctl. confChange the following Configuration:

net.ipv4.ip_forward =1
# Net. ipv4.tcp _ syncookies = 1 comment out this line

7. Run the following command to make the configuration take effect:

$ sysctl-p

8. Add Rules to the firewall to allow NAT Translation:

$ iptables-tnat-APOSTROUTING-oeth0-jMASQUERADE
$ service iptables save
$ service iptables restart

Note: check when you finish Step 8./Etc/sysconfig/iptables. Make sure that the POSTROUTING rule is before any REJECT rule.

Depending on the Implementation of VPS, there are mainly openVZ and XEN. These two rules are:

OpenVZ:$ Iptables-t nat-a postrouting-s 192.168.0.0/24-j SNAT -- to-source **. ** (VPS public IP address is used here)

XEN: iptables-t nat-a postrouting-s 192.168.0.0/24-o eth0-j MASQUERADE

9.EnablePptpd Service self-start and re-Server

$ chkconfig pptpd on
$ init6

After the system is restarted, you can connect to the server through the VPN Client. You can view/Var/log/messageForPppAndPptpdRelated logs.

Reference: http://blog.secaserver.com/2011/10/install-vpn-pptp-server-centos-6/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.