How to install and configure PPTPVPN in CentOSLinuxVPS

Source: Internet
Author: User
Many netizens use VPN or proxy when visiting some websites. This article references the methods for building PPTPVPN in OPENVZVPScentos. PPTPVPN is generally supported on the XEN virtual technology VPS. However, many VPS host vendors provide new versions of OpenVZVPS, which can be used to build PPTPVPN

Many netizens use VPN or proxy when visiting some websites. This article will reference other people's experiments.CentosTo build a pptp vpn.

Pptp vpn is generally supported on the XEN virtual technology VPS. However, many VPS host vendors provide new versions of OpenVZVPS, which can be used to build pptp vpn. it is said that it is a new technology of OpenVZ, but currently BurstNET VPS does not support building PPTPVPN. Currently, OPENVZ supports pptp host providers such as BUYVM, Directspace, and VPSyou.

The following uses the VPS of BuyVM.net as an example to describe how to build a pptp vpn in CentOS.

1. log on to SSH and check whether VPS is supported. If the check results do not support these features, pptp cannot be installed.

There are two required checks:
First check:

Cat/dev/net/tun

The returned result is the following text, indicating that:

Cat:/dev/net/tun: File descriptor in bad state

Second check:

Cat/dev/ppp

If the following result is returned:

Cat:/dev/ppp: No such device or address

Return value: "Permission denied. You can install pptp only when both of the above two items are passed. If you fail, you can only apply to the customer service to enable the TUN/TAP/PPP function for your VPS.

Third, check whether encryption is supported. If not, remove the encryption feature from the configuration file. Set encryption to optional when connecting to the client.

Modprobe ppp-compress-18 & echo OK

2. install ppp andIptables.

Yum install-y ppp iptables

3. install pptp.
(For 32-bit systems)

Rpm-ivh
Http://acelnmp.googlecode.com/files/pptpd-1.3.4-1.rhel5.1.i386.rpm

(64-bit system)

Rpm-ivh
Http://acelnmp.googlecode.com/files/pptpd-1.3.4-1.rhel5.1.x86_64.rpm

Some friends prefer wget before executing rpm, so there is no need to do this.

4. configure pptp. First, edit the/etc/pptpd. conf file:

Vim/etc/pptpd. conf

Remove the # above the field below. the IP segment here can be any, but do not conflict with the IP segment of the local network.

Localip 192.168.80.1 remoteip
192.168.80.234-238,192.168 .80.245

Next, edit/etc/ppp/options.ppt pd:

Vim/etc/ppp/options.ppt pd

Remove "#" before "ms-dns" and modify it to the following fields:

Ms-dns 8.8.8.8 ms-dns 8.8.4.4

Note:
Briefly describe how to use the vim editor. The vi/vim command is an editor, similar to the notepad under WIN. After a file is vi, press I, and insert will be displayed in the lower left corner. This file can be modified only after the file is vi. After modification, press insert in the lower-left corner of esc and enter x and press enter to exit the storage disk. Alternatively, enter wq and press enter to exit the storage disk, enter q !, Press Enter.
5. set the pptp VPN account password. Edit the/etc/ppp/chap-secrets file:

Vim/etc/ppp/chap-secrets

Enter the following fields. The first is the user name and the third is the password. you can specify the user name you want.

Vpn pptpd vpnpass *

6. modify the kernel settings to support forwarding. Edit the/etc/sysctl. conf file:

Vim/etc/sysctl. conf

Change "net. ipv4.ip _ forward" to 1:

Net. ipv4.ip _ forward = 1

At the same time, add # before "net. ipv4.tcp _ syncookies = 1 #:

# Net. ipv4.tcp _ syncookies = 1

Save and exit, and execute the following command to take effect:

Sysctl-p

7. add iptables forwarding rules.


Iptables-t nat-a postrouting-s 192.168.16.0/24-j SNAT -- to-source 12.34.56.78


Iptables-t nat-a postrouting-s 192.168.16.0/24-j SNAT -- to-source 12.34.56.78

(OpenVZ and 192.168.80.0 must match the IP address range set above. 12.34.56.78 is the public IP address of your VPS)

Iptables-t nat-a postrouting-s 192.168.0.0/24-o eth0-j
MASQUERADE

(XEN, directly set the corresponding Nic .)

Note: If iptables is set incorrectly, you can directly change vim/etc/sysconfig/iptables to this file.

Save iptables forwarding rules:

/Etc/init. d/iptables save

Restart iptables:

/Etc/init. d/iptables restart

8. restart the pptp service.

/Etc/init. d/pptpd restart

9. set the service to run automatically upon startup.

Chkconfig pptpd on chkconfig iptables on

If it is normal, it will be OK here, so you don't have to worry about the following errors. Otherwise, see the error description.

Error 1:If error 619 is displayedEnter the following command:

Rm-rf/dev/ppp

Mknod/dev/ppp c 108 0

Then reboot and restart the VPS.

Error 2:If error 800 is displayedThis is because the virtual machine kernel does not support mpPE and cannot use encryption. the default windows vpn connection will display "certificate trust error ". Solution: modify the/etc/ppp/options.ppt pd file, add # in front of the require-mppe-128 field, comment out the require-mppe-128 line is successful ().

Also, do not forget to change the vpn attribute of the local windows system to optional encryption, such:

Source: http://www.piaoyi.org/network/OpenVZ-VPS-PPTP-VPN.html

System requirements: CentOS 5 32bit/64bit. If the VPS installation requires Xen virtualization technical support or the latest OpenVZ technical support.

This method has been successfully tested on the following VPS: VPSyou Xen; BuyVM OpenVZ; YardvpsXen.

Installation method: log on to SSH and enter the following command:

Dedicated for CentOS 5.x:

Wget http://www.huzs.net/soft/pptp_onekey/pptpd5.sh

Sh pptpd5.sh

Dedicated for CentOS 6.x:

Wget http://www.huzs.net/soft/pptp_onekey/pptpd6.sh

Sh pptpd6.sh

After the installation is complete, the vpn user name and password are displayed.

VPN user management:
Directly edit the file: add the user name and password in the same format.

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.