CentOS system installation PPTP (Xen + OpenVZ) complete tutorial

Time:2021-5-9

The installation of PPTP VPN on VPS perfectly explains the principle of “those who can do it are not difficult, and those who are difficult will not”. I Google Baidu Bing for several days, almost online most of the tutorials are not completely correct, finally yesterday to the whole rolling out, afraid to forget, quickly write down.

This paper is suitable for VPS that can open Tun and PPP, only for Xen and OpenVZ. If OpenVZ uses the solusvm control panel, it can be opened in the background by itself. By the way, my operating system is CentOS 6.4 32-bit.

1、 Confirm the opening of Tun and PPP

Please ignore this step for Xen users!

Copy code

The code is as follows:

cat /dev/ppp

The result output is: cat / dev / PPP: no such device or address

Copy code

The code is as follows:

cat /dev/net/tun

The result output is: cat / dev / net / Tun: file descriptor in bad state

If the output of these two items is different from what I have given, but it is OK as long as it is not “permission denied”, otherwise it must not be installed

2、 Installing PPP, PPTP

It is recommended to unload the built-in PPP first

Copy code

The code is as follows:

yum remove ppp

Install Libpcap

Copy code

The code is as follows:

yum -y install libpcap

Install ppp-2.4.5-5

Copy code

The code is as follows:

rpm -ivh https://lccss.googlecode.com/files/ppp-2.4.5-5.el6.i686.rpm

perhaps

Copy code

The code is as follows:

yum -y install ppp

Install pptpd-1.3.4-2

Copy code

The code is as follows:

rpm -ivh http://lccss.googlecode.com/files/pptpd-1.3.4-1.el6.nux.i686.rpm

Update it. If it’s centos6, you can install it directly using Yum to save the trouble. By default, there is no PPTP in yum, so upgrade the source first:

Copy code

The code is as follows:

rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm

Then directly install pptpd (PPP and Libpcap will be installed together)

Copy code

The code is as follows:

yum install pptpd

3、 Various configurations

The left side of the arrow is the content to be modified, and the right side of the arrow is what it should look like after modification

Copy code

The code is as follows:

vi /etc/pptpd.conf

Remove#

Copy code

The code is as follows:

# localip 192.168.0.1 -> localip 192.168.0.1
# remoteip 192.168.0.234-238,192.168.0.245 ->remoteip 192.168.0.234-238,192.168.0.245</p>
<p>vi /etc/ppp/options.pptpd

Remove #, and replace it with Google’s DNS

Copy code

The code is as follows:

# ms-dns 192.168.0.1 -> ms-dns 8.8.8.8
# ms-dns 192.168.0.2 -> ms-dns 8.8.4.4</p>
<p>vi /etc/ppp/chap-secrets

Create user name, password and limited IP in the form of user name ppptp password IP address
The middle of each field is separated by a space. If the last IP address is not limited, please use * instead, for example:

Copy code

The code is as follows:

username pptpd password *

This means that you have created a user named username with password. Any IP can be connected

Copy code

The code is as follows:

vi /etc/sysctl.conf
net.ipv4.ip_forward = 0 -> net.ipv4.ip_forward = 1</p>
<p>sysctl -p

The firewall forwarding of Xen and OpenVZ are different

OpenVZ please use:

Copy code

The code is as follows:

Iptables – t NAT – a postrouting – s 192.168.0.0/24 – J SNAT — to source your VPS IP

Xen please use:

Copy code

The code is as follows:

iptables -t nat -A POSTROUTING -s 192.168.8.0/24 -o eth0 -j MASQUERADE

Save and restart firewall

Copy code

The code is as follows:

/etc/init.d/iptables save
/etc/init.d/iptables restart

Open pptpd

Copy code

The code is as follows:

service pptpd start

OK, now you can connect your PPTP VPN with your computer!

4、 Other small problems

619 error, try:

Copy code

The code is as follows:

rm -r /dev/ppp
mknod /dev/ppp c 108 0

800 error. All I encountered were firewall problems. Because I didn’t understand iptables very well, I used a stupid method, which was to clear all the firewall rules before, and then use the above rules to keep restarting. Firewall rules before clearing:

Copy code

The code is as follows:

iptables -F
iptables -X
iptables -Z