CentOS 6.2 Configure PPTP VPN (based on VPS)

Source: Internet
Author: User
Tags require centos vps iptables egrep

One-click to build PPTP VPN scripts

Download Centos6.2 a key to build a PPTP VPN script

The code is as follows Copy Code

#wget http://www.hi-vps.com/shell/vpn_centos6.sh
#chmod a+x vpn_centos6.sh

Install Centos6.2pptpvpn script #bash vpn_centos6.sh

After the execution there are 1, 2, 3 kinds of English, corresponding to the following Chinese meaning.

1. Install VPN Service
2. Repair VPN
3. Add VPN user

We want to install PPTP VPN, of course enter 1, and then enter the key. Waiting for the installation to complete, will appear the account and password, the default account is a VPN, password is a series of random numbers, the use of their own words do not need to add the account number and password, copy down standby bar.

Fast configuration of PPTP VPN


1. PPTP uses PPP protocol to encapsulate user data, and then encapsulates PPP data frames in IP datagrams and spreads over IP networks. So first you need to support the PPP protocol

The code is as follows Copy Code

[Root@chenyi ~]# Yum Install PPP

Dependencies resolved

=============================================================================================================== =
Package Arch Version Repository Size
=============================================================================================================== =
Installing:
PPP i686 2.4.5-5.EL6 base 319 k

Transaction Summary
=============================================================================================================== =
Install 2 Package (s)

Total Download size:319 k
Installed size:715 K
Is this OK [y/n]: Y

2, install pptpd (according to your operating system platform to find the corresponding installation package)

  code is as follows copy code
[root@chenyi ~] # RPM-UVH https://qiaodahai.googlecode.com/files/pptpd-1.3.4-2.el6.i686.rpm
Retrieving https:// qiaodahai.googlecode.com/files/pptpd-1.3.4-2.el6.i686.rpm
Warning:/var/tmp/rpm-tmp. Hnhmx5:header V3 dsa/sha1 Signature, key ID 862acc42:nokey
preparing...                 ########################################### [100%]
    1:pptpd                   ########################################### [100%]

3, change the configuration file

The code is as follows Copy Code


[Root@chenyi ~]# cat/etc/ppp/options.pptpd | Egrep-v "^#|^$"
Name PPTPD
Refuse-pap
Refuse-chap
Refuse-mschap
Require-mschap-v2
require-mppe-128
Ms-dns 8.8.8.8
Ms-dns 8.8.4.4
Proxyarp
Lock
Nobsdcomp
Novj
Novjccomp
Nologfd

4. Password configuration file

The code is as follows Copy Code
[Root@chenyi ~]# Cat/etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# Client Server Secret IP addresses
Itchenyi pptpd Itchenyi *

5, PPTPD configuration file

The code is as follows Copy Code
[Root@chenyi ~]# cat/etc/pptpd.conf | Egrep-v "^#|^$"
Option/etc/ppp/options.pptpd
Logwtmp
Localip 192.168.70.1
Remoteip 192.168.70.207-217

6, change the kernel configuration, turn on IP forwarding

The code is as follows Copy Code
#conf file path:/etc/sysctl.conf
[Root@chenyi ~]# Sysctl-p
Net.ipv4.ip_forward = 1
Net.ipv4.conf.default.rp_filter = 1
Net.ipv4.conf.default.accept_source_route = 0
Net.ipv4.tcp_syncookies = 1
KERNEL.MSGMNB = 65536
Kernel.msgmax = 65536
Kernel.shmmax = 68719476736
Kernel.shmall = 4294967296
Net.ipv4.icmp_echo_ignore_broadcasts = 1
Net.core.somaxconn = 1024

7. Configure Iptables

The code is as follows Copy Code

Iptables-a input-p tcp-m TCP--dport 1723-j ACCEPT
Iptables-a forward-s 192.168.70.0/24-j ACCEPT
Iptables-a forward-d 192.168.70.0/24-j ACCEPT
Iptables-t nat-a postrouting-s 192.168.70.0/24-j SNAT--to-source

8. Start service ....

  code is as follows copy code

 
[ Root@chenyi ~]# Service pptpd start

Related Article

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.