1, check whether the System kernel support MPPE patch
The code is as follows |
Copy Code |
Modprobe ppp-compress-18 &&echo Success Display Success Description system support MPPE patch, if not supported, you need to install Kernel-devel first Yum Install Kernel-devel
|
2, check whether the system to open TUN/TAP support
Cat/dev/net/tun
If the instruction shows the result to the following text, it means:
Cat:/dev/net/tun:file Descriptor in #系统为英文版本
Cat:/dev/net/tun: The file descriptor is in an error state #系统为简体中文版本
If not, VPS services need to open the TUN/TAP function, the general VPS by default to open this function
3, the installation of PPP and Iptables #安装PPTP需要这两个软件包 (by default, CentOS with these two packages)
The code is as follows |
Copy Code |
Yum install-y PPP Iptables
|
4. Install PPTP
The code is as follows |
Copy Code |
Cd/usr/local/src wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.i386.rpm #下载 RPM-IVH pptpd-1.3.4-2.rhel5.i386.rpm #安装
|
System operation Dimension Warm reminder: qihang01 original content copyright, reprint please specify the source and the original link
5. Configure PPTP
(i),
The code is as follows |
Copy Code |
Cp/etc/ppp/options.pptpd/etc/ppp/options.pptpdbak #备份 VI/ETC/PPP/OPTIONS.PPTPD #编辑, save Name PPTPD Refuse-pap Refuse-chap Refuse-mschap Require-mschap-v2 require-mppe-128 Proxyarp Lock Nobsdcomp Novj Novjccomp Nologfd Ms-dns 8.8.8.8 Ms-dns 8.8.4.4 #设置DNS
|
(b),
The code is as follows |
Copy Code |
Cp/etc/ppp/chap-secrets/etc/ppp/chap-secretsbak #备份 Vi/etc/ppp/chap-secrets #编辑, save pptp* 123456 * #设置用户名: pttp Password: 123456
|
(iii),
The code is as follows |
Copy Code |
Cp/etc/pptpd.conf/etc/pptpd.conf.bak #备份 Vi/etc/pptpd.conf #编辑, save Option/etc/ppp/options.pptpd Logwtmp Localip 192.168.1.1 #设置VPN服务器IP地址 IP between the Remoteip 192.168.1.100-199 #为拨入VPN的用户动态分配192.168.1.100~192.168.1.199
|
6, open the system routing mode
The code is as follows |
Copy Code |
Vi/etc/sysctl.conf #编辑 Net.ipv4.ip_forward = 1 #开启路由模式 /sbin/sysctl-p #使设置立刻生效
|
7. Configure NAT forwarding for firewalls
The code is as follows |
Copy Code |
Iptables-t nat-a postrouting-s 192.168.1.0/24-o eth0-j Masquerade /etc/init.d/iptables Save #保存防火墙设置 /etc/init.d/iptables Restart #重启防火墙 Chkconfig iptables on #设置开机启动 |
8, set up PPTP boot
The code is as follows |
Copy Code |
/sbin/service pptpd Start #启动 /sbin/service pptpd Restart Chkconfig pptpd on #设置开机启动
|
At this point, the VPN server is completed, you can set up a VPN connection in the Windows client, enter the IP address of the server extranet, with the above configured account number, password to connect.