This tutorial is applicable to CentOS.
1. Check the server for necessary support. If the check results do not support these features, pptp cannot be installed. Command:
modprobe ppp-compress-18 && echo ok
After this execution, "OK" indicates that the execution is successful. However, another check is required. Enter the following command:
cat /dev/net/tun
If the following information is displayed, ticket can be activated for vps vendors if not supported. Most vps vendors in the United States can:
Cat:/dev/net/tun: File descriptor in bad state
The above two can install VPN (pptp) as long as the following one passes through)
2. Install ppp and iptables.
yum install -y ppp iptables
3. Install pptp.
rpm -ivh http://acelnmp.googlecode.com/files/pptpd-1.3.4-1.rhel5.1.i386.rpm(32bit)rpm -ivh http://acelnmp.googlecode.com/files/pptpd-1.3.4-1.rhel5.1.x86_64.rpm (64bit)
4. Configure pptp. Edit the/etc/pptpd. conf file:
vim /etc/pptpd.conf
Remove the previous # Remove:
localip 192.168.0.1remoteip 192.168.0.234-238,192.168.0.245
Edit the/etc/ppp/options.ppt pd file:
vim /etc/ppp/options.pptpd
Remove "#" before "ms-dns" and modify it to the following data:
ms-dns 8.8.8.8ms-dns 8.8.4.4
5. Set the VPN account and password you need. Edit/etc/ppp/chap-secrets here:
vim /etc/ppp/chap-secrets
Enter the following fields directly. You can replace taojz with other fields in the format of "User Name pptpd password *". If you need multiple accounts, write multiple lines and one line at a time:
taojz pptpd password *
6. 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" to become:
# net.ipv4.tcp_syncookies = 1
Save and exit. Execute the following command to take effect:
sysctl -p
7. Add iptables forwarding rules.
Iptables-t nat-a postrouting-s 192.168.0.0/24-j SNAT -- to-source 1.1.1.1 # Use this command in OpenVZ, 1.1.1.1 use this command for your vps ip address iptables-t nat-a postrouting-s 192.168.0.0/24-o eth0-j MASQUERADE # XEN System
The ip address "192.168.0.0/24" must correspond to the previous "localip" CIDR block, and the network adapter eth0 must be noted. If your network adapter is not eth0, change it to your corresponding Nic name!
Save your iptables forwarding rules:
/etc/init.d/iptables save
Restart iptables. command:
/etc/init.d/iptables restart
8. Restart pptp and run the following command:
/etc/init.d/pptpd restart
9. Set the service to run automatically upon startup:
chkconfig pptpd onchkconfig iptables on
If error 619 is prompted when your vpn is configured for Dial-Up, enter the following command:
mknod /dev/ppp c 108 0
After the installation is complete, 619 is displayed. After executing the preceding command, if the command does not take effect, only the vps is restarted. After the command is restarted, the dial-up Internet access is successful!